Code:
.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 $0300, x
STA $0400, x
STA $0500, x
STA $0600, x
STA $0700, x
LDA #$FE
STA $0200, x
INX
BNE clrmem
vblankwait2:
BIT $2002
BPL vblankwait2
LoadPalettes:
LDA $2002
LDA #$3F
STA $2006
LDA #$00
STA $2006
LDX #$00
LoadPalettesLoop:
LDA palette, x
STA $2007
INX
CPX #$20
BNE LoadPalettesLoop
LDA #$80
STA $0200
STA $0203
LDA #$00
STA $0201
STA $0202
LDA #$80
STA $0204
LDA #$88
STA $0207
LDA #$01
STA $0205
LDA #$00
STA $0206
LDA #$88
STA $0208
LDA #$80
STA $020B
LDA #$02
STA $0209
LDA #$00
STA $020A
LDA #$88
STA $020C
LDA #$88
STA $020F
LDA #$03
STA $020D
LDA #$00
STA $020E
LDA #$90
STA $0210
LDA #$80
STA $0213
LDA #$04
STA $0211
LDA #$00
STA $0212
LDA #$90
STA $0214
LDA #$88
STA $0217
LDA #$05
STA $0215
LDA #$00
STA $0216
LDA #$98
STA $0218
LDA #$80
STA $021B
LDA #$06
STA $0219
LDA #$00
STA $021A
LDA #$98
STA $021C
LDA #$88
STA $021F
LDA #$07
STA $021D
LDA #$00
STA $021E
LDA #%10000000
STA $2000
LDA #%00010000
STA $2001
Forever:
JMP Forever
NMI:
LDA #$00
STA $2003
LDA #$02
STA $4014
RTI
;;;;;;;;;;;;;;
.bank 1
.org $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
.org $FFFA
.dw NMI
.dw RESET
.dw 0
;;;;;;;;;;;;;;
.bank 2
.org $0000
.incbin "mario.chr"