From 201d9bf15cf06ad34434535593c03e234be0a322 Mon Sep 17 00:00:00 2001 From: Brooke Vibber Date: Sun, 25 Feb 2024 15:15:23 -0800 Subject: [PATCH] clear screen after zoom/scroll --- mandel.s | 59 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/mandel.s b/mandel.s index ae8b897..6dedb17 100644 --- a/mandel.s +++ b/mandel.s @@ -890,6 +890,37 @@ done: .endproc +.proc clear_screen + ; zero the range from framebuffer_top to display_list + lda #.lobyte(framebuffer_top) + sta temp + lda #.hibyte(framebuffer_top) + sta temp + 1 + +zero_page_loop: + lda #0 + ldy #0 +zero_byte_loop: + sta (temp),y + iny + bne zero_byte_loop + + inc temp + 1 + lda temp + 1 + cmp #.hibyte(display_list) + bne zero_page_loop + + rts +.endproc + +.proc status_bar + ; Status bar + draw_text 0, str_self_len, str_self + draw_text 40 - str_run_len, str_run_len, str_run + + rts +.endproc + .proc start ; ox = 0; oy = 0; zoom = 0 @@ -916,24 +947,7 @@ done: lda #0 sta DMACTL - ; zero the range from framebuffer_top to framebuffer_end - lda #.lobyte(framebuffer_top) - sta temp - lda #.hibyte(framebuffer_top) - sta temp + 1 - -zero_page_loop: - lda #0 - ldy #0 -zero_byte_loop: - sta (temp),y - iny - bne zero_byte_loop - - inc temp + 1 - lda temp + 1 - cmp #.hibyte(framebuffer_end) - bne zero_page_loop + jsr clear_screen ; Copy the display list into properly aligned memory ; Can't cross 1024-byte boundaries :D @@ -953,10 +967,6 @@ copy_byte_loop: sta DLISTH ; actual register sta SDLSTH ; shadow register the OS will copy in - ; Status bar - draw_text 0, str_self_len, str_self - draw_text 40 - str_run_len, str_run_len, str_run - ; Re-enable display DMA lda #$22 sta DMACTL @@ -968,6 +978,9 @@ copy_byte_loop: jsr SETVBV main_loop: + jsr clear_screen + jsr status_bar + lda #0 sta fill_level @@ -1031,7 +1044,7 @@ not_skipped_mask: jsr keycheck beq no_key ; @fixme clear the pixel stats - jmp fill_loop + jmp main_loop no_key: ; check if we should update the counters