It is currently Fri Oct 18, 2019 2:38 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue Jun 04, 2019 8:05 pm 
Offline
User avatar

Joined: Thu Aug 13, 2015 4:40 pm
Posts: 419
Location: Rio de Janeiro - Brazil
My Ghostbusters romhack uses mapper 66. It always worked fine on all emulators and also on my krikzz everdrive n8. At some point there was a modification to the rom that broke compatibility with the everdrive and virtuanes: the game won't boot up (gray screen). Only now I've noticed it.

The rom was expanded from 2 PRG banks to 4. So, rom addresses 0x0000-0x7FFF in the original to 0x0000-0xFFFF in the new one for PRG. This was working on all emulators and the everdrive. But a modification on the end of the final bank seems to be causing trouble with the everdrive and with virtuanes, even though fceux tells me that code isn't run at startup at all. So, either the everdrive and virtuanes isn't implementing the mapper correctly, or all other emulators aren't. Any idea?

Works:
Code:
 03:FFF2:A9 0F     LDA #$0F
 03:FFF4:8D F3 FF  STA $FFF3 = #$0F
 03:FFF7:00        BRK
 03:FFF8:00        BRK
 03:FFF9:00        BRK
 03:FFFA:F2        UNDEFINED
 03:FFFB:FF        UNDEFINED
 03:FFFC:F2        UNDEFINED
 03:FFFD:FF        UNDEFINED
 03:FFFE:F2        UNDEFINED
 03:FFFF:FF        UNDEFINED


Won't work (though fceux insists this isn't even run/read at boot up):
Code:
 03:FFF3:A9 0F     LDA #$0F  // notice that the address is different now by 1 byte
 03:FFF5:8D F3 FF  STA $FFF3 = #$A9
 03:FFF8:00        BRK
 03:FFF9:00        BRK
 03:FFFA:F2        UNDEFINED
 03:FFFB:FF        UNDEFINED
 03:FFFC:F2        UNDEFINED
 03:FFFD:FF        UNDEFINED
 03:FFFE:F2        UNDEFINED
 03:FFFF:FF        UNDEFINED


Just wanted to share. I'll try modifying the code so it stays in the same address. I'm guessing it must be more likely that the mapper 66 implementation on everdrive isn't perfect and it's starting on the wrong bank or something, and out of chance it was working before.

_________________
https://twitter.com/bitinkstudios <- Follow me on twitter! Thanks!


Top
 Profile  
 
PostPosted: Tue Jun 04, 2019 8:28 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 4222
I'd double check Unknown Initial Bank State, and Bus Conflicts.

Unknown Initial State: Make sure all banks will lead to valid bootup code at their reset vector. For the secondary banks, you'd want to switch to the first bank and run the normal boot code (try copying a small write and jump into RAM).
Bus conflicts: When writing to the ROM area of a cartridge (mapper registers), make sure the value in ROM at that address matches.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Last edited by Dwedit on Tue Jun 04, 2019 8:31 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Tue Jun 04, 2019 8:29 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4210
Location: A world gone mad
I suspect this is the hard-wired/fixed bank in the ROM (I cannot be bothered to look up mapper 66 to verify). Assuming it is, the answer becomes semi-obvious:

Original and modified:

$FFFA = NMI vector, points to $FFF2
$FFFC = RESET vector, points to $FFF2
$FFFE = IRQ/BRK vector, points to $FFF2

For whatever reason, you've chosen to omit the code at $FFF2 in the modified version ("won't work"). I suspect that byte is not $EA (nop), and even more so strongly suspect that it's a byte of an instruction (either valid or invalid opcode) that has operand bytes associated with it. Let's pretend the byte at $FFF2 happens to be $AD (lda absolute). The code executed then becomes this:

Code:
FFF2: AD A9 0F    lda $0fa9
FFF5: 8D F2 FF    sta $fff3
FFF8: ...

In other words: your vectors (especially RESET) are now wrong -- off by one byte -- and thus the code executed does not match what you think will happen.


Top
 Profile  
 
PostPosted: Tue Jun 04, 2019 9:13 pm 
Offline
User avatar

Joined: Thu Aug 13, 2015 4:40 pm
Posts: 419
Location: Rio de Janeiro - Brazil
Thanks guys, I think I got it working. It seems indeed that virtuanes and the everdrive are starting with banks 2-3 active. And yeah, my vectors on bank 3 were blatantly wrong! I also fixed the bank 3 reset vector so it won't result in bus conflicts. Thank you!

_________________
https://twitter.com/bitinkstudios <- Follow me on twitter! Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group