-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get started on writing Jackal bindings
- Loading branch information
Showing
2 changed files
with
207 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
EXTERN FN ScancodeToAscii( | ||
IN scancode: UBYTE, | ||
): UBYTE | ||
EXTERN FN ShiftPressed() | ||
EXTERN FN ShiftReleased() | ||
EXTERN FN CapsPressed() | ||
|
||
EXTERN FN FillOverlay( | ||
IN color: UWORD, | ||
IN overlay: UBYTE, | ||
) | ||
EXTERN FN DrawStrToOverlay( | ||
IN str: ^UBYTE, | ||
IN x: UWORD, | ||
IN y: UWORD, | ||
IN fgColor: UWORD, | ||
IN bgColor: UWORD, | ||
IN overlay: UBYTE, | ||
) | ||
|
||
EXTERN FN MenuBarClickEvent( | ||
IN rootStruct: ^VOID, | ||
IN x: UWORD, | ||
) | ||
EXTERN FN CloseMenu( | ||
IN rootStruct: ^VOID, | ||
) | ||
EXTERN FN MenuUpdateEvent( | ||
IN rootStruct: ^VOID, | ||
IN selectedRootItem: UWORD, | ||
IN hoveringItem: UWORD, | ||
) | ||
|
||
EXTERN FN CopyMemory( | ||
IN source: ^VOID, | ||
IN destination: ^VOID, | ||
IN length: UWORD, | ||
) | ||
EXTERN FN CopyString( | ||
IN source: ^VOID, | ||
IN destination: ^VOID, | ||
) | ||
EXTERN FN CompareMemory( | ||
IN source: ^VOID, | ||
IN destination: ^VOID, | ||
IN length: UWORD, | ||
): UBYTE | ||
EXTERN FN CompareString( | ||
IN source: ^UBYTE, | ||
IN destination: ^UBYTE, | ||
): UBYTE | ||
EXTERN FN StringLength( | ||
IN str: ^UBYTE, | ||
): UWORD | ||
|
||
EXTERN FN IsRomDiskAvailable(): UBYTE | ||
EXTERN FN IsRamDiskFormatted(): UBYTE | ||
|
||
// event types | ||
#DEFINE EVENT_TYPE_MOUSE_CLICK 0x00000000 | ||
#DEFINE EVENT_TYPE_MOUSE_RELEASE 0x00000001 | ||
#DEFINE EVENT_TYPE_KEY_DOWN 0x00000002 | ||
#DEFINE EVENT_TYPE_KEY_UP 0x00000003 | ||
#DEFINE EVENT_TYPE_MENU_BAR_CLICK 0x00000004 | ||
#DEFINE EVENT_TYPE_MENU_UPDATE 0x00000005 | ||
#DEFINE EVENT_TYPE_MENU_CLICK 0x00000006 | ||
#DEFINE EVENT_TYPE_MENU_ACK 0x00000007 | ||
#DEFINE EVENT_TYPE_EMPTY 0xFFFFFFFF | ||
|
||
// keys | ||
#DEFINE KEY_CTRL 0x1D | ||
#DEFINE KEY_LSHIFT 0x2A | ||
#DEFINE KEY_RSHIFT 0x36 | ||
#DEFINE KEY_CAPS 0x3A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
// fox32rom routine definitions for Jackal | ||
|
||
#ASM [ | ||
// fox32rom routine definitions | ||
|
||
// system jump table | ||
scancode_to_ascii: jmp [0xF0040020] | ||
shift_pressed: jmp [0xF0040024] | ||
shift_released: jmp [0xF0040028] | ||
caps_pressed: jmp [0xF004002C] | ||
|
||
// overlay jump table | ||
fill_overlay: jmp [0xF0043000] | ||
draw_str_to_overlay: jmp [0xF0043004] | ||
|
||
// menu bar jump table | ||
menu_bar_click_event: jmp [0xF0044008] | ||
close_menu: jmp [0xF0044018] | ||
menu_update_event: jmp [0xF004401C] | ||
|
||
// disk jump table | ||
is_romdisk_available: jmp [0xF0045028] | ||
is_ramdisk_formatted: jmp [0xF0045038] | ||
|
||
// memory copy/compare jump table | ||
copy_memory_bytes: jmp [0xF0046000] | ||
copy_string: jmp [0xF0046008] | ||
compare_memory_bytes: jmp [0xF004600C] | ||
compare_string: jmp [0xF0046014] | ||
string_length: jmp [0xF0046018] | ||
|
||
// integer jump table | ||
string_to_int: jmp [0xF0047000] | ||
|
||
|
||
|
||
// implmentations | ||
|
||
ScancodeToAscii: | ||
.global ScancodeToAscii | ||
mov r0, a0 | ||
call scancode_to_ascii | ||
mov a3, r0 | ||
ret | ||
ShiftPressed: | ||
.global ShiftPressed | ||
jmp shift_pressed | ||
ShiftReleased: | ||
.global ShiftReleased | ||
jmp shift_released | ||
CapsPressed: | ||
.global CapsPressed | ||
jmp caps_pressed | ||
|
||
FillOverlay: | ||
.global FillOverlay | ||
mov r0, a0 | ||
mov r1, a1 | ||
jmp fill_overlay | ||
DrawStrToOverlay: | ||
.global DrawStrToOverlay | ||
mov r0, a0 | ||
mov r1, a1 | ||
mov r2, a2 | ||
mov r3, a3 | ||
mov r4, [rsp+4] | ||
mov r5, [rsp+8] | ||
jmp draw_str_to_overlay | ||
|
||
MenuBarClickEvent: | ||
.global MenuBarClickEvent | ||
mov r0, a0 | ||
mov r1, a1 | ||
jmp menu_bar_click_event | ||
CloseMenu: | ||
.global CloseMenu | ||
mov r0, a0 | ||
jmp close_menu | ||
MenuUpdateEvent: | ||
.global MenuUpdateEvent | ||
mov r0, a0 | ||
mov r1, a1 | ||
mov r2, a2 | ||
jmp menu_update_event | ||
|
||
IsRomDiskAvailable: | ||
.global IsRomDiskAvailable | ||
call is_romdisk_available | ||
ifz movz.8 a3, 1 | ||
ifnz movz.8 a3, 0 | ||
ret | ||
IsRamDiskFormatted: | ||
.global IsRamDiskFormatted | ||
call is_ramdisk_formatted | ||
ifz movz.8 a3, 1 | ||
ifnz movz.8 a3, 0 | ||
ret | ||
|
||
CopyMemory: | ||
.global CopyMemory | ||
mov r0, a0 | ||
mov r1, a1 | ||
mov r2, a2 | ||
jmp copy_memory_bytes | ||
CopyString: | ||
.global CopyString | ||
mov r0, a0 | ||
mov r1, a1 | ||
jmp copy_string | ||
CompareMemory: | ||
.global CompareMemory | ||
mov r0, a0 | ||
mov r1, a1 | ||
mov r2, a2 | ||
call compare_memory_bytes | ||
ifz movz.8 a3, 1 | ||
ifnz movz.8 a3, 0 | ||
ret | ||
CompareString: | ||
.global CompareString | ||
mov r0, a0 | ||
mov r1, a1 | ||
call compare_string | ||
ifz movz.8 a3, 1 | ||
ifnz movz.8 a3, 0 | ||
ret | ||
StringLength: | ||
.global StringLength | ||
mov r0, a0 | ||
call string_length | ||
mov a3, r0 | ||
ret | ||
] |