Last active
September 9, 2018 03:01
-
-
Save niconii/296c03811787f54e48723917736d5268 to your computer and use it in GitHub Desktop.
Revisions
-
niconii revised this gist
Sep 9, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ clear_wram: ldx #zero ; from zero stx A1T0L ; $4302-4303 lda #^zero ; bank of zero sta A1B0 ; $4304 stz DAS0L ; transfer $10000 bytes -
niconii created this gist
Sep 9, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ 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 #.bank(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