diff --git a/font/disk1.png b/font/disk1.png new file mode 100644 index 0000000..eea8def Binary files /dev/null and b/font/disk1.png differ diff --git a/font/disk1.raw b/font/disk1.raw new file mode 100644 index 0000000..e8d8f61 Binary files /dev/null and b/font/disk1.raw differ diff --git a/font/disk2.png b/font/disk2.png new file mode 100644 index 0000000..f0f1ac1 Binary files /dev/null and b/font/disk2.png differ diff --git a/font/disk2.raw b/font/disk2.raw new file mode 100644 index 0000000..fd94a12 Binary files /dev/null and b/font/disk2.raw differ diff --git a/icon.asm b/icon.asm new file mode 100644 index 0000000..ca0288b --- /dev/null +++ b/icon.asm @@ -0,0 +1,75 @@ +; status icon routines +; created by TalonFox for Ry :3 + +; note to self: icon overlay is overlay 28 (0x1c) + +; changes the 32x32 pixel icon to the given icon pointed at the given address +; inputs: +; r0: Pointer to icon data +; outputs: +; none +change_icon: + push r0 + push r1 + push r31 + + ; write the cursor bitmap to the overlay framebuffer + movz.32 r1, r0 + mov r0, ICON_FRAMEBUFFER_PTR + mov r31, 1024 ; 32x32 +change_icon_loop: + mov [r0], [r1] + add r0, 4 + add r1, 4 + loop change_icon_loop + pop r31 + pop r1 + pop r0 + ret + +setup_icon: + push r0 + push r1 + movz r0, 0x8000001c + movz r1, ICON_POSITION_Y + sla r1, 16 + or r1, ICON_POSITION_X + out r0, r1 + add r0, 0x100 + movz r1, ICON_HEIGHT + sla r1, 16 + or r1, ICON_WIDTH + out r0, r1 + add r0, 0x100 + movz r1, ICON_FRAMEBUFFER_PTR + out r0, r1 + add r0, 0x100 + movz r1, 1 + out r0, r1 + pop r1 + pop r0 + ret + +const ICON_TICK: 0x03FFFFFC + +icon_update: + push r0 + mov.32 r0, [ICON_TICK] + add r0, 1 + rem r0, 60 + mov.32 [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 + call change_icon + jmp icon_update_ret +icon_update2: + movz r0, disk_icon + call change_icon +icon_update_ret: + pop r0 + ret \ No newline at end of file diff --git a/main.asm b/main.asm index 5d93afa..5cbb53d 100644 --- a/main.asm +++ b/main.asm @@ -121,36 +121,42 @@ draw_bottom_bar_loop: 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 + ;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, 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 @@ -198,6 +204,7 @@ poweroff_wait: #include "draw_tile.asm" #include "event.asm" #include "exception.asm" + #include "icon.asm" #include "integer.asm" #include "keyboard.asm" #include "memory.asm" @@ -341,6 +348,18 @@ 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 +const ICON_POSITION_X: 304 +const ICON_POSITION_Y: 224 +const ICON_FRAMEBUFFER_PTR: 0x0212C000 + ; cursor overlay struct: const CURSOR_WIDTH: 8 const CURSOR_HEIGHT: 12 @@ -353,6 +372,13 @@ 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 @@ -362,8 +388,8 @@ 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" +; 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" diff --git a/vsync.asm b/vsync.asm index 62a6f24..0cb1e6e 100644 --- a/vsync.asm +++ b/vsync.asm @@ -13,6 +13,7 @@ system_vsync_handler: call mouse_update call keyboard_update + call icon_update pop r7 pop r6