Merge pull request #6 from TalonFox/main
Add Mac-style disk icon to Fox32ROM
This commit is contained in:
commit
a4918d9e3e
BIN
font/disk1.png
Normal file
BIN
font/disk1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
BIN
font/disk1.raw
Normal file
BIN
font/disk1.raw
Normal file
Binary file not shown.
BIN
font/disk2.png
Normal file
BIN
font/disk2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 787 B |
BIN
font/disk2.raw
Normal file
BIN
font/disk2.raw
Normal file
Binary file not shown.
75
icon.asm
Normal file
75
icon.asm
Normal file
|
@ -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
|
86
main.asm
86
main.asm
|
@ -121,36 +121,42 @@ draw_bottom_bar_loop:
|
||||||
call draw_format_str_to_background
|
call draw_format_str_to_background
|
||||||
|
|
||||||
; draw the box in the middle of the screen
|
; draw the box in the middle of the screen
|
||||||
mov r0, 242
|
;mov r0, 242
|
||||||
mov r1, 203
|
;mov r1, 203
|
||||||
mov r2, 156
|
;mov r2, 156
|
||||||
mov r3, 60
|
;mov r3, 60
|
||||||
mov r4, 0xFFFFFFFF
|
;mov r4, 0xFFFFFFFF
|
||||||
call draw_filled_rectangle_to_background
|
;call draw_filled_rectangle_to_background
|
||||||
mov r0, 243
|
;mov r0, 243
|
||||||
mov r1, 204
|
;mov r1, 204
|
||||||
mov r2, 154
|
;mov r2, 154
|
||||||
mov r3, 58
|
;mov r3, 58
|
||||||
mov r4, 0xFF000000
|
;mov r4, 0xFF000000
|
||||||
call draw_filled_rectangle_to_background
|
;call draw_filled_rectangle_to_background
|
||||||
mov r0, 244
|
;mov r0, 244
|
||||||
mov r1, 205
|
;mov r1, 205
|
||||||
mov r2, 152
|
;mov r2, 152
|
||||||
mov r3, 56
|
;mov r3, 56
|
||||||
mov r4, 0xFFFFFFFF
|
;mov r4, 0xFFFFFFFF
|
||||||
call draw_filled_rectangle_to_background
|
;call draw_filled_rectangle_to_background
|
||||||
|
|
||||||
; draw the text inside the box
|
; draw the text inside the box
|
||||||
mov r0, startup_str_0
|
; mov r0, startup_str_0
|
||||||
mov r1, 256
|
; mov r1, 256
|
||||||
mov r2, 216
|
; mov r2, 216
|
||||||
mov r3, 0xFF000000
|
; mov r3, 0xFF000000
|
||||||
mov r4, 0x00000000
|
; mov r4, 0x00000000
|
||||||
call draw_str_to_background
|
; call draw_str_to_background
|
||||||
mov r0, startup_str_1
|
; mov r0, startup_str_1
|
||||||
mov r1, 256
|
; mov r1, 256
|
||||||
mov r2, 232
|
; mov r2, 232
|
||||||
call draw_str_to_background
|
; call draw_str_to_background
|
||||||
|
|
||||||
|
mov r0, disk_icon_q
|
||||||
|
call change_icon
|
||||||
|
call setup_icon
|
||||||
|
|
||||||
|
mov r0, bottom_bar_patterns
|
||||||
|
|
||||||
event_loop:
|
event_loop:
|
||||||
call get_next_event
|
call get_next_event
|
||||||
|
@ -198,6 +204,7 @@ poweroff_wait:
|
||||||
#include "draw_tile.asm"
|
#include "draw_tile.asm"
|
||||||
#include "event.asm"
|
#include "event.asm"
|
||||||
#include "exception.asm"
|
#include "exception.asm"
|
||||||
|
#include "icon.asm"
|
||||||
#include "integer.asm"
|
#include "integer.asm"
|
||||||
#include "keyboard.asm"
|
#include "keyboard.asm"
|
||||||
#include "memory.asm"
|
#include "memory.asm"
|
||||||
|
@ -341,6 +348,18 @@ standard_font_data:
|
||||||
mouse_cursor:
|
mouse_cursor:
|
||||||
#include_bin "font/cursor2.raw"
|
#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:
|
; cursor overlay struct:
|
||||||
const CURSOR_WIDTH: 8
|
const CURSOR_WIDTH: 8
|
||||||
const CURSOR_HEIGHT: 12
|
const CURSOR_HEIGHT: 12
|
||||||
|
@ -353,6 +372,13 @@ const MENU_BAR_POSITION_X: 0
|
||||||
const MENU_BAR_POSITION_Y: 0
|
const MENU_BAR_POSITION_Y: 0
|
||||||
const MENU_BAR_FRAMEBUFFER_PTR: 0x0214C180
|
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:
|
; menu overlay struct:
|
||||||
; this struct must be writable, so these are hard-coded addresses in ram
|
; this struct must be writable, so these are hard-coded addresses in ram
|
||||||
const MENU_WIDTH: 0x02156180 ; 2 bytes
|
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_PTR: 0x0215618A ; 4 bytes
|
||||||
const MENU_FRAMEBUFFER: 0x0215618E ; max 640x480x4 = end address at 0x0228218E
|
const MENU_FRAMEBUFFER: 0x0215618E ; max 640x480x4 = end address at 0x0228218E
|
||||||
|
|
||||||
startup_str_0: data.strz "Welcome to fox32"
|
; startup_str_0: data.strz "Welcome to fox32"
|
||||||
startup_str_1: data.strz "Insert boot disk"
|
; startup_str_1: data.strz "Insert boot disk"
|
||||||
|
|
||||||
bottom_bar_str_0: data.strz "FOX"
|
bottom_bar_str_0: data.strz "FOX"
|
||||||
bottom_bar_str_1: data.strz "32"
|
bottom_bar_str_1: data.strz "32"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user