launcher: Remove for now
This commit is contained in:
parent
3eff04b8a2
commit
b41e1dc3de
3
build.sh
3
build.sh
|
@ -19,9 +19,6 @@ fi
|
||||||
echo "assembling kernel"
|
echo "assembling kernel"
|
||||||
../fox32asm/target/release/fox32asm kernel/main.asm base_image/kernel.fxf
|
../fox32asm/target/release/fox32asm kernel/main.asm base_image/kernel.fxf
|
||||||
|
|
||||||
echo "assembling launcher"
|
|
||||||
../fox32asm/target/release/fox32asm launcher/main.asm base_image/launcher.fxf
|
|
||||||
|
|
||||||
echo "assembling barclock"
|
echo "assembling barclock"
|
||||||
../fox32asm/target/release/fox32asm barclock/main.asm base_image/barclock.fxf
|
../fox32asm/target/release/fox32asm barclock/main.asm base_image/barclock.fxf
|
||||||
|
|
||||||
|
|
|
@ -1,109 +0,0 @@
|
||||||
; about dialog
|
|
||||||
|
|
||||||
const BACKGROUND_COLOR: 0xFF674764
|
|
||||||
|
|
||||||
; show the about dialog
|
|
||||||
; inputs:
|
|
||||||
; none
|
|
||||||
; outputs:
|
|
||||||
; none
|
|
||||||
about_dialog:
|
|
||||||
call disable_menu_bar
|
|
||||||
|
|
||||||
; create the window
|
|
||||||
mov r0, about_dialog_window_struct
|
|
||||||
mov r1, about_dialog_window_title
|
|
||||||
mov r2, 288
|
|
||||||
mov r3, 128
|
|
||||||
mov r4, 64
|
|
||||||
mov r5, 64
|
|
||||||
mov r6, 0
|
|
||||||
call new_window
|
|
||||||
|
|
||||||
; fill the window with the fox32 purple color
|
|
||||||
mov r0, BACKGROUND_COLOR
|
|
||||||
mov r1, about_dialog_window_struct
|
|
||||||
call fill_window
|
|
||||||
|
|
||||||
mov r0, about_dialog_window_struct
|
|
||||||
call get_window_overlay_number
|
|
||||||
|
|
||||||
; draw strings
|
|
||||||
mov r5, r0
|
|
||||||
mov r0, about_dialog_window_launcher_string
|
|
||||||
mov r1, 4
|
|
||||||
mov r2, 20
|
|
||||||
mov r3, 0xFFFFFFFF
|
|
||||||
mov r4, BACKGROUND_COLOR
|
|
||||||
call draw_str_to_overlay
|
|
||||||
call get_os_version
|
|
||||||
mov r10, r0
|
|
||||||
mov r11, r1
|
|
||||||
mov r12, r2
|
|
||||||
mov r0, about_dialog_window_os_version_string
|
|
||||||
mov r1, 4
|
|
||||||
mov r2, 36
|
|
||||||
mov r3, 0xFFFFFFFF
|
|
||||||
mov r4, BACKGROUND_COLOR
|
|
||||||
call draw_format_str_to_overlay
|
|
||||||
call get_rom_version
|
|
||||||
mov r10, r0
|
|
||||||
mov r11, r1
|
|
||||||
mov r12, r2
|
|
||||||
mov r0, about_dialog_window_rom_version_string
|
|
||||||
mov r1, 4
|
|
||||||
mov r2, 52
|
|
||||||
mov r3, 0xFFFFFFFF
|
|
||||||
mov r4, BACKGROUND_COLOR
|
|
||||||
call draw_format_str_to_overlay
|
|
||||||
mov r0, about_dialog_window_made_by_string_1
|
|
||||||
mov r1, 4
|
|
||||||
mov r2, 104
|
|
||||||
mov r3, 0xFFFFFFFF
|
|
||||||
mov r4, BACKGROUND_COLOR
|
|
||||||
call draw_str_to_overlay
|
|
||||||
mov r0, about_dialog_window_made_by_string_2
|
|
||||||
mov r1, 180
|
|
||||||
mov r2, 120
|
|
||||||
mov r3, 0xFFFFFFFF
|
|
||||||
mov r4, BACKGROUND_COLOR
|
|
||||||
call draw_str_to_overlay
|
|
||||||
|
|
||||||
about_dialog_event_loop:
|
|
||||||
mov r0, about_dialog_window_struct
|
|
||||||
call get_next_window_event
|
|
||||||
|
|
||||||
cmp r0, EVENT_TYPE_MOUSE_CLICK
|
|
||||||
ifz jmp about_dialog_mouse_down
|
|
||||||
|
|
||||||
about_dialog_event_loop_end:
|
|
||||||
call yield_task
|
|
||||||
rjmp about_dialog_event_loop
|
|
||||||
|
|
||||||
about_dialog_mouse_down:
|
|
||||||
; check if we are attempting to drag or close the window
|
|
||||||
cmp r2, 16
|
|
||||||
iflteq jmp about_dialog_drag_or_close_window
|
|
||||||
|
|
||||||
jmp about_dialog_event_loop_end
|
|
||||||
|
|
||||||
about_dialog_drag_or_close_window:
|
|
||||||
cmp r1, 8
|
|
||||||
iflteq jmp about_dialog_close_window
|
|
||||||
mov r0, about_dialog_window_struct
|
|
||||||
call start_dragging_window
|
|
||||||
jmp about_dialog_event_loop_end
|
|
||||||
about_dialog_close_window:
|
|
||||||
mov r0, about_dialog_window_struct
|
|
||||||
call destroy_window
|
|
||||||
call enable_menu_bar
|
|
||||||
jmp event_loop
|
|
||||||
|
|
||||||
about_dialog_window_title: data.str "About" data.8 0
|
|
||||||
about_dialog_window_struct: data.fill 0, 32
|
|
||||||
|
|
||||||
about_dialog_window_launcher_string: data.str "Launcher - the fox32os FXF launcher" data.8 0
|
|
||||||
about_dialog_window_made_by_string_1: data.str "fox32 - the computer made with love" data.8 0
|
|
||||||
about_dialog_window_made_by_string_2: data.str "by Ry and Lua" data.8 0
|
|
||||||
about_dialog_window_os_version_string: data.str "fox32os version %u.%u.%u" data.8 0
|
|
||||||
about_dialog_window_rom_version_string: data.str "fox32rom version %u.%u.%u" data.8 0
|
|
|
@ -1,78 +0,0 @@
|
||||||
; file helper routines
|
|
||||||
|
|
||||||
; get a list of FXF files on disk 0
|
|
||||||
; inputs:
|
|
||||||
; none
|
|
||||||
; outputs:
|
|
||||||
; r0: pointer to file name buffer
|
|
||||||
; r1: number of files
|
|
||||||
get_fxf_files:
|
|
||||||
push r2
|
|
||||||
push r31
|
|
||||||
|
|
||||||
; allocate a 341 byte array for the file name buffer
|
|
||||||
mov r0, 341
|
|
||||||
call allocate_memory
|
|
||||||
cmp r0, 0
|
|
||||||
ifz jmp allocate_error
|
|
||||||
mov [all_file_list_ptr], r0
|
|
||||||
|
|
||||||
; read the list of files into the buffer
|
|
||||||
mov r1, 0
|
|
||||||
call ryfs_get_file_list
|
|
||||||
mov [number_of_all_files], r0
|
|
||||||
|
|
||||||
; allocate a 341 byte buffer for the FXF file name buffer
|
|
||||||
mov r0, 341
|
|
||||||
call allocate_memory
|
|
||||||
cmp r0, 0
|
|
||||||
ifz jmp allocate_error
|
|
||||||
mov [fxf_file_list_ptr], r0
|
|
||||||
|
|
||||||
mov r0, [all_file_list_ptr]
|
|
||||||
mov r1, [fxf_file_list_ptr]
|
|
||||||
mov [number_of_fxf_files], 0
|
|
||||||
mov r31, [number_of_all_files]
|
|
||||||
get_fxf_files_loop:
|
|
||||||
push r0
|
|
||||||
push r1
|
|
||||||
add r0, 8
|
|
||||||
mov r1, fxf_ext
|
|
||||||
mov r2, 3
|
|
||||||
call compare_memory_bytes
|
|
||||||
ifnz jmp get_fxf_files_loop_not_fxf
|
|
||||||
inc [number_of_fxf_files]
|
|
||||||
pop r1
|
|
||||||
pop r0
|
|
||||||
mov r2, 11
|
|
||||||
call copy_memory_bytes
|
|
||||||
add r0, 11
|
|
||||||
add r1, 11
|
|
||||||
loop get_fxf_files_loop
|
|
||||||
jmp get_fxf_files_end
|
|
||||||
get_fxf_files_loop_not_fxf:
|
|
||||||
pop r1
|
|
||||||
pop r0
|
|
||||||
add r0, 11
|
|
||||||
loop get_fxf_files_loop
|
|
||||||
get_fxf_files_end:
|
|
||||||
; free the "all files" buffer
|
|
||||||
mov r0, [all_file_list_ptr]
|
|
||||||
call free_memory
|
|
||||||
|
|
||||||
; return pointer to file name buffer and number of files
|
|
||||||
mov r0, [fxf_file_list_ptr]
|
|
||||||
mov r1, [number_of_fxf_files]
|
|
||||||
|
|
||||||
pop r31
|
|
||||||
pop r2
|
|
||||||
ret
|
|
||||||
|
|
||||||
; all files
|
|
||||||
all_file_list_ptr: data.32 0
|
|
||||||
number_of_all_files: data.32 0
|
|
||||||
|
|
||||||
; FXF files only
|
|
||||||
fxf_file_list_ptr: data.32 0
|
|
||||||
number_of_fxf_files: data.32 0
|
|
||||||
fxf_ext: data.str "fxf"
|
|
|
@ -1,76 +0,0 @@
|
||||||
; FXF launcher helper routines
|
|
||||||
|
|
||||||
; launch an FXF binary from a menu item
|
|
||||||
; inputs:
|
|
||||||
; r3: Launcher menu item
|
|
||||||
; outputs:
|
|
||||||
; none, does not return (jumps to `entry` when task ends)
|
|
||||||
launch_fxf:
|
|
||||||
mov r0, menu_items_launcher_list
|
|
||||||
add r0, 3 ; point to the first launcher item string
|
|
||||||
mul r3, 10
|
|
||||||
add r0, r3 ; r0 now points to the name of the FXF file to load
|
|
||||||
|
|
||||||
; copy the name into the launch_fxf_name buffer
|
|
||||||
mov r1, launch_fxf_name
|
|
||||||
mov r2, 8
|
|
||||||
call copy_memory_bytes
|
|
||||||
|
|
||||||
; disable the menu bar
|
|
||||||
call disable_menu_bar
|
|
||||||
|
|
||||||
; open the file
|
|
||||||
mov r0, launch_fxf_name
|
|
||||||
mov r1, 0
|
|
||||||
mov r2, launch_fxf_struct
|
|
||||||
call ryfs_open
|
|
||||||
|
|
||||||
; allocate memory for the binary
|
|
||||||
mov r0, launch_fxf_struct
|
|
||||||
call ryfs_get_size
|
|
||||||
call allocate_memory
|
|
||||||
cmp r0, 0
|
|
||||||
ifz jmp allocate_error
|
|
||||||
mov [launch_fxf_binary_ptr], r0
|
|
||||||
|
|
||||||
; read the file into memory
|
|
||||||
mov r0, launch_fxf_struct
|
|
||||||
mov r1, [launch_fxf_binary_ptr]
|
|
||||||
call ryfs_read_whole_file
|
|
||||||
|
|
||||||
; allocate a 64KiB stack
|
|
||||||
mov r0, 65536
|
|
||||||
call allocate_memory
|
|
||||||
cmp r0, 0
|
|
||||||
ifz jmp allocate_error
|
|
||||||
mov [launch_fxf_stack_ptr], r0
|
|
||||||
|
|
||||||
; relocate the binary
|
|
||||||
mov r0, [launch_fxf_binary_ptr]
|
|
||||||
call parse_fxf_binary
|
|
||||||
|
|
||||||
; create a new task
|
|
||||||
mov r1, r0
|
|
||||||
call get_unused_task_id
|
|
||||||
mov.8 [launch_fxf_task_id], r0
|
|
||||||
mov r2, [launch_fxf_stack_ptr]
|
|
||||||
add r2, 65536 ; point to the end of the stack (stack grows down!!)
|
|
||||||
mov r3, [launch_fxf_binary_ptr]
|
|
||||||
mov r4, [launch_fxf_stack_ptr]
|
|
||||||
call new_task
|
|
||||||
|
|
||||||
; fall-through to launch_fxf_yield_loop
|
|
||||||
|
|
||||||
; loop until the launched task ends
|
|
||||||
launch_fxf_yield_loop:
|
|
||||||
movz.8 r0, [launch_fxf_task_id]
|
|
||||||
call is_task_id_used
|
|
||||||
ifz jmp entry
|
|
||||||
call yield_task
|
|
||||||
rjmp launch_fxf_yield_loop
|
|
||||||
|
|
||||||
launch_fxf_name: data.str " fxf"
|
|
||||||
launch_fxf_struct: data.32 0 data.32 0
|
|
||||||
launch_fxf_task_id: data.8 0
|
|
||||||
launch_fxf_binary_ptr: data.32 0
|
|
||||||
launch_fxf_stack_ptr: data.32 0
|
|
|
@ -1,74 +0,0 @@
|
||||||
; launcher
|
|
||||||
|
|
||||||
entry:
|
|
||||||
; set up the menu bar
|
|
||||||
call enable_menu_bar
|
|
||||||
call clear_menu_bar
|
|
||||||
mov r0, menu_items_root
|
|
||||||
mov r1, 0xFFFFFFFF
|
|
||||||
call draw_menu_bar_root_items
|
|
||||||
|
|
||||||
; open the wallpaper file and draw it
|
|
||||||
mov r0, wallpaper_file_name
|
|
||||||
mov r1, 0
|
|
||||||
mov r2, wallpaper_file_struct
|
|
||||||
call ryfs_open
|
|
||||||
cmp r0, 0
|
|
||||||
ifz jmp skip_wallpaper
|
|
||||||
|
|
||||||
; read the wallpaper file directly into the background framebuffer
|
|
||||||
mov r0, 1228800 ; 640x480x4
|
|
||||||
mov r1, wallpaper_file_struct
|
|
||||||
mov r2, 0x02000000
|
|
||||||
call ryfs_read
|
|
||||||
skip_wallpaper:
|
|
||||||
; build a list of FXF files and add them to the menu
|
|
||||||
call get_fxf_files
|
|
||||||
call add_fxf_files_to_launcher_menu
|
|
||||||
|
|
||||||
event_loop:
|
|
||||||
call get_next_event
|
|
||||||
|
|
||||||
; did the user click the menu bar?
|
|
||||||
cmp r0, EVENT_TYPE_MENU_BAR_CLICK
|
|
||||||
ifz mov r0, menu_items_root
|
|
||||||
ifz call menu_bar_click_event
|
|
||||||
|
|
||||||
; is the user in a menu?
|
|
||||||
cmp r0, EVENT_TYPE_MENU_UPDATE
|
|
||||||
ifz call menu_update_event
|
|
||||||
|
|
||||||
; did the user click a menu item?
|
|
||||||
cmp r0, EVENT_TYPE_MENU_CLICK
|
|
||||||
ifz call menu_click_event
|
|
||||||
|
|
||||||
call yield_task
|
|
||||||
jmp event_loop
|
|
||||||
|
|
||||||
quit_launcher:
|
|
||||||
call disable_menu_bar
|
|
||||||
call end_current_task
|
|
||||||
jmp hang
|
|
||||||
|
|
||||||
allocate_error:
|
|
||||||
mov r0, allocate_error_str
|
|
||||||
mov r1, 16
|
|
||||||
mov r2, 32
|
|
||||||
mov r3, 0xFFFFFFFF
|
|
||||||
mov r4, 0xFF000000
|
|
||||||
call draw_str_to_background
|
|
||||||
hang:
|
|
||||||
rjmp hang
|
|
||||||
allocate_error_str: data.str "error while allocating memory" data.8 0
|
|
||||||
|
|
||||||
wallpaper_file_name: data.str "wallpaprraw"
|
|
||||||
wallpaper_file_struct: data.32 0 data.32 0
|
|
||||||
|
|
||||||
#include "about.asm"
|
|
||||||
#include "file.asm"
|
|
||||||
#include "launch.asm"
|
|
||||||
#include "menu.asm"
|
|
||||||
|
|
||||||
; include system defs
|
|
||||||
#include "../../fox32rom/fox32rom.def"
|
|
||||||
#include "../fox32os.def"
|
|
|
@ -1,111 +0,0 @@
|
||||||
; menu bar helper routines
|
|
||||||
|
|
||||||
; add all FXF files to the Launcher menu
|
|
||||||
; THIS FREES [r0], ONLY CALL THIS ONCE
|
|
||||||
; inputs:
|
|
||||||
; r0: pointer to file name buffer
|
|
||||||
; r1: number of files
|
|
||||||
; outputs:
|
|
||||||
; none
|
|
||||||
add_fxf_files_to_launcher_menu:
|
|
||||||
push r0
|
|
||||||
push r1
|
|
||||||
push r2
|
|
||||||
push r31
|
|
||||||
|
|
||||||
mov r31, r1
|
|
||||||
mov r1, menu_items_launcher_list
|
|
||||||
mov.8 [r1], r31 ; set number of items
|
|
||||||
add r1, 3 ; point to first string
|
|
||||||
mov r2, 8 ; copy 8 bytes each
|
|
||||||
add_fxf_files_to_launcher_menu_loop:
|
|
||||||
call copy_memory_bytes
|
|
||||||
add r0, 11 ; point to next file name
|
|
||||||
add r1, 10 ; point to next menu item string
|
|
||||||
loop add_fxf_files_to_launcher_menu_loop
|
|
||||||
|
|
||||||
pop r31
|
|
||||||
pop r2
|
|
||||||
pop r1
|
|
||||||
pop r0
|
|
||||||
call free_memory
|
|
||||||
ret
|
|
||||||
|
|
||||||
menu_click_event:
|
|
||||||
; r2 contains the clicked root menu
|
|
||||||
; r3 contains the clicked menu item
|
|
||||||
|
|
||||||
; system
|
|
||||||
cmp r2, 0
|
|
||||||
ifz jmp system_menu_click_event
|
|
||||||
|
|
||||||
; launcher
|
|
||||||
cmp r2, 1
|
|
||||||
ifz jmp launch_fxf
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
system_menu_click_event:
|
|
||||||
; r2 contains the clicked root menu
|
|
||||||
; r3 contains the clicked menu item
|
|
||||||
|
|
||||||
; about
|
|
||||||
cmp r3, 0
|
|
||||||
ifz jmp about_dialog
|
|
||||||
|
|
||||||
; quit launcher
|
|
||||||
cmp r3, 1
|
|
||||||
ifz jmp quit_launcher
|
|
||||||
|
|
||||||
; shut down
|
|
||||||
cmp r3, 2
|
|
||||||
ifz icl
|
|
||||||
ifz halt
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
menu_items_root:
|
|
||||||
data.8 2 ; number of menus
|
|
||||||
data.32 menu_items_system_list data.32 menu_items_system_name ; pointer to menu list, pointer to menu name
|
|
||||||
data.32 menu_items_launcher_list data.32 menu_items_launcher_name ; pointer to menu list, pointer to menu name
|
|
||||||
menu_items_system_name:
|
|
||||||
data.8 6 data.str "System" data.8 0x00 ; text length, text, null-terminator
|
|
||||||
menu_items_launcher_name:
|
|
||||||
data.8 8 data.str "Launcher" data.8 0x00 ; text length, text, null-terminator
|
|
||||||
menu_items_system_list:
|
|
||||||
data.8 3 ; number of items
|
|
||||||
data.8 15 ; menu width (usually longest item + 2)
|
|
||||||
data.8 5 data.str "About" data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 13 data.str "Quit Launcher" data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 9 data.str "Shut Down" data.8 0x00 ; text length, text, null-terminator
|
|
||||||
menu_items_launcher_list: ; reserve enough room for up to 28 items
|
|
||||||
data.8 1 ; number of items
|
|
||||||
data.8 10 ; menu width (usually longest item + 2)
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
||||||
data.8 8 data.str " " data.8 0x00 ; text length, text, null-terminator
|
|
Binary file not shown.
Before Width: | Height: | Size: 535 KiB |
Loading…
Reference in New Issue
Block a user