scarybeasts / beebjit

A very fast BBC Micro emulator.
Other
132 stars 15 forks source link

Sideways RAM not initialised #41

Closed regregex closed 2 years ago

regregex commented 2 years ago

One of the command lines in EXAMPLES is not working for me. I enter:

./beebjit -swram d -rom d roms/E00DFS090 -fast -opt sound:off -0 test/perf/pi.ssd -log perf:speed

and it sits at the BASIC prompt with no FS banner. Shift+F12 tries to boot from RFS.

Slot 13 is writeable but the MOS is not finding firmware there (?&02AE = 0), and the ROM service entry point is never called because there are no service ROMs:

$ ./beebjit -swram d -rom d roms/E00DFS090 -fast -opt sound:off -0 test/perf/pi.ssd -log perf:speed -debug
info:audio:Windows timing capabilities min 1 max 1000000
info:perf:inturbo opcode $00 excessive len 139
info:perf:inturbo opcode $40 excessive len 137
[ITRP] D9CD: LDA #$40       [A=AA X=00 Y=00 S=FD F= ZI  1  ]
(6502db) b 8000
(6502db) b 8003
(6502db) c
unimplemented:misc:write of TUBE region
breakpoint 0 hit 1 times
[8000] 8000: CMP #$01       [A=01 X=00 Y=0E S=FF F= ZI  1  ]
(6502db) m 02a0
02A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 60 00 00  .............`..
02B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
02C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF  ................
02D0: FF FF FF 00 00 00 00 FF FF FF FF FF FF FF FF FF  ................
(6502db) m 0df0
0DF0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0E00: FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0E10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0E20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
(6502db)

Using the beebjit_win_0.9.8 build (from a MinGW shell) plus a copy of test/.

regregex commented 2 years ago

Possibly unrelated, but bbc_page_rom() is quitting early because it is unaware the memory type has changed: main.c:503 calls bbc_load_rom() which sets p_bbc->romsel to the same slot number as passed to bbc_make_sideways_ram(), and so bbc_page_rom() called within the latter finds (curr_is_ram == new_is_ram) true.

scarybeasts commented 2 years ago

Thanks for reporting this. I've got a change coming that repairs the worst of this.

There is a regression where the BBC state is reset after the ROMs are loaded. The issue is that the E00 DFS ROM is a bit unusual. I think the actual hardware "back in the day" was part ROM, part RAM. beebjit doesn't yet emulate anything more complicated than "16K ROM bank" or "16K RAM bank". In the case of the E00 DFS ROM, it's loaded into the ROM slot but then tagged as a 16K RAM bank. So it behaves like pre-initialized sideways RAM. The trouble is that the regression causes the sideways RAM to be cleared directly after it is loaded!

With the upcoming change, it's still not perfect -- pressing Alt-R to do a full power-on reset will trash the sideways RAM content and fail to reload it.