aboutsummaryrefslogtreecommitdiff
path: root/scroll/include/palettes.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/palettes.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/palettes.s')
-rw-r--r--scroll/include/palettes.s30
1 files changed, 30 insertions, 0 deletions
diff --git a/scroll/include/palettes.s b/scroll/include/palettes.s
new file mode 100644
index 0000000..9403b7b
--- /dev/null
+++ b/scroll/include/palettes.s
@@ -0,0 +1,30 @@
+;; Shared code for palettes across scrolling examples.
+.scope Palettes
+ DEFAULT_COLOR = $11
+
+ ;; Copies all the palettes for our game into the proper PPU address.
+ .proc init
+ PPU_ADDR $3F00
+
+ ldx #0
+ @load_palettes_loop:
+ lda palettes, x
+ sta PPU::DATA
+ inx
+ cpx #$20
+ bne @load_palettes_loop
+ rts
+ palettes:
+ ;; Background
+ .byte DEFAULT_COLOR, $36, $17, $0F
+ .byte DEFAULT_COLOR, $00, $00, $00
+ .byte DEFAULT_COLOR, $00, $00, $00
+ .byte DEFAULT_COLOR, $00, $00, $00
+
+ ;; Foreground
+ .byte DEFAULT_COLOR, $28, $0F, $30
+ .byte DEFAULT_COLOR, $00, $00, $00
+ .byte DEFAULT_COLOR, $00, $00, $00
+ .byte DEFAULT_COLOR, $00, $00, $00
+ .endproc
+.endscope