Skip to content

Commit

Permalink
Upload a background palette
Browse files Browse the repository at this point in the history
  • Loading branch information
NovaSquirrel committed Apr 15, 2019
1 parent 4490b6c commit b08ff7a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -20,4 +20,6 @@ __pycache__/



graphics.s
graphics.s
*.lnk
nova-the-squirrel-2.sfc
Binary file modified nova-the-squirrel-2.sfc
Binary file not shown.
29 changes: 29 additions & 0 deletions src/main.s
Expand Up @@ -75,6 +75,7 @@ OAMHI: .res 512
lda #GraphicsUpload::FGTropicalWood
jsl DoGraphicUpload


; jsl load_bg_tiles ; fill pattern table
; jsl draw_bg ; fill nametable
; jsl load_player_tiles
Expand All @@ -85,6 +86,15 @@ OAMHI: .res 512
phk
plb

; Upload palette
seta8
stz CGADDR
setaxy16
lda #DMAMODE_CGDATA
ldx #palette & $FFFF
ldy #palette_size
jsl ppu_copy

; Program the PPU for the display mode
seta8
stz BGMODE ; mode 0 (four 2-bit BGs) with 8x8 tiles
Expand Down Expand Up @@ -186,3 +196,22 @@ padwait:




palette:
.word RGB(15,23,31)
.word RGB8(34, 32, 52)
.word RGB8(89, 86, 82)
.word RGB8(132, 126, 135)
.word RGB8(155, 173, 183)
.word RGB8(203, 219, 252)
.word RGB8(255, 255, 255)
.word RGB8(102, 57, 49)
.word RGB8(143, 86, 59)
.word RGB8(217, 160, 102)
.word RGB8(238, 195, 154)
.word RGB8(91, 110, 225)
.word RGB8(99, 155, 255)
.word RGB8(172, 50, 50)
.word RGB8(217, 87, 99)
.word RGB8(255, 0, 255)
palette_size = * - palette
1 change: 1 addition & 0 deletions src/snes.inc
Expand Up @@ -180,6 +180,7 @@ CGADDR = $2121
CGDATA = $2122 ; 5-bit BGR, write twice, low byte first
CGDATARD = $213B ; 5-bit BGR, read twice, low byte first
.define RGB(r,g,b) ((r)|((g)<<5)|((b)<<10))
.define RGB8(r,g,b) ((r/8)|((g/8)<<5)|((b/8)<<10))

; S-PPU window ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Expand Down

0 comments on commit b08ff7a

Please sign in to comment.