.if !BUILD_NSF ; PPU PPUCTRL = $2000 PPUMASK = $2001 PPUSTATUS = $2002 SPRADDR = $2003 SPRDATA = $2004 PPUSCROLL = $2005 PPUADDR = $2006 PPUDATA = $2007 SPRDMA = $4014 PPUCTRL_NMI = $80 PPUMASK_BG0 = $0A PPUCTRL_8X8 = $00 PPUCTRL_8X16 = $20 PPUMASK_SPR = $14 PPUMASK_BG0CLIP = $08 .endif ; APU SNDCHN = $4015 JOY1 = $4016 JOY2 = $4017 SNDMODE = $4017 SNDMODE_NOIRQ = $40 ; Temporaries temp = $A temp2 = $B temp3 = $C addr = $E .macro init_nes ; Init NES sei cld ldx #$FF txs lda #0 .if !BUILD_NSF ; Init PPU sta PPUCTRL sta PPUMASK .endif ; Clear RAM ldx #7 ; last page tay ; offset in last page+1 sta <0 @clear_page: stx <1 : dey sta (0),y bne :- dex bpl @clear_page .if !BUILD_NSF ; Let PPU initialize : bit PPUSTATUS bpl :- : bit PPUSTATUS bpl :- .endif .endmacro