diff --git a/applications/launcher/main.asm b/applications/launcher/main.asm index 66700aa..d8bc01f 100644 --- a/applications/launcher/main.asm +++ b/applications/launcher/main.asm @@ -65,7 +65,12 @@ button_click_event: ; terminal cmp r1, 0 ifz mov r0, terminal_button_fxf - ifz call launch_fxf + ifz mov r1, 0 + ifz mov r2, 0 + ifz mov r3, 0 + ifz mov r4, 0 + ifz mov r5, 0 + ifz call launch_fxf_from_disk ret @@ -101,7 +106,5 @@ button_text: data.strz " " icons: #include "icons.inc" - #include "launch.asm" - #include "../../../fox32rom/fox32rom.def" #include "../../fox32os.def" diff --git a/fox32os.def b/fox32os.def index cd12f41..4c26c00 100644 --- a/fox32os.def +++ b/fox32os.def @@ -8,6 +8,7 @@ set_current_disk_id: jmp [0x0000081C] ; FXF jump table parse_fxf_binary: jmp [0x00000910] +launch_fxf_from_disk: jmp [0x00000914] ; task jump table new_task: jmp [0x00000A10] diff --git a/kernel/fxf/fxf.asm b/kernel/fxf/fxf.asm index 981eea5..f44e0f2 100644 --- a/kernel/fxf/fxf.asm +++ b/kernel/fxf/fxf.asm @@ -20,6 +20,7 @@ parse_fxf_binary: fxf_magic: data.strz "FXF" + #include "fxf/launch.asm" #include "fxf/reloc.asm" const FXF_CODE_SIZE: 0x00000004 diff --git a/applications/launcher/launch.asm b/kernel/fxf/launch.asm similarity index 68% rename from applications/launcher/launch.asm rename to kernel/fxf/launch.asm index b8da109..fc41f8d 100644 --- a/applications/launcher/launch.asm +++ b/kernel/fxf/launch.asm @@ -1,11 +1,16 @@ -; FXF launcher helper routines +; FXF launching routines -; launch an FXF binary from a file name +; launch an FXF binary from a file on disk ; inputs: -; r0: pointer to FXF binary name +; r0: pointer to FXF binary name (8.3 format, for example "testfile.fxf" or "test.fxf") +; r1: argument 0 +; r2: argument 1 +; r3: argument 2 +; r4: argument 3 +; r5: argument 4 ; outputs: ; none -launch_fxf: +launch_fxf_from_disk: push r0 push r1 push r2 @@ -39,6 +44,19 @@ launch_fxf: ifz jmp allocate_error mov [launch_fxf_stack_ptr], r0 + ; push the arguments to the task's stack + mov r4, rsp + mov rsp, [launch_fxf_stack_ptr] + add rsp, 65536 ; point to the end of the stack (stack grows down!!) + push r5 + push r4 + push r3 + push r2 + push r1 + sub rsp, 65516 + mov [launch_fxf_stack_ptr], rsp + mov rsp, r4 + ; relocate the binary mov r0, [launch_fxf_binary_ptr] call parse_fxf_binary diff --git a/kernel/main.asm b/kernel/main.asm index acb6240..d1d93aa 100644 --- a/kernel/main.asm +++ b/kernel/main.asm @@ -27,6 +27,7 @@ jump_table: ; FXF jump table org.pad 0x00000110 data.32 parse_fxf_binary + data.32 launch_fxf_from_disk ; task jump table org.pad 0x00000210