From b08ff7a0dae8cbb858310fe29ab5d1384ddb8f11 Mon Sep 17 00:00:00 2001 From: NovaSquirrel Date: Mon, 15 Apr 2019 00:10:56 -0400 Subject: [PATCH] Upload a background palette --- .gitignore | 4 +++- nova-the-squirrel-2.sfc | Bin 1048576 -> 1048576 bytes src/main.s | 29 +++++++++++++++++++++++++++++ src/snes.inc | 1 + 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 48bce36..b2902ba 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,6 @@ __pycache__/ -graphics.s \ No newline at end of file +graphics.s +*.lnk +nova-the-squirrel-2.sfc \ No newline at end of file diff --git a/nova-the-squirrel-2.sfc b/nova-the-squirrel-2.sfc index b7ffc3d910d25153f041865fc144fa7e1a107463..319cfdac895d9857a9ef5ea20616a0a685c36b32 100644 GIT binary patch delta 276 zcmZo@aA;_7m~cdOZ&Slc1|?}A$p|97S3gpiqo{buU?r2%BCo~;3Jgl08XG2FwdP&Y z*r2orhQsiB9}`H{l@JCntj zQq*#rG8DSNI9nmQX#oS1LT=OU{R|EBfuaX?YF_xffPq-1q{pz37c;)y{MVQY%%#jy$nl*efxpt x2led_>KTEU35c12m<5PgftU@5*@2h?h&h3n3y8UamzX diff --git a/src/main.s b/src/main.s index 3480223..3486dca 100644 --- a/src/main.s +++ b/src/main.s @@ -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 @@ -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 @@ -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 diff --git a/src/snes.inc b/src/snes.inc index 06d2ad4..6a3def8 100644 --- a/src/snes.inc +++ b/src/snes.inc @@ -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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;