From 433df07c419cac7fc7667d8938bb8d548c0a6c74 Mon Sep 17 00:00:00 2001 From: Ry Date: Tue, 7 Mar 2023 18:36:12 -0800 Subject: [PATCH] Boot icon cleanup --- boot.asm | 3 +++ icon.asm | 46 ++++++++++++++++++++++++++------------------ main.asm | 57 +++++++------------------------------------------------ vsync.asm | 3 ++- 4 files changed, 40 insertions(+), 69 deletions(-) diff --git a/boot.asm b/boot.asm index faeb6ec..5dfda9c 100644 --- a/boot.asm +++ b/boot.asm @@ -54,6 +54,9 @@ boot_cleanup: mov r0, BACKGROUND_COLOR call fill_background + ; disable the blinking disk icon + call cleanup_icon + movz.8 r0, 0 movz.8 r1, 0 movz.8 r2, 0 diff --git a/icon.asm b/icon.asm index ca0288b..ed5a246 100644 --- a/icon.asm +++ b/icon.asm @@ -1,11 +1,14 @@ ; status icon routines ; created by TalonFox for Ry :3 -; note to self: icon overlay is overlay 28 (0x1c) +; note to self: icon overlay is overlay 28 (0x1C) -; changes the 32x32 pixel icon to the given icon pointed at the given address +const UPDATE_ICON: 0x0228FFFE +const ICON_TICK: 0x0228FFFF + +; change the 32x32 pixel icon to the given icon pointed at the given address ; inputs: -; r0: Pointer to icon data +; r0: pointer to icon data ; outputs: ; none change_icon: @@ -13,8 +16,7 @@ change_icon: push r1 push r31 - ; write the cursor bitmap to the overlay framebuffer - movz.32 r1, r0 + mov r1, r0 mov r0, ICON_FRAMEBUFFER_PTR mov r31, 1024 ; 32x32 change_icon_loop: @@ -22,6 +24,7 @@ change_icon_loop: add r0, 4 add r1, 4 loop change_icon_loop + pop r31 pop r1 pop r0 @@ -30,46 +33,53 @@ change_icon_loop: setup_icon: push r0 push r1 - movz r0, 0x8000001c - movz r1, ICON_POSITION_Y + + mov r0, 0x8000001C + mov r1, ICON_POSITION_Y sla r1, 16 or r1, ICON_POSITION_X out r0, r1 add r0, 0x100 - movz r1, ICON_HEIGHT + mov r1, ICON_HEIGHT sla r1, 16 or r1, ICON_WIDTH out r0, r1 add r0, 0x100 - movz r1, ICON_FRAMEBUFFER_PTR + mov r1, ICON_FRAMEBUFFER_PTR out r0, r1 add r0, 0x100 - movz r1, 1 - out r0, r1 + out r0, 1 + + mov.8 [UPDATE_ICON], 1 + pop r1 pop r0 ret -const ICON_TICK: 0x03FFFFFC +cleanup_icon: + out 0x8000031C, 0 + mov.8 [UPDATE_ICON], 0 + ret icon_update: push r0 - mov.32 r0, [ICON_TICK] - add r0, 1 + + movz.8 r0, [ICON_TICK] + inc r0 rem r0, 60 - mov.32 [ICON_TICK], r0 + mov.8 [ICON_TICK], r0 cmp r0, 0 ifz jmp icon_update1 cmp r0, 30 ifz jmp icon_update2 jmp icon_update_ret icon_update1: - movz r0, disk_icon_q + mov r0, disk_icon_q call change_icon jmp icon_update_ret icon_update2: - movz r0, disk_icon + mov r0, disk_icon call change_icon icon_update_ret: pop r0 - ret \ No newline at end of file + ret diff --git a/main.asm b/main.asm index 5cbb53d..3d0d180 100644 --- a/main.asm +++ b/main.asm @@ -120,44 +120,10 @@ draw_bottom_bar_loop: mov r12, FOX32ROM_VERSION_PATCH call draw_format_str_to_background - ; draw the box in the middle of the screen - ;mov r0, 242 - ;mov r1, 203 - ;mov r2, 156 - ;mov r3, 60 - ;mov r4, 0xFFFFFFFF - ;call draw_filled_rectangle_to_background - ;mov r0, 243 - ;mov r1, 204 - ;mov r2, 154 - ;mov r3, 58 - ;mov r4, 0xFF000000 - ;call draw_filled_rectangle_to_background - ;mov r0, 244 - ;mov r1, 205 - ;mov r2, 152 - ;mov r3, 56 - ;mov r4, 0xFFFFFFFF - ;call draw_filled_rectangle_to_background - - ; draw the text inside the box - ; mov r0, startup_str_0 - ; mov r1, 256 - ; mov r2, 216 - ; mov r3, 0xFF000000 - ; mov r4, 0x00000000 - ; call draw_str_to_background - ; mov r0, startup_str_1 - ; mov r1, 256 - ; mov r2, 232 - ; call draw_str_to_background - mov r0, disk_icon_q call change_icon call setup_icon - mov r0, bottom_bar_patterns - event_loop: call get_next_event @@ -220,7 +186,13 @@ poweroff_wait: #include "vsync.asm" - +; TODO: convert these icons to 1 bit bitmaps and move +; them down to the data section at 0xF004F000, +; once 1 bit drawing routines are implemented +disk_icon: + #include_bin "font/disk1.raw" +disk_icon_q: + #include_bin "font/disk2.raw" ; data @@ -348,11 +320,6 @@ standard_font_data: mouse_cursor: #include_bin "font/cursor2.raw" -disk_icon: - #include_bin "font/disk1.raw" -disk_icon_q: - #include_bin "font/disk2.raw" - ; icon overlay struct: const ICON_WIDTH: 32 const ICON_HEIGHT: 32 @@ -372,13 +339,6 @@ const MENU_BAR_POSITION_X: 0 const MENU_BAR_POSITION_Y: 0 const MENU_BAR_FRAMEBUFFER_PTR: 0x0214C180 -; menu bar overlay struct: -const MENU_BAR_WIDTH: 640 -const MENU_BAR_HEIGHT: 16 -const MENU_BAR_POSITION_X: 0 -const MENU_BAR_POSITION_Y: 0 -const MENU_BAR_FRAMEBUFFER_PTR: 0x0214D180 - ; menu overlay struct: ; this struct must be writable, so these are hard-coded addresses in ram const MENU_WIDTH: 0x02156180 ; 2 bytes @@ -388,9 +348,6 @@ const MENU_POSITION_Y: 0x02156186 ; 2 bytes const MENU_FRAMEBUFFER_PTR: 0x0215618A ; 4 bytes const MENU_FRAMEBUFFER: 0x0215618E ; max 640x480x4 = end address at 0x0228218E -; startup_str_0: data.strz "Welcome to fox32" -; startup_str_1: data.strz "Insert boot disk" - bottom_bar_str_0: data.strz "FOX" bottom_bar_str_1: data.strz "32" bottom_bar_str_2: data.strz " ROM version %u.%u.%u " diff --git a/vsync.asm b/vsync.asm index 0cb1e6e..37c4862 100644 --- a/vsync.asm +++ b/vsync.asm @@ -13,7 +13,8 @@ system_vsync_handler: call mouse_update call keyboard_update - call icon_update + cmp.8 [UPDATE_ICON], 0 + ifnz call icon_update pop r7 pop r6