diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-01-23 16:14:12 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-02-04 22:00:07 +0100 |
| commit | fdf44365e56c3741f47cbd421a57f0d074a5492c (patch) | |
| tree | 92b55944dd84171f6c42857402b1f90f835abfa2 /shared | |
| parent | 6c207c192b7ce1a292249afd7b0a3499be70d03c (diff) | |
| download | code.nes-fdf44365e56c3741f47cbd421a57f0d074a5492c.tar.gz code.nes-fdf44365e56c3741f47cbd421a57f0d074a5492c.zip | |
fx: Provide an example of PPU bank switching
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'shared')
| -rw-r--r-- | shared/mmc3.s | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/shared/mmc3.s b/shared/mmc3.s new file mode 100644 index 0000000..b3f484a --- /dev/null +++ b/shared/mmc3.s @@ -0,0 +1,23 @@ +;;; Useful macros and constants for development on the MMC3 chip. + +.scope MMC3 + BANK_SELECT = $8000 + BANK_DATA = $8001 + MIRRORING = $A000 + RAM_PROTECT = $A001 + IRQ_LATCH = $C000 + IRQ_RELOAD = $C001 + IRQ_DISABLE = $E000 + IRQ_ENABLE = $E001 +.endscope + +.macro BANK_REGISTER_SET REGISTER_ID, REGISTER_VALUE + .if REGISTER_ID < 0 || REGISTER_ID > 7 + .error "bad value for REGISTER_ID when bank switching" + .endif + + lda #REGISTER_ID + sta MMC3::BANK_SELECT + lda #REGISTER_VALUE + sta MMC3::BANK_DATA +.endmacro |
