mirror of https://github.com/bsnes-emu/bsnes.git
Update to bsnes v025r09? release.
I posted a new WIP last night. No binary this time, sorry. It redoes the memory mapping of the cartridge and moves it into the cartridge class -- forking each slotted cart away from the base cart memory. This allows me to determine the proper sizes for each individual cart again, so I can now map RPG Tsukuru II again correctly. EDIT: Ahahahahahah!! Finally! I figured out how the S-DD1 $4800 and $4801 registers work! :D Original game transfer (should transfer compressed->decompressed): CC2418 LDA #$4000 A:00DA X:F458 Y:1C00 S:01FA DB:00 D:0000 P:01 e CC241B PEA $00DB [0000DB] A:4000 X:F458 Y:1C00 S:01FA DB:00 D:0000 P:01 e CC241E LDX #$E8ED A:4000 X:F458 Y:1C00 S:01F8 DB:00 D:0000 P:01 e CC2421 LDY #$0800 A:4000 X:E8ED Y:1C00 S:01F8 DB:00 D:0000 P:81 e CC2424 JSR $2470 [CC2470] A:4000 X:E8ED Y:0800 S:01F8 DB:00 D:0000 P:01 e CC2470 STA $2116 [002116] A:4000 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:01 e CC2473 SEP #$20 A:4000 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:01 e ;* enable $4800 * CC2475 LDA #$01 A:4000 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:21 e CC2477 STA $4800 [004800] A:4001 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:21 e CC247A LDA #$09 A:4001 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:21 e CC247C STA $4300 [004300] A:4009 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:21 e CC247F LDA #$18 A:4009 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:21 e CC2481 STA $4301 [004301] A:4018 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:21 e CC2484 STX $4302 [004302] A:4018 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:21 e CC2487 LDA $03,S [0001F9] A:4018 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:21 e CC2489 STA $4304 [004304] A:40DB X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:A1 e CC248C STY $4305 [004305] A:40DB X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:A1 e CC248F LDA #$01 A:40DB X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:A1 e CC2491 STA $4801 [004801] A:4001 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:21 e CC2494 PHA A:4001 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:21 e CC2495 PLA A:4001 X:E8ED Y:0800 S:01F5 DB:00 D:0000 P:21 e CC2496 STA $420B [00420B] A:4001 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:21 e CC2499 STZ $4800 [004800] A:4001 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:21 e CC249C REP #$20 A:4001 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:21 e CC249E RTS A:4001 X:E8ED Y:0800 S:01F6 DB:00 D:0000 P:01 e Custom transfer (should transfer decompressed->decompressed): CC2428 LDA #$5008 A:00DB X:E8ED Y:0800 S:01FA DB:00 D:0000 P:01 e CC242B PEA $00E9 [0000E9] A:5008 X:E8ED Y:0800 S:01FA DB:00 D:0000 P:01 e CC242E LDX #$0400 A:5008 X:E8ED Y:0800 S:01F8 DB:00 D:0000 P:01 e CC2431 LDY #$04E0 A:5008 X:0400 Y:0800 S:01F8 DB:00 D:0000 P:01 e CC2434 JSR $244C [CC244C] A:5008 X:0400 Y:04E0 S:01F8 DB:00 D:0000 P:01 e CC244C STA $2116 [002116] A:5008 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:01 e CC244F SEP #$20 A:5008 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:01 e ;* disable $4800 * CC2451 STZ $4800 [004800] A:5008 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:21 e ;* $43x0.d3 (fixed transfer flag) is irrelevent to S-DD1 * ;* can be #$01 or #$09 here * CC2454 LDA #$09 A:5008 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:21 e CC2456 BRA $247C [CC247C] A:5009 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:21 e CC247C STA $4300 [004300] A:5009 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:21 e CC247F LDA #$18 A:5009 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:21 e CC2481 STA $4301 [004301] A:5018 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:21 e CC2484 STX $4302 [004302] A:5018 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:21 e CC2487 LDA $03,S [0001F9] A:5018 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:21 e CC2489 STA $4304 [004304] A:50E9 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:A1 e CC248C STY $4305 [004305] A:50E9 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:A1 e CC248F LDA #$01 A:50E9 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:A1 e CC2491 STA $4801 [004801] A:5001 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:21 e CC2494 PHA A:5001 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:21 e CC2495 PLA A:5001 X:0400 Y:04E0 S:01F5 DB:00 D:0000 P:21 e CC2496 STA $420B [00420B] A:5001 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:21 e CC2499 STZ $4800 [004800] A:5001 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:21 e CC249C REP #$20 A:5001 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:21 e CC249E RTS A:5001 X:0400 Y:04E0 S:01F6 DB:00 D:0000 P:01 e Original transfer right after custom transfer: CC2438 LDA #$4000 A:00E9 X:0400 Y:04E0 S:01FA DB:00 D:0000 P:01 e CC243B PEA $00DC [0000DC] A:4000 X:0400 Y:04E0 S:01FA DB:00 D:0000 P:01 e CC243E LDX #$E0E8 A:4000 X:0400 Y:04E0 S:01F8 DB:00 D:0000 P:01 e CC2441 LDY #$1080 A:4000 X:E0E8 Y:04E0 S:01F8 DB:00 D:0000 P:81 e CC2444 JSR $2458 [CC2458] A:4000 X:E0E8 Y:1080 S:01F8 DB:00 D:0000 P:01 e CC2458 STA $2181 [002181] A:4000 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:01 e CC245B SEP #$20 A:4000 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:01 e CC245D LDA #$7F A:4000 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:21 e CC245F STA $2183 [002183] A:407F X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:21 e CC2462 LDA #$01 A:407F X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:21 e ;* $4800 enabled again * CC2464 STA $4800 [004800] A:4001 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:21 e CC2467 LDA #$08 A:4001 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:21 e CC2469 STA $4300 [004300] A:4008 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:21 e CC246C LDA #$80 A:4008 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:21 e CC246E BRA $2481 [CC2481] A:4080 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:A1 e CC2481 STA $4301 [004301] A:4080 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:A1 e CC2484 STX $4302 [004302] A:4080 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:A1 e CC2487 LDA $03,S [0001F9] A:4080 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:A1 e CC2489 STA $4304 [004304] A:40DC X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:A1 e CC248C STY $4305 [004305] A:40DC X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:A1 e CC248F LDA #$01 A:40DC X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:A1 e CC2491 STA $4801 [004801] A:4001 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:21 e CC2494 PHA A:4001 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:21 e CC2495 PLA A:4001 X:E0E8 Y:1080 S:01F5 DB:00 D:0000 P:21 e CC2496 STA $420B [00420B] A:4001 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:21 e CC2499 STZ $4800 [004800] A:4001 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:21 e CC249C REP #$20 A:4001 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:21 e CC249E RTS A:4001 X:E0E8 Y:1080 S:01F6 DB:00 D:0000 P:01 e I was completely wrong, and was thrown off by ZSNES' memory remapping magic that worked due to an oversight with $43x0.d3, or the fixed transfer flag. I never added a check for the fixed transfer flag because it quite honestly made no sense. Why would the S-DD1 care about that? Turns out, it doesn't. What really matters is $4800. The register everyone currently ignores completely. I figured out what purpose it serves: it's a sticky toggle, whereas $4801 is a loose toggle. It works like this: in order for the S-DD1 to decompress a DMA transfer, both $4800 and $4801 have to be set. Upon completion of the transfer, $4801 is cleared. But $4800 is not. If you look at the above logs, it becomes clear. And it's all contained inside the S-DD1 code. It has nothing to do with $43x0. Now, how can I verify this? orwannon made a flash cart for Star Ocean and ran my old title screen patch on it. Sure enough, it did not try and decompress the graphics data, despite the fixed transfer flag being set. That tells us that the fixed transfer flag has nothing to do with this. What's interesting is that every single S-DD1 supporting emulator works just fine with my title screen patch. Meaning that they've all implemented these two registers wrong. What was also interesting is that it's supposedly been confirmed that the patched SO works on real hardware. That means the bug was in bsnes after all. No excuses, I was flat out wrong. My sincere apologies. I've added the above changes, and bsnes now works with the original patch, and fails with my custom patch. This mimics the behavior of real hardware. Huge thanks to orwannon for the screenshot of my patch running on real hardware. This fix wouldn't have been possible without that. [No archive available]
This commit is contained in:
parent
aee683a475
commit
ec137d6fb9