fox32rom: Add enable_menu_bar and disable_menu_bar

This commit is contained in:
Ry 2022-03-23 11:24:01 -07:00
parent 0d990b375c
commit de64ea53b8
4 changed files with 58 additions and 27 deletions

View File

@ -51,7 +51,6 @@ boot_cleanup:
call fill_background
; disable the menu bar
mov r0, 0x8000031E
out r0, 0
call disable_menu_bar
ret

View File

@ -36,11 +36,13 @@ check_if_overlay_covers_position: jmp [0xF004301C]
check_if_enabled_overlay_covers_position: jmp [0xF0043020]
; menu bar jump table entries
menu_bar_click_event: jmp [0xF0044000]
clear_menu_bar: jmp [0xF0044004]
draw_menu_bar_root_items: jmp [0xF0044008]
draw_menu_items: jmp [0xF004400C]
close_menu: jmp [0xF0044010]
enable_menu_bar: jmp [0xF0044000]
disable_menu_bar: jmp [0xF0044004]
menu_bar_click_event: jmp [0xF0044008]
clear_menu_bar: jmp [0xF004400C]
draw_menu_bar_root_items: jmp [0xF0044010]
draw_menu_items: jmp [0xF0044014]
close_menu: jmp [0xF0044018]
; event types
const MOUSE_CLICK_EVENT_TYPE: 0x00000000

View File

@ -52,26 +52,7 @@ cursor_enable:
mov r0, BACKGROUND_COLOR
call fill_background
menu_bar_enable:
; set properties of overlay 30
mov r0, 0x8000001E ; overlay 30: position
mov.16 r1, [overlay_30_position_y]
sla r1, 16
mov.16 r1, [overlay_30_position_x]
out r0, r1
mov r0, 0x8000011E ; overlay 30: size
mov.16 r1, [overlay_30_height]
sla r1, 16
mov.16 r1, [overlay_30_width]
out r0, r1
mov r0, 0x8000021E ; overlay 30: framebuffer pointer
mov r1, [overlay_30_framebuffer_ptr]
out r0, r1
; enable overlay 30 (menu bar)
mov r0, 0x8000031E
out r0, 1
call enable_menu_bar
call clear_menu_bar
mov r0, menu_items_root
mov r1, 0xFFFFFFFF
@ -204,6 +185,8 @@ get_rom_version:
; menu bar jump table
org.pad 0xF0044000
data.32 enable_menu_bar
data.32 disable_menu_bar
data.32 menu_bar_click_event
data.32 clear_menu_bar
data.32 draw_menu_bar_root_items

View File

@ -4,6 +4,53 @@ const MENU_BAR_BACKGROUND_COLOR: 0xFF3F3F3F
const MENU_BAR_SELECTED_COLOR: 0xFFFFFFFF
const MENU_BAR_UNSELECTED_COLOR: 0xFF3F3F3F
; enable menu bar
; inputs:
; none
; outputs:
; none
enable_menu_bar:
push r0
push r1
; set properties of overlay 30
mov r0, 0x8000001E ; overlay 30: position
mov.16 r1, [overlay_30_position_y]
sla r1, 16
mov.16 r1, [overlay_30_position_x]
out r0, r1
mov r0, 0x8000011E ; overlay 30: size
mov.16 r1, [overlay_30_height]
sla r1, 16
mov.16 r1, [overlay_30_width]
out r0, r1
mov r0, 0x8000021E ; overlay 30: framebuffer pointer
mov r1, [overlay_30_framebuffer_ptr]
out r0, r1
; enable overlay 30 (menu bar)
mov r0, 0x8000031E
out r0, 1
pop r1
pop r0
ret
; disable menu bar
; inputs:
; none
; outputs:
; none
disable_menu_bar:
push r0
; disable overlay 30 (menu bar)
mov r0, 0x8000031E
out r0, 0
pop r0
ret
; clear menu bar
; inputs:
; none