Z80 port map: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
(add audio system category, since it was missing and I tried to search for it)
mNo edit summary
Line 48: Line 48:
SNK used an obscure feature of the Z80: when accessing ports, the entire address bus is set, not only the lower 8 bits.
SNK used an obscure feature of the Z80: when accessing ports, the entire address bus is set, not only the lower 8 bits.


The banks can then be chosen by putting the bank number in B, the port number in C and doing IN A,(C).
The banks can then be chosen by putting the bank number in A, the port number in C and doing IN A,(C).
This is handled by {{Chipname|NEO-ZMC}} in cartridges.
This is handled by {{Chipname|NEO-ZMC}} in cartridges.



Revision as of 00:21, 14 May 2018

Some infos from User:kyuusaku

The decode mask for reading ports is always $0C. The one for writes is indicated for each case.

Address Read Write Decode mask
$00
  • Read sound code from 68k
  • Acknowledge NMI
Clear sound code from 68k to $00 $0C
$04 YM2610 I/O
$08 Set $F000~$F7FF bank Enable NMIs $1C
$09 Set $E000~$EFFF bank
$0A Set $C000~$DFFF bank
$0B Set $8000~$BFFF bank
$0C See SDRD1 Reply to 68k $0C
$18 See address $08 Disable NMIs $1C

Note that the Z80 ROM bank selection is done by reading ports.

SNK used an obscure feature of the Z80: when accessing ports, the entire address bus is set, not only the lower 8 bits.

The banks can then be chosen by putting the bank number in A, the port number in C and doing IN A,(C). This is handled by NEO-ZMC in cartridges.


Some sound drivers use port $C0 (and others ?) in their code. Since only SDA2 and SDA3 are used for port decoding, port $C0 maps to a mirror of port $00. It's believed to be a remnant of some development tool.