neophob / wpc-emu

Williams Pinball machine emulator, Play it @
https://playfield.dev
Apache License 2.0
70 stars 12 forks source link

Johnny Mnemonic crash #18

Closed neophob closed 5 years ago

neophob commented 5 years ago

multiple different crashes.

I suspect multiple issues:

Question:

neophob commented 5 years ago

Some errors

CPU_WRITE8_FAIL {"offset":26818,"subsystem":"system"} 59586 255
23:39:36.475 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":26818,"subsystem":"system"} 59586 255
23:39:36.476 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":26818,"subsystem":"system"} 59586 255
23:39:36.477 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":32512,"subsystem":"system"} 65280 255
23:39:36.478 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":32512,"subsystem":"system"} 65280 255
..
CPU_WRITE8_FAIL {"offset":1535,"subsystem":"system"} 34303 239
23:44:43.953 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":1281,"subsystem":"system"} 34049 255
23:44:43.954 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":17896,"subsystem":"system"} 50664 254
23:44:43.955 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":17797,"subsystem":"system"} 50565 254
23:44:43.956 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":4157,"subsystem":"system"} 36925 97
23:44:43.957 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":11424,"subsystem":"system"} 44192 97
CPU_WRITE8_FAIL {"offset":32767,"subsystem":"system"} 65535 0
23:45:29.982 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":32767,"subsystem":"system"} 65535 0
23:45:29.983 cpu6809.js:454 Uncaught Error: TFREXG_ERROR
    at Cpu6809.TFREXG (cpu6809.js:454)
    at Cpu6809.step (cpu6809.js:1078)
    at Cpu6809.steps (cpu6809.js:2388)
    at WpcCpuBoard.executeCycle (cpu-board.js:159)
    at Emulator.executeCycle (emulator.js:46)
    at step (main.js:103)
CPU_WRITE8_FAIL {"offset":28897,"subsystem":"system"} 61665 0
23:46:47.681 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":32498,"subsystem":"system"} 65266 110
23:46:47.683 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":32497,"subsystem":"system"} 65265 0
23:46:47.684 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":32767,"subsystem":"system"} 65535 226
23:46:47.686 cpu6809.js:408 Uncaught Error: getPBR_INVALID14
    at Cpu6809.getPBR (cpu6809.js:408)
    at Cpu6809.TFREXG (cpu6809.js:457)
    at Cpu6809.step (cpu6809.js:1074)
    at Cpu6809.steps (cpu6809.js:2388)
    at WpcCpuBoard.executeCycle (cpu-board.js:159)
    at Emulator.executeCycle (emulator.js:46)
    at step (main.js:103)
cpu-board.js:253 CPU_WRITE8_FAIL {"offset":32520,"subsystem":"system"} 65288 0
23:47:22.664 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":1792,"subsystem":"system"} 34560 53
23:47:22.665 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":256,"subsystem":"system"} 33024 127
23:47:22.666 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":17128,"subsystem":"system"} 49896 134
23:47:22.667 cpu-board.js:253 CPU_WRITE8_FAIL {"offset":17797,"subsystem":"system"} 50565 134
23:47:22.669 cpu6809.js:596 Uncaught Error: INVALID_ADDRESS_MODE_0x0A
    at Cpu6809.PostByte (cpu6809.js:596)
    at Cpu6809.step (cpu6809.js:1358)
    at Cpu6809.steps (cpu6809.js:2388)
    at WpcCpuBoard.executeCycle (cpu-board.js:159)
    at Emulator.executeCycle (emulator.js:46)
    at step (main.js:103)
Uncaught Error: CPU_OPCODE_INVALID_PAGE1_0
    at Cpu6809.step (cpu6809.js:2262)
    at Cpu6809.steps (cpu6809.js:2407)
    at WpcCpuBoard.executeCycle (cpu-board.js:159)
    at Emulator.executeCycle (emulator.js:46)
    at step (main.js:103)
neophob commented 5 years ago

more debug information:

CPU_WRITE8_FAIL {"offset":32512,"subsystem":"system"} 65280 255 Error: X
    at WpcCpuBoard._write8 (webpack://WpcEmu/./lib/boards/cpu-board.js?:253:80)
    at Cpu6809.step (webpack://WpcEmu/./lib/boards/up/cpu6809.js?:1639:14)
    at Cpu6809.steps (webpack://WpcEmu/./lib/boards/up/cpu6809.js?:2388:21)
    at WpcCpuBoard.executeCycle (webpack://WpcEmu/./lib/boards/cpu-board.js?:159:36)
    at Emulator.executeCycle (webpack://WpcEmu/./lib/emulator.js?:46:26)
    at step (webpack:///./scripts/main.js?:103:13)

        case 0xa7: //STA indexed
            addr = this.PostByte();
            this.memoryWriteFunction(addr, this.regA);
            this.regCC &= ~(F_ZERO | F_NEGATIVE | F_OVERFLOW);
            this.regCC |= flagsNZ[this.regA & 0xFF];
            break;

CPU_WRITE8_FAIL {"offset":15616,"subsystem":"bank"} 32000 255 Error: X
    at WpcCpuBoard._write8 (webpack://WpcEmu/./lib/boards/cpu-board.js?:253:80)
    at Cpu6809.step (webpack://WpcEmu/./lib/boards/up/cpu6809.js?:1916:14)
    at Cpu6809.steps (webpack://WpcEmu/./lib/boards/up/cpu6809.js?:2388:21)
    at WpcCpuBoard.executeCycle (webpack://WpcEmu/./lib/boards/cpu-board.js?:159:36)
    at Emulator.executeCycle (webpack://WpcEmu/./lib/emulator.js?:46:26)
    at step (webpack:///./scripts/main.js?:103:13)

        case 0xe7: //STB indexed
      addr = this.PostByte();
      this.memoryWriteFunction(addr, this.regB);
      this.regCC &= ~(F_ZERO | F_NEGATIVE | F_OVERFLOW);
      this.regCC |= flagsNZ[this.regB & 0xFF];
      break;        
neophob commented 5 years ago

Looks like the hand test in the test menu crashes wpc emu all the time

neophob commented 5 years ago

when the irq timing is changed from 2097 to 2*2097, the game wont crash anymore.

looks like a weird timing issue!

neophob commented 5 years ago

from the traces:

CC=00 A=0006 B=0006 X=81DE Y=0000 S=1696 U=1E1F 610C: JSR  $91CE
CC=94 A=0006 B=0006 X=81DE Y=0000 S=168A U=1E1F DBCA: LDA   #$96

...

CC=80 A=0006 B=0006 X=81DE Y=0000 S=1696 U=1E1F 610C: JSR  $91CE
CC=80 A=0006 B=0006 X=81DE Y=0000 S=1694 U=1E1F 91CE: PSHS  A

-> 0xbd (JSR extended) op

however in this case thats just an error in the tracer as the irq jump is evaluated before the next op

neophob commented 5 years ago

If CALL_IRQ_AFTER_TICKS ticks is increased from 2049 to 4000 the emu does NOT crash

neophob commented 5 years ago

source of this crash is the hand interface, enter test menu is possible. the hand test then crash the emu

neophob commented 5 years ago

fixed initial hand switches, no more crashes. looks like a bug in the rom code

neophob commented 5 years ago

main issue was, that interrupts are queued. fixed in v0.9.0