diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-02 17:02:52 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-02 17:02:52 -0400 |
commit | 5788d8049c9d83d05c4ad29b3f585a1aae3847ed (patch) | |
tree | ff1b73fa52ef876530a9856ca3a09889df8ac7ca | |
parent | 384fae997e5459963b8f3c4fec773b6e2699d009 (diff) | |
download | nes-input-test-5788d8049c9d83d05c4ad29b3f585a1aae3847ed.tar.gz nes-input-test-5788d8049c9d83d05c4ad29b3f585a1aae3847ed.zip |
refactor
-rw-r--r-- | test.s | 97 |
1 files changed, 51 insertions, 46 deletions
@@ -71,6 +71,26 @@ LoadPalettesLoop: STA sprite_x.w STA sprite_y.w + LDA #$32 + STA $0201 ; set the sprite number to display + LDA #$00 + STA $0202 ; set the sprite attributes (palette, flipping, etc) + + LDA #$33 + STA $0205 ; set the sprite number to display + LDA #$00 + STA $0206 ; set the sprite attributes (palette, flipping, etc) + + LDA #$34 + STA $0209 ; set the sprite number to display + LDA #$00 + STA $020A ; set the sprite attributes (palette, flipping, etc) + + LDA #$35 + STA $020D ; set the sprite number to display + LDA #$00 + STA $020E ; set the sprite attributes (palette, flipping, etc) + LDA #%00010000 ; enable sprites STA $2001 @@ -128,52 +148,6 @@ turn_red: NMI: JSR read_controller1 - LDA sprite_y.w - STA $0200 ; y position - LDA #$32 - STA $0201 ; set the sprite number to display - LDA #$00 - STA $0202 ; set the sprite attributes (palette, flipping, etc) - LDA sprite_x.w - STA $0203 ; x position - - LDA sprite_y.w - STA $0204 ; y position - LDA #$33 - STA $0205 ; set the sprite number to display - LDA #$00 - STA $0206 ; set the sprite attributes (palette, flipping, etc) - LDA sprite_x.w - ADC #$07 ; XXX why is this #$07 instead of #$08? - STA $0207 ; x position - - LDA sprite_y.w - ADC #$08 - STA $0208 ; y position - LDA #$34 - STA $0209 ; set the sprite number to display - LDA #$00 - STA $020A ; set the sprite attributes (palette, flipping, etc) - LDA sprite_x.w - STA $020B ; x position - - LDA sprite_y.w - ADC #$08 - STA $020C ; y position - LDA #$35 - STA $020D ; set the sprite number to display - LDA #$00 - STA $020E ; set the sprite attributes (palette, flipping, etc) - LDA sprite_x.w - ADC #$08 - STA $020F ; x position - - ; load the sprite into the ppu ports (from $0200) - LDA #$00 - STA $2003 - LDA #$02 - STA $4014 - handle_up: LDA buttons_pressed.w AND #%00001000 @@ -233,6 +207,37 @@ call_turn_red: JMP nmi_return nmi_return: + ; update the sprite locations + LDA sprite_y.w + STA $0200 + LDA sprite_x.w + STA $0203 + + LDA sprite_y.w + STA $0204 + LDA sprite_x.w + ADC #$07 ; XXX why is this #$07 instead of #$08? + STA $0207 + + LDA sprite_y.w + ADC #$08 + STA $0208 + LDA sprite_x.w + STA $020B + + LDA sprite_y.w + ADC #$08 + STA $020C + LDA sprite_x.w + ADC #$08 + STA $020F + + ; load the sprite into the ppu ports (from $0200) + LDA #$00 + STA $2003 + LDA #$02 + STA $4014 + RTI |