Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .inesprg 1 ; 1 bank of PRG data
- .ineschr 1 ; 1 bank of CHR data
- .inesmap 0 ; mapper 0
- .inesmir 1 ; VRAM mirroring bank, Idk what that means, so it's set to 1
- .rsset $0000
- .include "constants.asm"
- .include "important.asm"
- .include "macros.asm"
- ; Bank 0 starts at $8000, where our main code will go
- .bank 0
- .org $8000
- RESET:
- lda #%10000000
- sta PPU_CTRL
- lda #%00011000
- sta PPU_MASK
- lda #1
- sta ballDown
- sta ballRight
- lda #0
- sta ballUp
- sta ballLeft
- LoadPalette:
- lda PPU_STATUS
- lda #$3F
- sta PPU_ADDR
- lda #$00
- sta PPU_ADDR
- ldx #$00
- LoopPalette:
- lda MainPalette, x
- sta PPU_DATA
- inx
- cpx #$20
- bne LoopPalette
- LoadSprites:
- ldx #$00
- LoopSprites:
- lda Sprites, x
- sta $0200, x
- inx
- cpx #44
- bne LoopSprites
- readjoy:
- lda #$01
- sta JOYPAD1
- sta buttons1
- lsr a
- sta JOYPAD1
- loop:
- lda JOYPAD1
- lsr a
- rol buttons1
- bcc loop
- rts
- Forever:
- jmp Forever
- NMI:
- lda #$00
- sta OAM_ADDR
- lda #$02
- sta OAM_DMA
- jsr readjoy
- jsr UpPressed1
- jsr DownPressed1
- jsr UpPressed2
- jsr DownPressed2
- jsr MoveBall
- rti
- UpPressed1:
- Test_Button buttons1, BUTTON_UP
- beq UpDone1
- ldx $0214
- cpx #$08
- beq UpDone1
- dec $0204
- dec $0208
- dec $020C
- dec $0210
- dec $0214
- UpDone1:
- rts
- DownPressed1:
- Test_Button buttons1, BUTTON_DOWN
- beq DownDone1
- ldx $0214
- cpx #$E0
- beq DownDone1
- inc $0204
- inc $0208
- inc $020C
- inc $0210
- inc $0214
- DownDone1:
- rts
- UpPressed2:
- Test_Button buttons2, BUTTON_UP
- beq UpDone2
- dec $0218
- dec $021C
- dec $0220
- dec $0224
- dec $0228
- UpDone2:
- rts
- DownPressed2:
- Test_Button buttons2, BUTTON_DOWN
- beq DownDone2
- inc $0218
- inc $021C
- inc $0220
- inc $0224
- inc $0228
- DownDone2:
- rts
- MoveBall:
- lda $0200
- adc ballDown
- sbc ballUp
- sta $0200
- ldx $0200
- cpx #$E0
- beq FlipBallUp
- cpx #$08
- beq FlipBallDown
- lda $0203
- adc ballRight
- sbc ballLeft
- sta $0203
- ldx $0203
- cpx #$F8
- beq FlipBallLeft
- cpx #$08
- beq FlipBallRight
- rts
- FlipBallUp:
- lda #0
- sta ballDown
- lda #1
- sta ballUp
- rts
- FlipBallDown:
- lda #1
- sta ballDown
- lda #0
- sta ballUp
- rts
- FlipBallLeft:
- lda #0
- sta ballRight
- lda #1
- sta ballLeft
- rts
- FlipBallRight:
- lda #1
- sta ballRight
- lda #0
- sta ballLeft
- rts
- ; $E000 is where we put our color palette and our sprites
- .bank 1
- .org $E000
- MainPalette:
- .db $0F,$20,$10,$00, $0F,$0F,$0F,$0F, $0F,$0F,$0F,$0F, $0F,$0F,$0F,$0F ; Background Palette
- .db $0F,$1C,$2B,$3A, $0F,$20,$10,$00, $0F,$0F,$0F,$0F, $0F,$0F,$0F,$0F ; Sprite Palette
- Sprites:
- .include "sprites.asm"
- ; Bank 1 starts at $FFFA, where our interrupt vectors will go
- .org $FFFA
- .dw NMI ; NMI vector
- .dw RESET ; Reset vector
- .dw 0 ; IRQ vector
- ; Bank 2 starts at $0000, where our background and sprite data will go
- .bank 2
- .org $0000
- .incbin "graphics.chr"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement