size-optimized screen clearing
This commit is contained in:
1 parent
64c8bc6b82
commit
da2fa7ac90
3 files changed
+31
-68
No files matched your search
@@ -7,60 +7,4 @@
|
||||
|
||||
|
||||
clear_screen_real:
|
||||
|
||||
// Clear the line link table - cheecked on original ROMs,
|
||||
// the highest bit set means that the line is NOT a logical
|
||||
// continuation of the previous one
|
||||
|
||||
lda #$80
|
||||
ldy #24
|
||||
!:
|
||||
sta LDTBL,y
|
||||
dey
|
||||
bpl !-
|
||||
|
||||
// YYY flow can probably be size-optimized by calling screen_clear_line in a loop
|
||||
|
||||
// Clear screen character RAM. Unfortunately, the HIBASE value is not on the zero page,
|
||||
// we will reuse PNT (it will be overridden in a moment nevertheless) as the pointer
|
||||
|
||||
iny // sets .Y to 0
|
||||
sty PNT+0
|
||||
lda HIBASE
|
||||
sta PNT+1
|
||||
|
||||
ldx #$03 // countdown for pages to update
|
||||
|
||||
clear_screen_loop:
|
||||
|
||||
ldy #$00
|
||||
lda #$20 // space character screen code
|
||||
!:
|
||||
sta (PNT),y
|
||||
iny
|
||||
cpy #250 // clear 250 bytes only, do not cross 1000 bytes barrier
|
||||
bne !-
|
||||
|
||||
lda PNT+0
|
||||
clc
|
||||
adc #250
|
||||
sta PNT+0
|
||||
bcc !+
|
||||
inc PNT+1
|
||||
!:
|
||||
dex
|
||||
bpl clear_screen_loop
|
||||
|
||||
// Now clear the colour RAM - .Y is now 250, make use of this fact
|
||||
|
||||
lda COLOR
|
||||
!:
|
||||
sta $D800 - 1 + 250 * 0, y
|
||||
sta $D800 - 1 + 250 * 1, y
|
||||
sta $D800 - 1 + 250 * 2, y
|
||||
sta $D800 - 1 + 250 * 3, y
|
||||
dey
|
||||
bne !-
|
||||
|
||||
// Fall to cursor home routine
|
||||
jmp cursor_home
|
||||
rts
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
//
|
||||
// Clear screen and initialise line link table, described in:
|
||||
//
|
||||
// - [CM64] Computes Mapping the Commodore 64 - pages 215-216
|
||||
//
|
||||
|
||||
|
||||
clear_screen:
|
||||
|
||||
jmp clear_screen_real
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
//
|
||||
// Clear screen and initialise line link table, described in:
|
||||
//
|
||||
// - [CM64] Computes Mapping the Commodore 64 - pages 215-216
|
||||
//
|
||||
|
||||
|
||||
clear_screen:
|
||||
|
||||
// Clear the line link table - cheecked on original ROMs,
|
||||
// the highest bit set means that the line is NOT a logical
|
||||
// continuation of the previous one
|
||||
|
||||
lda #$80
|
||||
ldy #24
|
||||
!:
|
||||
sta LDTBL,y
|
||||
dey
|
||||
bpl !-
|
||||
|
||||
// Clear all the rows
|
||||
ldx #24
|
||||
!:
|
||||
jsr screen_clear_line
|
||||
dex
|
||||
bpl !-
|
||||
|
||||
// Fall to cursor home routine
|
||||
jmp cursor_home
|
||||
Reference in new issue
Block a user