Bankswitching

From NeoGeo Development Wiki
Jump to navigation Jump to search

Games which need more than 2MiB of P ROM data use simple bankswitching in the PORT memory range ($200000~$2FFFFF), which is achieved in hardware by latches on the cartridge's PROG board. No games use bankswitching of the ROM range ($000000~$1FFFFF) ?

To switch the ROM bank, a byte needs to be written in this range. Depending on how large the ROM is, one or more bits can be used.

For example, the PROGBK1 board uses a 74LS74 dual D-latch to allow a 4MiB P2 ROM to be mapped in 4, 1MiB banks (2 bits, see schematic).

In this case, when a byte write is done in the $200000~$2FFFFF range, /PORTWEL falls, latching D0 and D1 which are connected to the P2 ROM's A20 and A21 lines respectively. When the NeoGeo is reset, both latches are reset to 0, to ensure that the first bank is mapped on startup.

As there is no /PORTOE signal on the cartridge edge (like /ROMOE), both /PORTOEL and /PORTOEU need to be ANDed together to make the /OE signal of P2 (if it's a 16bit ROM).

Example code

move.b #3,#$200000    ; Set bank 3, ROM's $300000~$3FFFFF appears in $200000~$2FFFFF
move.b #1,#$2B92F1    ; Set bank 1, ROM's $100000~$1FFFFF appears in $200000~$2FFFFF