Clearing the screen now switches to the cleared FB

This commit is contained in:
2026-09-13 23:18:11 +01:00
parent 1502c9f23c
commit 41c90b30aa
+35 -11
View File
@@ -185,8 +185,21 @@ pub set_graphics_mode:
pop r8
cmp r5, 0
jne clear ; Tail call
je set_graphics_mode__not_clear
; If double buffering
cmp r6, 0
je set_graphics_mode__clear_single_fb
; Clear one buffer..
push r13
counter r13
add r13, r13, 12
jmp clear_graphics_fb ; Call
pop r13
; ...then the other
set_graphics_mode__clear_single_fb:
jmp clear_graphics_fb ; Tail call
set_graphics_mode__not_clear:
mov flags, errno.OK
jmp r13 ; return
@@ -202,7 +215,7 @@ set_graphics_mode__error:
pub clear:
; void clear()
; Paints the whole screen black
; Paints the draw framebuffer black and switches to it
;
; Arguments:
; - None
@@ -213,12 +226,23 @@ pub clear:
; - r2: fill_screen
; - r3: fill_screen
; - r4: fill_screen
; - r5: Alternate link register
mov r5, r13
load_8 flags, [globals.FB_MODE]
je clear_graphics_mode
; Fall through into clear_text_mode
mov r13, clear__done
je clear__graphics
jmp clear_text_fb ; Call, return to clear__done
clear__graphics:
jmp clear_graphics_fb ; Call
clear__done:
mov r13, r5
jmp switch_buffers ; Tail call
pub clear_text_mode:
pub clear_text_fb:
; void clear_text_mode()
; Paints the whole text mode screen in the background colour
;
@@ -238,7 +262,7 @@ pub clear_text_mode:
load_8 r4, [globals.FB_LOG_BPP]
lsl r3, r3, r4 ; Num bytes in FB
load_32 r2, [globals.FB_DRAW_PTR]
add r3, r3, r2 ; End of FB
add r3, r3, r2 ; Start of FB
lsl r4, r3, r4 ; Num bytes in FB
load_32 r2, [globals.FB_DRAW_PTR]
add r3, r4, r2 ; End of FB
@@ -246,9 +270,9 @@ pub clear_text_mode:
jmp fill_screen__loop
pub clear_graphics_mode:
; u16 clear_graphics_mode()
; Paints the whole graphics mode screen black
pub clear_graphics_fb:
; u16 clear_graphics_fb()
; Paints all of the current graphics mode draw buffer black
;
; Arguments:
; - None
@@ -331,7 +355,7 @@ pub fill_screen:
jb fill_screen__loop
mov flags, errno.OK
jmp r13 ; return
jmp switch_buffers ; Tail call
pub set_text_mode_default: