From 25a2fb20abbc221f3807240fdd2b39a553bd570e Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Sat, 30 May 2015 12:02:25 -0400 Subject: [PATCH] Change bit-format of scratch sprite table. Now each sprite's bits count as: "1 = large" and "1 = enabled", which is more intuitive. --- pewpew.asm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pewpew.asm b/pewpew.asm index 76aa61b..aa70a8a 100644 --- a/pewpew.asm +++ b/pewpew.asm @@ -510,8 +510,7 @@ UpdateWorld: ; Set priority bits so that the sprite is drawn in front. lda #%00110000 sta $0103 - ; Clear x-MSB so that the sprite is displayed. - lda #%01000000 + lda #%11000000 ; Enable large sprite. sta spriteTableScratchStart ; Move shot coords and copy into sprite table. @@ -548,7 +547,7 @@ UpdateShot: sta $0112, X ; Update secondary sprite table. - lda #%01000000 + lda #%11000000 sta spriteTableScratchStart + 4, Y jmp ShotDone @@ -593,6 +592,10 @@ FillSecondarySpriteTable: ; This function is meant to be called after UpdateWorld, and packs those ; bytes into the actual bitfield that the OAM wants for the secondary ; sprite table. + ; + ; The expected format of every byte in the scratch sprite table is: + ; sx------ s = size (0 = small, 1 = large) + ; x = flipped high x-coordinate (so 1 behaves like "enable"). ldx #0 ; Index into input table. ldy #0 ; Index into output table. - @@ -608,10 +611,8 @@ FillSecondarySpriteTable: sta $00 inx .endr - ; TODO(mcmillen): change the semantics of the scratch table so that - ; "1" = "big"? lda $00 - eor #$FF + eor #%01010101 sta spriteTable2Start, Y iny cpx #numSprites