Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =================================================
- c-code:
- *MAPCTL = 0; // memory mapping for boot state
- ptr = (u8*) 0xfd00; // timers and audio fd00
- count = 0x40;//40
- while (count--)
- {
- *ptr++ = 0;
- }
- =================================================
- What it does:
- set mapping to 0 (all ROM, not RAM)
- then reset all registers at $fd00 (64).
- =================================================
- stz $FFF9 ;fastes way! good
- ldx #$FD ;this sets helper variables
- stz L0050
- stx L0050+1
- lda #$40
- sta L0051
- stz L0051+1
- bra L00D9 ;weirdo: branch away for preparations first
- L00D7:
- lda L0050
- ldx L0050+1
- sta regsave
- stx regsave+1 ;update regsave with helper variables
- ina
- bne L00DC
- inx
- L00DC:
- sta L0050 ;update helper variables
- stx L0050+1
- lda #$00
- sta (regsave) ;FINALLY write 0 to the register
- L00D9:
- lda L0051 ;read helper variabels and store them in regsave
- ldx L0051+1
- sta regsave
- stx regsave+1
- jsr decax1 ;prepare counter
- sta L0051
- stx L0051+1
- lda regsave ;...whatever
- ora regsave+1
- bne L00D7 ;branch back as part of the loop now!
- =================================================
- Assembler:
- stz $FFF9 ;identical to compiled part
- ldx #$40
- lda #0
- loop
- sta $fd00,x ;you can't do STZ blabla,x
- dex
- bpl loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement