aboutsummaryrefslogtreecommitdiff
path: root/scroll/include/ppu.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2023-11-27 10:31:03 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-02-04 21:02:54 +0100
commitcee93625989b651cfe91387eabd0abd3f64a00df (patch)
treed1525bd15c191c2926ea1166263b249a8bbeb79c /scroll/include/ppu.s
parent0e1839f48ada69b81f5879449d0e0fe435f851c5 (diff)
downloadcode.nes-cee93625989b651cfe91387eabd0abd3f64a00df.tar.gz
code.nes-cee93625989b651cfe91387eabd0abd3f64a00df.zip
scroll: Start with the scrolling examples
This is still work in progress but at least there's some basic structure to it. Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'scroll/include/ppu.s')
-rw-r--r--scroll/include/ppu.s27
1 files changed, 27 insertions, 0 deletions
diff --git a/scroll/include/ppu.s b/scroll/include/ppu.s
new file mode 100644
index 0000000..23fd978
--- /dev/null
+++ b/scroll/include/ppu.s
@@ -0,0 +1,27 @@
+.segment "CODE"
+
+.scope PPU
+ CONTROL = $2000
+ MASK = $2001
+ STATUS = $2002
+ SCROLL = $2005
+ ADDRESS = $2006
+ DATA = $2007
+.endscope
+
+.macro PPU_ADDR address
+ lda #.HIBYTE(address)
+ sta PPU::ADDRESS
+ lda #.LOBYTE(address)
+ sta PPU::ADDRESS
+.endmacro
+
+;; WRITE_PPU_DATA is a macro that will write into PPU::ADDRESS the given address
+;; and into PPU::DATA the given byte value.
+.macro WRITE_PPU_DATA address, value
+ bit PPU::STATUS
+
+ PPU_ADDR address
+ lda #value
+ sta PPU::DATA
+.endmacro