Code:
.inesprg 1
.ineschr 0
.inesmir 1
.inesmap 0
.org $8000
.bank 0
reset:
sei ; ignore IRQs
cld ; disable decimal mode
ldx #$40
stx $4017 ; disable APU frame IRQ
ldx #$ff
txs ; Set up stack
inx ; now X = 0
stx $2000 ; disable NMI
stx $2001 ; disable rendering
stx $4010 ; disable DMC IRQs
; Optional (omitted):
; Set up mapper and jmp to further init code here.
; First of two waits for vertical blank to make sure that the
; PPU has stabilized
vblankwait1:
bit $2002
bpl vblankwait1
; We now have about 30,000 cycles to burn before the PPU stabilizes.
; Use it to clear RAM. X is still 0...
txa
clrmem:
sta $000,x
sta $100,x
sta $200,x
sta $300,x
sta $400,x
sta $500,x
sta $600,x
sta $700,x ; Remove this if you're storing reset-persistent data
inx
bne clrmem
vblankwait2:
bit $2002
bpl vblankwait2
chngbkr:
lda #$3F
sta $2006 ;first we write the upper byte of the ppu adress we want to ;write to in this case $3F00
lda #$00
sta $2006 ;now we write the lower byte #$00
lda #$2a ;value green = #$2a
sta $2007 ;ppudata
lda #%00001000
sta $2001 ;main screen turn on
loop:
jmp loop
;!The Vector Table!
.bank 1
.org $FFFA
.dw 0 ;(NMI_Routine)
.dw reset ;(Reset_Routine)
.dw 0 ;(IRQ_Routine)