I've noticed that all multi-carts place their game switching registers at CPU memory region (usually at $8000~$FFFF, sometimes $6000~7FFF, rarely $4000~$5FFF).
But if the games already have registers at these regions, the addresses of the game switching registers have to be intentionally manipulated to avoid conflicts, involving address multiplexers or some more complex logics.
However if the cart has no CHR RAM, I wonder if it is possible to place the registers at PPU memory region (i.e. $0000~$1FFF)?
Without CHR RAM, CPU won't write to $0000~$1FFF. So there will be no conflicts. No complex logics needed, just a single 74'161 or 74'273 or similar is enough for the register.
Here is my assumption:
Assume I'm making a 16-in-1 multi-cart, every game has the same size.
Code for switching games:
But if the games already have registers at these regions, the addresses of the game switching registers have to be intentionally manipulated to avoid conflicts, involving address multiplexers or some more complex logics.
However if the cart has no CHR RAM, I wonder if it is possible to place the registers at PPU memory region (i.e. $0000~$1FFF)?
Without CHR RAM, CPU won't write to $0000~$1FFF. So there will be no conflicts. No complex logics needed, just a single 74'161 or 74'273 or similar is enough for the register.
Here is my assumption:
Code:
GND
| |
R C
Diode | | -------\/-------
M2 ---|>|--+-+--|/CLEAR VCC|- VCC
PPU A13 --------|CLK CO|-
PPU D0 ---------|D0 Q0|-------- PRG & CHR A16
PPU D1 ---------|D1 Q1|-------- PRG & CHR A17
PPU D2 ---------|D2 74'161 Q2|-------- PRG & CHR A18
PPU D3 ---------|D3 Q3|-------- PRG & CHR A19
GND ---|CNT CI|--- GND
GND ---|GND /LOAD|--- PPU /WR
----------------
| |
R C
Diode | | -------\/-------
M2 ---|>|--+-+--|/CLEAR VCC|- VCC
PPU A13 --------|CLK CO|-
PPU D0 ---------|D0 Q0|-------- PRG & CHR A16
PPU D1 ---------|D1 Q1|-------- PRG & CHR A17
PPU D2 ---------|D2 74'161 Q2|-------- PRG & CHR A18
PPU D3 ---------|D3 Q3|-------- PRG & CHR A19
GND ---|CNT CI|--- GND
GND ---|GND /LOAD|--- PPU /WR
----------------
Assume I'm making a 16-in-1 multi-cart, every game has the same size.
Code for switching games:
Code:
.proc _switchGame: near
; A is the selected game index
ldx #$00
stx PPU_MASK ; disable rendering so that writing to PPU is safe
ldx #$00
stx PPU_ADDR ; select PPU address $0000
ldx #$00
stx PPU_ADDR
sta PPU_DATA ; write game index to PPU address $0000
ldy #$00
@dummyWait:
nop
nop
nop
nop
nop
nop
nop
nop
iny
bne @dummyWait
jmp ($FFFC) ; reset!
rts
.endproc
; A is the selected game index
ldx #$00
stx PPU_MASK ; disable rendering so that writing to PPU is safe
ldx #$00
stx PPU_ADDR ; select PPU address $0000
ldx #$00
stx PPU_ADDR
sta PPU_DATA ; write game index to PPU address $0000
ldy #$00
@dummyWait:
nop
nop
nop
nop
nop
nop
nop
nop
iny
bne @dummyWait
jmp ($FFFC) ; reset!
rts
.endproc