aboutsummaryrefslogtreecommitdiff
path: root/scroll/include/palettes.s
diff options
context:
space:
mode:
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