dust-tutorial-c64-first-intro/code/init_clear_screen.asm
2013-04-17 09:14:55 +02:00

23 lines
1004 B
NASM

;============================================================
; clear screen
; a loop instead of kernal routine to save cycles
;============================================================
init_screen ldx #$00 ; set X to zero (black color code)
stx $d021 ; set background color
stx $d020 ; set border color
clear lda #$20 ; #$20 is the spacebar Screen Code
sta $0400,x ; fill four areas with 256 spacebar characters
sta $0500,x
sta $0600,x
sta $06e8,x
lda #$00 ; set foreground to black in Color Ram
sta $d800,x
sta $d900,x
sta $da00,x
sta $dae8,x
inx ; increment X
bne clear ; did X turn to zero yet?
; if not, continue with the loop
rts ; return from this subroutine