Skip to content

Commit

Permalink
fetcher: Add RAM disk icon to desktop, and rename disk 4 to ROM disk
Browse files Browse the repository at this point in the history
  • Loading branch information
ry755 committed May 5, 2024
1 parent a82f002 commit 2c2f017
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 7 deletions.
7 changes: 6 additions & 1 deletion applications/fetcher/Browser.okm
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@ MODULE Browser;
VAR tempDskIconResPtr: PTR;
BEGIN
(* first, before we do anything, check to make sure the selected disk is available *)
IF diskId >| 4 THEN
IF diskId >| 5 THEN
new_messagebox(0, "Invalid disk ID!", 0, 128, 128, 144);
end_current_task();
ELSIF diskId = 4 THEN
IF IsRomDiskAvailable() = 0 THEN
new_messagebox(0, "ROM disk not available!", 0, 128, 128, 200);
end_current_task();
END;
ELSIF diskId = 5 THEN
IF IsRamDiskFormatted() = 0 THEN
new_messagebox(0, "RAM disk not formatted!", 0, 128, 128, 200);
end_current_task();
END;
ELSE
IF PortIn(080001000H OR diskId) = 0 THEN
new_messagebox(0, "Disk not inserted!", 0, 128, 128, 160);
Expand Down
7 changes: 6 additions & 1 deletion applications/fetcher/BrowserOpen.okm
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@ MODULE BrowserOpen;
browserOpenReturnDiskIdPtr := returnDiskId;

(* first, before we do anything, check to make sure the selected disk is available *)
IF browserDiskId >| 4 THEN
IF browserDiskId >| 5 THEN
new_messagebox(0, "Invalid disk ID!", 0, 128, 128, 144);
end_current_task();
ELSIF browserDiskId = 4 THEN
IF IsRomDiskAvailable() = 0 THEN
new_messagebox(0, "ROM disk not available!", 0, 128, 128, 200);
end_current_task();
END;
ELSIF browserDiskId = 5 THEN
IF IsRamDiskFormatted() = 0 THEN
new_messagebox(0, "RAM disk not formatted!", 0, 128, 128, 200);
end_current_task();
END;
ELSE
IF PortIn(080001000H OR browserDiskId) = 0 THEN
new_messagebox(0, "Disk not inserted!", 0, 128, 128, 160);
Expand Down
21 changes: 17 additions & 4 deletions applications/fetcher/Desktop.okm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ MODULE Desktop;

VAR desktopRunning: CHAR;
desktopWindow: ARRAY WINDOW_STRUCT_SIZE OF CHAR;
desktopIcons: ARRAY 5 OF Fox32OSButtonWidget;
desktopIcons: ARRAY 6 OF Fox32OSButtonWidget;
desktopDiskIcon: ARRAY 4096 OF CHAR;

PROCEDURE DesktopMain(hasIcons: CHAR; iconsResPtr: PTR;);
Expand Down Expand Up @@ -83,7 +83,7 @@ MODULE Desktop;
(* set the tilemap and draw the icons! *)
set_tilemap(PTROF(desktopDiskIcon), 32, 32);
overlay := get_window_overlay_number(desktopWin);
i := 5;
i := 6;
y := 16;
WHILE i DO
draw_tile_to_overlay(0, 592, y, overlay);
Expand Down Expand Up @@ -150,9 +150,22 @@ MODULE Desktop;
prevDesktopIcon := desktopIcon;
desktopIcon := PTROF(desktopIcons[4]);
desktopIcon^.type := WIDGET_TYPE_BUTTON;
desktopIcon^.next := 0;
desktopIcon^.next := PTROF(desktopIcons[5]);
desktopIcon^.id := 4;
desktopIcon^.text := "Disk 4";
desktopIcon^.text := "ROM Disk";
desktopIcon^.fgColor := 0FF000000H;
desktopIcon^.bgColor := 0FFFFFFFFH;
desktopIcon^.width := 32;
desktopIcon^.height := 32 + 16;
desktopIcon^.x := 592;
desktopIcon^.y := prevDesktopIcon^.y + 32 + 32;

prevDesktopIcon := desktopIcon;
desktopIcon := PTROF(desktopIcons[5]);
desktopIcon^.type := WIDGET_TYPE_BUTTON;
desktopIcon^.next := 0;
desktopIcon^.id := 5;
desktopIcon^.text := "RAM Disk";
desktopIcon^.fgColor := 0FF000000H;
desktopIcon^.bgColor := 0FFFFFFFFH;
desktopIcon^.width := 32;
Expand Down
2 changes: 1 addition & 1 deletion applications/fetcher/OS.okm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ MODULE OS;
save_state_and_yield_task, start_dragging_window, handle_widget_click, fill_window, fill_overlay,
set_window_flags, menu_update_event, menu_bar_click_event, close_menu, new_messagebox, get_current_disk_id,
launch_fxf_from_disk, get_boot_disk_id, string_to_int, set_tilemap, draw_tile_to_overlay,
ryfs_get_file_list, copy_memory_bytes, IsRomDiskAvailable, end_current_task, sleep_task, CompareString,
ryfs_get_file_list, copy_memory_bytes, IsRomDiskAvailable, IsRamDiskFormatted, end_current_task, sleep_task, CompareString,
open, read, get_size, get_boot_disk_id, get_resource, allocate_memory, free_memory, string_length, copy_string: INT;

EXTERN PROCEDURE brk: INT;
Expand Down
6 changes: 6 additions & 0 deletions applications/fetcher/start.asm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ IsRomDiskAvailable:
ifnz mov r0, 0
ret

IsRamDiskFormatted:
call is_ramdisk_formatted
ifz mov r0, 1
ifnz mov r0, 0
ret

CompareString:
call compare_string
ifz mov r0, 1
Expand Down

0 comments on commit 2c2f017

Please sign in to comment.