zero: .db $00 ; assuming A is 8-bit, X/Y are 16-bit clear_wram: ; From fixed CPU address to IO register, ; transfer unit is one byte lda #%00001000 sta DMAP0 ; $4300 lda #$80 ; to WRAM (via $2180) sta BBAD0 ; $4301 ldx #zero ; from zero stx A1T0L ; $4302-4303 lda #^zero ; bank of zero sta A1B0 ; $4304 stz DAS0L ; transfer $10000 bytes stz DAS0H ; $4305-$4306 stz WMADDL ; start at WRAM address $00000 ($7e0000) stz WMADDM ; $2181-$2183 stz WMADDH lda #%00000001 ; run DMA channel 0 sta MDMAEN ; first to clear $7e0000-$7effff... sta MDMAEN ; then again to clear $7f0000-$7fffff ; And we're done. We'd return here, but we... kinda wiped out ; the stack in the process of clearing WRAM, so... jmp main