Page 1 of 1
Z80 access and IO
Posted: Tue Mar 06, 2012 3:51 pm
1) Is the bit #0 at 0xA11100 is the same as the bit #8 (I know that is the case for the IO, not sure about the Z80 control port) ?
2) Is there a need to request the Z80 bus before accessing the joypad ?
I ask that cause that's what the MegaCD bios does.
Posted: Tue Mar 06, 2012 7:05 pm
1) Remember that these registers are words... the bit is bit 8 at the WORD at 0xA11100. Now remember that the bit commands on the 68000 operate on BYTES in memory, so you would need to mess with the MSB of the word register... which is 0xA11100 since the 68000 is big-endian (the MSB comes first at offset 0 from the address, and the LSB comes last at offset 1). So bit 0 of the BYTE at 0xA11100 is the same as bit 8 of the WORD at 0xA11100.
2) There is a bug in the IO controller such that if things occur just right (or wrong, depending on how you look at it), accessing the IO while the Z80 tries to access the ROM will cut the Z80 cycle short. Even worse, ALL Z80 ROM accesses from then on will be cut short. There are two official ways of handling it - the first is what SEGA recommends and does in all their sample code: request the Z80 bus before reading the IO. The second is to never do ROM reads from the Z80. The "fix" that EVERYONE actually uses is to make the rom fast enough that short cycles don't matter and then ignore the bug.
Posted: Tue Mar 06, 2012 7:28 pm
Thanks a lot