mirror of
https://github.com/emkay/parser-6502.git
synced 2024-12-20 23:30:57 +00:00
330 lines
7.4 KiB
ArmAsm
330 lines
7.4 KiB
ArmAsm
.inesprg 1
|
|
.ineschr 1
|
|
.inesmap 0
|
|
.inesmir 1
|
|
|
|
.bank 0
|
|
.org $C000
|
|
RESET:
|
|
sei
|
|
cld
|
|
ldx #$40
|
|
stx $4017
|
|
ldx #$FF
|
|
txs
|
|
inx
|
|
stx $2000
|
|
stx $2001
|
|
stx $4010
|
|
vblankwait1:
|
|
bit $2002
|
|
bpl vblankwait1
|
|
clrmem:
|
|
lda #$00
|
|
sta $0000, x
|
|
sta $0100, x
|
|
sta $0200, x
|
|
sta $0400, x
|
|
sta $0500, x
|
|
sta $0600, x
|
|
sta $0700, x
|
|
lda #$FE
|
|
sta $0300, x
|
|
inx
|
|
bne clrmem
|
|
vblankwait2:
|
|
bit $2002
|
|
bpl vblankwait2
|
|
|
|
lda $2002
|
|
lda #$3F
|
|
sta $2006
|
|
lda #$00
|
|
sta $2006
|
|
ldx #$00
|
|
LoadPalettesLoop:
|
|
lda PaletteData, x
|
|
sta $2007
|
|
inx
|
|
cpx #$20
|
|
bne LoadPalettesLoop
|
|
LoadSprites:
|
|
ldx #$00
|
|
LoadSpritesLoop:
|
|
lda sprites, x
|
|
sta $0200, x
|
|
inx
|
|
cpx #$10
|
|
bne LoadSpritesLoop
|
|
|
|
LoadBackgrounds:
|
|
lda $2002
|
|
lda #$20
|
|
sta $2006
|
|
lda #$00
|
|
sta $2006
|
|
ldx #$00
|
|
LoadBackground1:
|
|
lda background1, x
|
|
sta $2007
|
|
inx
|
|
cpx #$00
|
|
bne LoadBackground1
|
|
LoadBackground2:
|
|
lda background2, x
|
|
sta $2007
|
|
inx
|
|
cpx #$00
|
|
bne LoadBackground2
|
|
LoadBackground3:
|
|
lda background3, x
|
|
sta $2007
|
|
inx
|
|
cpx #$00
|
|
bne LoadBackground3
|
|
LoadBackground4:
|
|
lda background4, x
|
|
sta $2007
|
|
inx
|
|
cpx #$00
|
|
bne LoadBackground4
|
|
LoadAttribute:
|
|
lda $2002
|
|
lda #$23
|
|
sta $2006
|
|
lda #$C0
|
|
sta $2006
|
|
ldx #$00
|
|
LoadAttributeLoop:
|
|
lda attribute, x
|
|
sta $2007
|
|
inx
|
|
cpx #$40
|
|
bne LoadAttributeLoop
|
|
|
|
lda #%10010000
|
|
sta $2000
|
|
lda #%00011110
|
|
sta $2001
|
|
Forever:
|
|
jmp Forever
|
|
NMI:
|
|
|
|
lda #$00
|
|
sta $2003
|
|
lda #$02
|
|
sta $4014
|
|
|
|
lda #$01
|
|
sta $4016
|
|
lda #$00
|
|
sta $4016
|
|
ReadA:
|
|
lda $4016
|
|
and #%00000001
|
|
beq ReadADone
|
|
ReadADone:
|
|
ReadB:
|
|
lda $4016
|
|
and #%00000001
|
|
beq ReadBDone
|
|
ReadBDone:
|
|
ReadSel:
|
|
lda $4016
|
|
and #%00000001
|
|
beq ReadSelDone
|
|
ReadSelDone:
|
|
ReadStart:
|
|
lda $4016
|
|
and #%00000001
|
|
beq ReadStartDone
|
|
ReadStartDone:
|
|
ReadUp:
|
|
lda $4016
|
|
and #%00000001
|
|
beq ReadUpDone
|
|
lda $0200
|
|
sec
|
|
sbc #$01
|
|
sta $0200
|
|
lda $0204
|
|
sec
|
|
sbc #$01
|
|
sta $0204
|
|
lda $0208
|
|
sec
|
|
sbc #$01
|
|
sta $0208
|
|
lda $020C
|
|
sec
|
|
sbc #$01
|
|
sta $020C
|
|
ReadUpDone:
|
|
ReadDown:
|
|
lda $4016
|
|
and #%00000001
|
|
beq ReadDownDone
|
|
lda $0200
|
|
clc
|
|
adc #$01
|
|
sta $0200
|
|
lda $0204
|
|
clc
|
|
adc #$01
|
|
sta $0204
|
|
lda $0208
|
|
clc
|
|
adc #$01
|
|
sta $0208
|
|
lda $020C
|
|
clc
|
|
adc #$01
|
|
sta $020C
|
|
ReadDownDone:
|
|
ReadLeft:
|
|
lda $4016
|
|
and #%00000001
|
|
beq ReadLeftDone
|
|
lda $0203
|
|
sec
|
|
sbc #$01
|
|
sta $0203
|
|
lda $0207
|
|
sec
|
|
sbc #$01
|
|
sta $0207
|
|
lda $020B
|
|
sec
|
|
sbc #$01
|
|
sta $020B
|
|
lda $020F
|
|
sec
|
|
sbc #$01
|
|
sta $020F
|
|
ReadLeftDone:
|
|
ReadRight:
|
|
lda $4016
|
|
and #%00000001
|
|
beq ReadRightDone
|
|
lda $0203
|
|
clc
|
|
adc #$01
|
|
sta $0203
|
|
lda $0207
|
|
clc
|
|
adc #$01
|
|
sta $0207
|
|
lda $020B
|
|
clc
|
|
adc #$01
|
|
sta $020B
|
|
lda $020F
|
|
clc
|
|
adc #$01
|
|
sta $020F
|
|
ReadRightDone:
|
|
lda #%10010000
|
|
sta $2000
|
|
lda #%00011110
|
|
sta $2001
|
|
lda #$00
|
|
sta $2005
|
|
sta $2005
|
|
|
|
rti
|
|
.bank 1
|
|
.org $E000
|
|
|
|
PaletteData:
|
|
.db $22,$29,$1A,$0F,$22,$36,$17,$0F,$22,$30,$21,$0F,$22,$27,$17,$0F
|
|
.db $0F,$16,$27,$18,$22,$02,$38,$3C,$22,$1C,$15,$14,$22,$02,$38,$3C
|
|
|
|
sprites:
|
|
.db $80, 112, $0, $80
|
|
.db $80, 113, $0, $88
|
|
.db $88, 114, $0, $80
|
|
.db $88, 115, $0, $88
|
|
|
|
background1:
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$45,$45,$24,$24,$45,$45,$45,$45,$45,$45,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$53,$54,$24,$24
|
|
.db $24,$24,$24,$24,$47,$47,$24,$24,$47,$47,$47,$47,$47,$47,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$55,$56,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
background2:
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$45,$45,$24,$24,$45,$45,$45,$45,$45,$45,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$53,$54,$24,$24
|
|
.db $24,$24,$24,$24,$47,$47,$24,$24,$47,$47,$47,$47,$47,$47,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$55,$56,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
background3:
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$45,$45,$24,$24,$45,$45,$45,$45,$45,$45,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$53,$54,$24,$24
|
|
.db $24,$24,$24,$24,$47,$47,$24,$24,$47,$47,$47,$47,$47,$47,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$55,$56,$24,$24
|
|
.db 17,14,21,21,24,36,32,24,27,21,13,36,36,36,36,36
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
background4:
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$45,$45,$24,$24,$45,$45,$45,$45,$45,$45,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$53,$54,$24,$24
|
|
.db $24,$24,$24,$24,$47,$47,$24,$24,$47,$47,$47,$47,$47,$47,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$55,$56,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
|
|
attribute:
|
|
.db %00010001, %00010001, %01010101, %00010001, %00010001, %00010001, %00010001, %01110111
|
|
.db %00010001, %00010001, %01010101, %00010001, %00010001, %00010001, %00010001, %01110111
|
|
.db %00010001, %00010001, %01010101, %00010001, %00010001, %00010001, %00010001, %01110111
|
|
.db %00010001, %00010001, %01010101, %00010001, %00010001, %00010001, %00010001, %01110111
|
|
.db %00010001, %00010001, %01010101, %00010001, %00010001, %00010001, %00010001, %01110111
|
|
.db %00010001, %00010001, %01010101, %00010001, %00010001, %00010001, %00010001, %01110111
|
|
.db %00010001, %00010001, %01010101, %00010001, %00010001, %00010001, %00010001, %01110111
|
|
.db %00010001, %00010001, %01010101, %00010001, %00010001, %00010001, %00010001, %01110111
|
|
|
|
.org $FFFA
|
|
|
|
.dw NMI
|
|
.dw RESET
|
|
.dw 0
|
|
.bank 2
|
|
.org $0000
|
|
.incbin "mario.chr"
|