screen clearing fixes
This commit is contained in:
1 parent
3b9bfde993
commit
9ef81db3d4
2 files changed
+76
-51
No files matched your search
@@ -1,70 +1,69 @@
|
||||
// Clear screen and initialise line link table
|
||||
// (Compute's Mapping the 64 p215-216)
|
||||
|
||||
//
|
||||
// Clear screen and initialise line link table, described in:
|
||||
//
|
||||
// - [CM64] Computes Mapping the Commodore 64 - pages 215-216
|
||||
//
|
||||
|
||||
|
||||
clear_screen_real:
|
||||
rts
|
||||
|
||||
/* YYY disabled for rework
|
||||
// First disable the cursor
|
||||
jsr cursor_disable
|
||||
|
||||
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
|
||||
|
||||
// XXX it is probably a good idea to hide cursor first
|
||||
|
||||
// Clear line link table
|
||||
// (Compute's Mapping the 64 p215)
|
||||
|
||||
lda #$00
|
||||
ldy #24
|
||||
clearscreen_l1:
|
||||
lda #$80
|
||||
ldy #24
|
||||
!:
|
||||
sta LDTBL,y
|
||||
dey
|
||||
bpl clearscreen_l1
|
||||
bpl !-
|
||||
|
||||
// Y now = #$FF
|
||||
// YYY flow can probably be size-optimized, by clearing a single row each time (we will need such a subroutine)
|
||||
|
||||
// Clear screen RAM.
|
||||
// We should do this at HIBASE, which annoyingly
|
||||
// is no ZP, so we need to make a vector
|
||||
// (Compute's Mapping the 64 p216)
|
||||
// Get pointer to the screen into PNT
|
||||
// as it is the first appropriate place for it found when
|
||||
// searching through the ZP allocations listed in
|
||||
// Compute's Mapping the 64
|
||||
sta PNT+0
|
||||
// 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
|
||||
iny // Y now = #$00
|
||||
lda #$20 // space character
|
||||
clearscreen_l2:
|
||||
sta PNT+1
|
||||
|
||||
ldx #$03 // countdown for pages to update
|
||||
|
||||
clear_screen_loop:
|
||||
|
||||
ldy #$00
|
||||
lda #$01 // space character screen code
|
||||
!:
|
||||
sta (PNT),y
|
||||
iny
|
||||
bne clearscreen_l2
|
||||
// To draw only 1000 bytes, add 250 to address each time
|
||||
lda PNT
|
||||
cpy #250 // clear 250 bytes only, do not cross 1000 bytes barrier
|
||||
bne !-
|
||||
|
||||
lda PNT+0
|
||||
clc
|
||||
adc #<250
|
||||
sta PNT
|
||||
lda PNT+1
|
||||
adc #>250
|
||||
sta PNT+1
|
||||
lda #$20 // get space character again
|
||||
adc #250
|
||||
sta PNT+0
|
||||
bcc !+
|
||||
inc PNT+1
|
||||
!:
|
||||
dex
|
||||
bpl clearscreen_l2
|
||||
bpl clear_screen_loop
|
||||
|
||||
// Now clear the colour RAM - .Y is now 250, make use of this fact
|
||||
|
||||
// Clear colour RAM
|
||||
// (Compute's Mapping the 64 p216)
|
||||
lda COLOR
|
||||
clearscreen_l3:
|
||||
sta $d800,y
|
||||
sta $d900,y
|
||||
sta $da00,y
|
||||
sta $db00-24,y // so we only erase 1000 bytes
|
||||
iny
|
||||
bne clearscreen_l3
|
||||
!:
|
||||
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 !-
|
||||
|
||||
// (Compute's Mapping the 64 p216)
|
||||
// Fall to cursor home routine
|
||||
jmp cursor_home
|
||||
|
||||
*/
|
||||
Reference in new issue
Block a user