diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-02 14:09:57 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-02 14:09:57 -0400 |
commit | b37293abdf2f7a8c55e193d0a4cbff8a273f4dfe (patch) | |
tree | 75095c5f8cd12d6689737f54e3959439949b5b0c | |
parent | fa434fb867e6581e2fe024322c51b614d6351a48 (diff) | |
download | nes-input-test-b37293abdf2f7a8c55e193d0a4cbff8a273f4dfe.tar.gz nes-input-test-b37293abdf2f7a8c55e193d0a4cbff8a273f4dfe.zip |
start drawing sprites
-rw-r--r-- | mario.chr | bin | 0 -> 8192 bytes | |||
-rw-r--r-- | test.s | 54 |
2 files changed, 46 insertions, 8 deletions
diff --git a/mario.chr b/mario.chr Binary files differnew file mode 100644 index 0000000..d150ccc --- /dev/null +++ b/mario.chr @@ -4,12 +4,13 @@ DEFAULTSLOT 0 SLOT 0 $8000 SLOT 1 $E000 SLOT 2 $6000 +SLOT 3 $0000 .ENDME .ROMBANKMAP -BANKSTOTAL 2 +BANKSTOTAL 3 BANKSIZE $2000 -BANKS 2 +BANKS 3 .ENDRO @@ -35,13 +36,13 @@ clrmem: LDA #$00 STA $0000, x STA $0100, x - STA $0200, x + STA $0300, x STA $0400, x STA $0500, x STA $0600, x STA $0700, x LDA #$FE - STA $0300, x + STA $0200, x ;move all sprites off screen INX BNE clrmem @@ -49,7 +50,21 @@ vblankwait2: ; Second wait for vblank, PPU is ready after this BIT $2002 BPL vblankwait2 - LDA #%10000000 ;intensify blues +LoadPalettes: + LDA $2002 ; read PPU status to reset the high/low latch + LDA #$3F + STA $2006 ; write the high byte of $3F00 address + LDA #$00 + STA $2006 ; write the low byte of $3F00 address + LDX #$00 +LoadPalettesLoop: + LDA palette.w, x ;load palette byte + STA $2007 ;write to PPU + INX ;set index to next byte + CPX #$20 + BNE LoadPalettesLoop ;if x = $20, 32 bytes copied, all done + + LDA #%10010000 ;intensify blues and enable sprites STA $2001 LDA #%10000000 ; enable NMI interrupts @@ -83,21 +98,21 @@ end_read_controller1: RTS turn_blue: - LDA #%10000000 + LDA #%10010000 STA $2001 LDA #$00 STA current_state.w RTS turn_green: - LDA #%01000000 + LDA #%01010000 STA $2001 LDA #$01 STA current_state.w RTS turn_red: - LDA #%00100000 + LDA #%00110000 STA $2001 LDA #$02 STA current_state.w @@ -106,6 +121,19 @@ turn_red: NMI: JSR read_controller1 + LDA #$00 + STA $2003 + LDA #$02 + STA $4014 + + LDA #$80 + STA $0200 + STA $0203 + LDA #$00 + STA $0201 + LDA #$00 + STA $0202 + ; if A is not pressed, return LDA buttons_pressed.w AND #%10000000 @@ -133,6 +161,11 @@ color_set: .bank 1 slot 1 + .orga $E000 +palette: + .db $0F,$31,$32,$33,$0F,$35,$36,$37,$0F,$39,$3A,$3B,$0F,$3D,$3E,$0F + .db $0F,$1C,$15,$14,$0F,$02,$38,$3C,$0F,$1C,$15,$14,$0F,$02,$38,$3C + .orga $FFFA ;first of the three vectors starts here .dw NMI ;when an NMI happens (once per frame if enabled) the ;processor will jump to the label NMI: @@ -145,3 +178,8 @@ color_set: .org $0000 buttons_pressed: .ds 1, $00 current_state: .ds 1, $00 + + + .bank 2 slot 3 + .org $0000 + .incbin "mario.chr" |