Fix crashing when running at 100%

This commit is contained in:
meepingsnesroms
2018-09-21 14:23:17 -07:00
parent 07dfabffea
commit 469cf94090
8 changed files with 23 additions and 39 deletions

View File

@@ -18,4 +18,14 @@ Trap F API:SysEvGroupWait, API number:0xA2CB, PC:0x100371C4(printed 1 times)
Trap F API:SysDoze, API number:0xA08D, PC:0x101157D6(printed 1 times)(called from an unlabeled location presumably in the AMX68000 kernel)
Trap F API:HwrDoze, API number:0xA23F, PC:0x10017FA6(printed 1 times)(was called directly from SysDoze)
HwrDoze locks up when running at 100%, the cause is currently unknown.
HwrDoze locks up when running at 100%, the cause is currently unknown.
This fixes it but inaccurate, so it has something to do with PCTLR
//power control burst mode
/*
if(pctlr & 0x80)
newCpuSpeed *= (pctlr & 0x1F) / 31.0;
*/
Need to wake the CPU from PCTLR even if the interrupt is masked:
Power Control Enable—This bit controls the operation of the power control module. While this bit is low, the CPU clock is on continu- ously. When this bit is high, the pulse-width comparator presents the clock to the CPU in bursts or disables it. When this bit is high, a masked interrupt can disable the power control module.

View File

@@ -1,7 +1,6 @@
v0.7 to v0.9(Jul 30 2018 - Sept ** 2018)
What Needs To Be Fixed Still Before Release:
*crashing at 100%
*not saving on exit with Android
*double pressing power button issue
@@ -13,6 +12,7 @@ Qt GUI:
*can load and save savestates
Core:
*fixed crashing at 100% speed
*touchscreen works without memory injection
*can now touch the screen outside of debug mode
*touching the screen no longer crashes anything

View File

@@ -405,34 +405,6 @@ void sandboxTest(uint32_t test){
}
break;
case SANDBOX_TEST_TOUCH_READ:{
//since the sandbox can interrupt any running function(including ADC ones) this safeguard is needed
/*
if(ads7846BitsToNextControl == 0){
uint32_t point;
int16_t osX;
int16_t osY;
input_t oldInput = palmInput;
palmInput.touchscreenTouched = true;
palmInput.touchscreenX = randomRange(0, 159);
palmInput.touchscreenY = randomRange(0, 219);
//PrvBBGetXY on self dumped ROM
callFunction(false, 0x100827CE, NULL, "v(L)", &point);
osX = point >> 16;
osY = point & 0xFFFF;
debugLog("Sandbox: Real touch position is x:%d, y:%d\n", palmInput.touchscreenX, palmInput.touchscreenY);
debugLog("Sandbox: OS reported touch position is x:%d, y:%d\n", osX, osY);
palmInput = oldInput;
}
else{
debugLog("Sandbox: Unsafe to read touch position.\n");
}
*/
}
break;
case SANDBOX_SEND_OS_TOUCH:{
//this will not be in the v1.0 release
if(!m68k_read_memory_8(0x00000253)){
@@ -479,8 +451,9 @@ void sandboxOnOpcodeRun(){
logApiCalls();
#endif
switch(m68k_get_reg(NULL, M68K_REG_PPC)){
case 0x10083652://USB issue location
//case 0x10083652://USB issue location
case 0x100846C0://HwrDelay, before mysterious jump
case 0x100846CC://HwrDelay, after mysterious jump
//to add a emulator breakpoint add a new line above here|^^^
{
uint32_t m68kRegisters[M68K_REG_CPU_TYPE];

View File

@@ -5,7 +5,6 @@
enum{
SANDBOX_TEST_OS_VER = 0,
SANDBOX_TEST_TOUCH_READ,
SANDBOX_SEND_OS_TOUCH,
SANDBOX_PATCH_OS
};

View File

@@ -106,7 +106,7 @@ uint32_t emulatorInit(buffer_t palmRomDump, buffer_t palmBootDump, uint32_t spec
//config
palmClockMultiplier = (specialFeatures & FEATURE_FAST_CPU) ? 2.0 : 1.0;//overclock
palmClockMultiplier *= 0.80;//run at 80% speed, 20% is likely memory waitstates, at 100% it crashes on the spinning Palm welcome screen, 90% crashes at the digitizer test
//palmClockMultiplier *= 0.80;//run at 80% speed, 20% is likely memory waitstates
palmSpecialFeatures = specialFeatures;
setRtc(0,0,0,0);//RTCTIME and DAYR are not cleared by reset, clear them manually in case the frontend doesnt set the RTC

View File

@@ -75,11 +75,7 @@ int32_t interruptAcknowledge(int32_t intLevel){
else
vector = vectorOffset | intLevel;
//only active interrupts should wake the CPU and this function is only be called when an interrupt is active in both IMR and the CPU int mask
if(registerArrayRead8(PCTLR) & 0x80){
registerArrayWrite8(PCTLR, registerArrayRead8(PCTLR) & 0x1F);
recalculateCpuSpeed();
}
//only active interrupts should wake the CPU if the PLL is off
pllWakeCpuIfOff();
//the interrupt should only be cleared after its been handled
@@ -224,6 +220,12 @@ static void checkInterrupts(){
intLevel = 4;
}
//even masked interrupts turn off PCTLR, Chapter 4.5.4 MC68VZ328UM.pdf
if(intLevel > 0 && registerArrayRead8(PCTLR) & 0x80){
registerArrayWrite8(PCTLR, registerArrayRead8(PCTLR) & 0x1F);
recalculateCpuSpeed();
}
m68k_set_irq(intLevel);//should be called even if intLevel is 0, that is how the interrupt state gets cleared
}