"bos.inc" documentation

"bos.DONOTHING" is a no-op and does nothing,
As the name implies.
syscall namesyscall adress
bos.boot_os 020108
bos.handle_interrupt02010C
bos.HandleInstruction 020110
bos.sc_HandleSysCall 020114
bos.DONOTHING 020118
bos.handle_offsetinstruction 02011C
bos.DONOTHING 020120
bos.sys_ExecuteFile022400
bos.os_GetOSInfo022404
bos.fs_OpenFile022408
bos.fs_GetSectorAddress02240C
bos.fs_CheckDirExists022410
bos.fs_CeilDivBySector022414
bos.fs_CopyFileName022418
bos.fs_Read02241C
bos.fs_Write022420
bos.sys_AddHLAndA022424
bos.sys_AnyKey022428
bos.sys_FreeAll02242C
bos.sys_GetKey022430
bos.sys_KbScan022434
bos.sys_Malloc022438
bos.fs_CreateRamFile02243C
bos.sys_MemSet022440
bos.fs_AllocRam022444
bos.sys_WaitKey022448
bos.sys_WaitKeyCycle02244C
bos.gui_DrawConsoleWindow022450
bos.gui_Input022454
bos.gui_NewLine022458
bos.gui_Print02245C
bos.gui_PrintInt022460
bos.gui_Scroll022464
bos.gfx_BlitBuffer022468
bos.gfx_PrintString02246C
bos._MemClear022470
bos._PushOP1022474
bos._PopOP1022478
bos._Mov9ToOP102247C
bos._CpHLDE022480
bos._Mov8b022484
bos._ChkFindSym022488
bos._LoadDEInd_s02248C
bos._EnoughMem022490
bos._InsertMem022494
bos._SetHLUTo0022498
bos._PutS02249C
bos._GetCSC0224A0
bos._NewLine0224A4
bos._ClrScrn0224A8
bos._HomeUp0224AC
bos._ErrMemory0224B0
bos._DrawStatusBar0224B4
bos._os_GetSystemInfo0224B8
bos._UsbPowerVbus0224BC
bos._UsbUnpowerVbus0224C0
bos.sys_EraseFlashSector0224C4
bos.sys_FlashUnlock0224C8
bos.sys_FlashLock0224CC
bos.fs_CreateFile0224D0
bos.strupper0224D4
bos.strlower0224D8
bos.fs_AbsPath0224DC
bos.fs_MultByBytesPerSector0224E0
bos._LoadLibraryOP10224E4
bos.fs_OpenFileInDir0224E8
bos.fs_SetSize0224EC
bos.fs_WriteFile0224F0
bos.sys_HLToString0224F4
bos.fs_DeleteFile0224F8
bos._DelVar0224FC
bos._CreateVar022500
bos.gui_InputNoClear022504
bos.fs_InitClusterMap022508
bos.sys_WriteFlash02250C
bos.sys_WriteFlashA022510
bos.sys_JoinArgv022514
bos.fs_PathLen022518
bos.fs_ParentDir02251C
bos.fs_StrToFileEntry022520
bos.fs_DirList022524
bos.sys_Free022528
bos.sys_CallExecuteFile02252C
bos.sys_JumpExecuteFile022530
bos.sys_OpenDevice022534
bos.fs_CopyFile022538
bos.DONOTHING02253C
bos.DONOTHING022540
bos.DONOTHING022544
bos.fs_GetSector022548
bos.fs_WriteByte02254C
bos.fs_RenameFile022550
bos._SetCursorPos022554
bos.fs_CreateDir022558
bos.gfx_BufClear02255C
bos.gfx_LcdClear022560
bos.fs_SanityCheck022564
bos.sys_SetOnInterruptHandler022568
bos.gui_PrintChar02256C
bos.gfx_SetDraw022570
bos.gui_PrintString022574
bos.gui_PrintLine022578
bos.gui_PrintUInt02257C
bos.DONOTHING 022580
bos.DONOTHING 022584
bos.fs_GetFilePtrRaw022588
bos.DONOTHING 02258C
bos.sys_ExecuteFileHL022590
bos.sys_TurnOff022594
bos.sys_NextProcessId022598
bos.sys_PrevProcessId02259C
bos.sys_FreeProcessId0225A0
bos.fs_GarbageCollect0225A4
bos.gfx_SwapTextColors0225A8
bos.fs_WriteNewFile0225AC
bos.gfx_SetFont0225B0
bos.gfx_SetDefaultFont0225B4
bos.sys_FreeRunningProcessId0225B8
bos.util_Zx7Decompress0225BC
bos.sys_CheckMallocRAM0225C0
bos.gfx_Compute0225C4
bos.gfx_FillRectangle0225C8
bos.gfx_FillScreen0225CC
bos.gfx_GetFontPtr0225D0
bos.gfx_HorizLine0225D4
bos.gfx_InitStdPalette0225D8
bos.gfx_NextLine0225DC
bos.gfx_PrintChar0225E0
bos.gfx_PrintHexA0225E4
bos.gfx_PrintUInt0225E8
bos.gfx_Rectangle0225EC
bos.gfx_Set8bpp0225F0
bos.gfx_Set16bpp0225F4
bos.gfx_SetTextXY0225F8
bos.gfx_Sprite0225FC
bos.gfx_Sprite2x022600
bos.gfx_VertLine022604
bos.sys_Malloc32Align32022608
bos.sys_Malloc64Align25602260C
bos.gfx_PrintStringXY022610
bos.gfx_GetTextX022614
bos.gfx_GetTextY022618
bos.DONOTHING 02261C
bos.DONOTHING 022620
bos.sys_OpenFileInPath022624
bos.sys_VarString022628
bos.fs_GetFreeSpace02262C
bos.fs_GetFDPtrRaw022630
bos.fs_GetFDLenRaw022634
bos._OP1ToPath022638
bos.th_WaitKeyCycle02263C
bos.fs_JoinPath022640
bos.sys_MallocPersistent022644
bos.sys_OpenFileInVar022648
bos.fs_BaseName02264C
bos.fs_MoveFile022650
bos.fs_WriteDirectly022654
bos._UnpackUpdates022658
bos.sys_ReadSectorCache02265C
bos.sys_WriteSectorCache022660
bos.sys_OpenFileInLib022664
bos.sys_LoadHookThreads022668
bos.gfx_BlitScreen02266C
bos.th_CreateThread022670
bos.gfx_ZeroVRAM022674
bos.th_KillThread022678
bos.fs_GetFilePtr02267C
bos.fs_GetFDPtr022680
bos.fs_GetFDLen022684
bos.fs_ArcUnarcFD022688
bos.util_Zx0Decompress02268C
bos.sys_WaitKeyUnpress022690
bos.sys_MallocDupStr022694
bos.sys_MallocDupStrN022698
bos._SearchSymTable02269C
bos.fs_Rename0226A0
bos.fs_AllocChk0226A4
bos.sys_GetExecType0226A8
bos.sys_GetExecTypeFD0226AC
bos.util_Zx7Compress0226B0
bos.sys_OpenRecoveryMenu0226B4
bos.util_Relocate0226B8
bos.fs_GetFDAttr0226BC
bos.util_InitAllocSymList0226C0
bos.util_AppendSymList0226C4
bos.util_RemoveFromSymList0226C8
bos.util_SearchSymList0226CC
bos.util_FreeSymList0226D0
bos.sys_Exec0226D4
bos.sys_ExecV0226D8
bos.sys_ExecData0226DC
bos.sys_ExecBegin0226E0
bos.sys_ExecContinue0226E4

boot_os

syscall Adress 020108

What it doesInputsOutputsDestroysNotes

handle_interrupt

syscall Adress 02010C

What it doesInputsOutputsDestroysNotes

HandleInstruction

syscall Adress 020110

What it doesInputsOutputsDestroysNotes

sc_HandleSysCall

syscall Adress 020114

What it doesInputsOutputsDestroysNotes

handle_offsetinstruction

syscall Adress 02011C

What it doesInputsOutputsDestroysNotes

sys_ExecuteFile

syscall Adress 022400

What it doesInputsOutputsDestroysNotes
Execute a file.int32_t sys_ExecuteFile(const char *path, char *args);-1 and Cf set if file does not exist or is not a valid executable format, or if malloc failed somewhere.
ExecutingFileFd set to point to file descriptor. -1 if file not found, -2 if /var/PATH not found.

os_GetOSInfo

syscall Adress 022404

What it doesInputsOutputsDestroysNotes

fs_OpenFile

syscall Adress 022408

What it doesInputsOutputsDestroysNotes
Opens a file from a path and returns file descriptor.void *fs_OpenFile(char *path);hl = file descriptor. hl is -1 and Cf set if file does not exist.

fs_GetSectorAddress

syscall Adress 02240C

What it doesInputsOutputsDestroysNotes
get the memory address of a given sector address.void *fs_GetSectorAddress(uint16_t sector);

fs_CheckDirExists

syscall Adress 022410

What it doesInputsOutputsDestroysNotes
check if a directory exists.bool fs_CheckDirExists(char *path);true if path exists, else false

fs_CeilDivBySector

syscall Adress 022414

What it doesInputsOutputsDestroysNotes
divide by sector size, adding 1 to the result if there is a remainder. Returns 1 if HL is 0HL = number to divideHL = result

fs_CopyFileName

syscall Adress 022418

What it doesInputsOutputsDestroysNotes
copies file name from file descriptorchar *fs_CopyFileName(void *fd);returns -1 on fail Allocates space for copied file name

fs_Read

syscall Adress 02241C

What it doesInputsOutputsDestroysNotes
read data from a file into RAMint fs_Read(void *dest, int len, uint8_t count, void *fd, int offset);number of bytes read

fs_Write

syscall Adress 022420

What it doesInputsOutputsDestroysNotes
write data to a filevoid *fs_Write(void *data, int len, uint8_t count, void *fd, int offset);New file descriptor or -1 and Cf set if failed.

sys_AddHLAndA

syscall Adress 022424

What it doesInputsOutputsDestroysNotes
HL+=AHL number
A increment
HL number+increment

sys_AnyKey

syscall Adress 022428

What it doesInputsOutputsDestroysNotes
Scans the keypad and updates data registers; checking if a key was pressed0 if no keys pressed

sys_FreeAll

syscall Adress 02242C

What it doesInputsOutputsDestroysNotes
Free all memory malloc'd by sys_Mallocvoid sys_FreeAll(void);

sys_GetKey

syscall Adress 022430

What it doesInputsOutputsDestroysNotes
Return current keypressA keypress
z if no key pressed

sys_KbScan

syscall Adress 022434

What it doesInputsOutputsDestroysNotes
Scans the keypad and updates data registers

sys_Malloc

syscall Adress 022438

What it doesInputsOutputsDestroysNotes
Allocate memoryvoid *sys_Malloc(size_t amt);hl = malloc'd bytes. hl = 0 if failed to malloc
Cf set if failed to malloc

fs_CreateRamFile

syscall Adress 02243C

What it doesInputsOutputsDestroysNotes
Create a file descriptor with contents stored in RAM.fs_CreateRamFile(const char *path, uint8_t flags, void *data, size_t len);HL = file descriptor or HL=0 and Cf set if failed.

sys_MemSet

syscall Adress 022440

What it doesInputsOutputsDestroysNotes
draws a horizontal line to the current bufferHL line X coordinate
E line Y coordinate
BC line length

fs_AllocRam

syscall Adress 022444

What it doesInputsOutputsDestroysNotes

sys_WaitKey

syscall Adress 022448

What it doesInputsOutputsDestroysNotes
Wait until a key is pressed and return it

sys_WaitKeyCycle

syscall Adress 02244C

What it doesInputsOutputsDestroysNotes
Wait until a key is pressed, then wait until it's released, then return the keycodeA = keycode

gui_DrawConsoleWindow

syscall Adress 022450

What it doesInputsOutputsDestroysNotes
clear the screen and display a stringhl = string

gui_Input

syscall Adress 022454

What it doesInputsOutputsDestroysNotes
get user inputuint8_t gui_Input(char *buffer, int max_len);0 if user exit, 1 if user enter, 9/12 if user presses down/up arrow key

gui_NewLine

syscall Adress 022458

What it doesInputsOutputsDestroysNotes

gui_Print

syscall Adress 02245C

What it doesInputsOutputsDestroysNotes

gui_PrintInt

syscall Adress 022460

What it doesInputsOutputsDestroysNotes
Print an integer. Does not swap buffers.hl = integer

gui_Scroll

syscall Adress 022464

What it doesInputsOutputsDestroysNotes

gfx_BlitBuffer

syscall Adress 022468

What it doesInputsOutputsDestroysNotes

gfx_PrintString

syscall Adress 02246C

What it doesInputsOutputsDestroysNotes

_MemClear

syscall Adress 022470

What it doesInputsOutputsDestroysNotes
Clear (Zero) BC bytes at HL

_PushOP1

syscall Adress 022474

What it doesInputsOutputsDestroysNotes

_PopOP1

syscall Adress 022478

What it doesInputsOutputsDestroysNotes

_Mov9ToOP1

syscall Adress 02247C

What it doesInputsOutputsDestroysNotes
move 9 bytes from HL to OP1

_CpHLDE

syscall Adress 022480

What it doesInputsOutputsDestroysNotes
compare HL to DE. Returns the resultant of "sbc hl,de" without modifying either.

_Mov8b

syscall Adress 022484

What it doesInputsOutputsDestroysNotes
copy 8 bytes from HL to DE

_ChkFindSym

syscall Adress 022488

What it doesInputsOutputsDestroysNotes
Search for a TI variable in directories listed by $TIVARSOP1 containing 1 byte var type, 8 byte file nameHL = pointer to 2 byte file length
DE = pointer to file data
Cf set if file not found or otherwise cannot be opened.

_LoadDEInd_s

syscall Adress 02248C

What it doesInputsOutputsDestroysNotes
load DE with 16-bit value at HL, advancing HL+=2

_EnoughMem

syscall Adress 022490

What it doesInputsOutputsDestroysNotes
Check if there are HL bytes avalible in userMem

_InsertMem

syscall Adress 022494

What it doesInputsOutputsDestroysNotes
insert HL bytes into a ram file at address DEhl = bytes to insert, de = address to insert athl = new end of file, de = pointer to the space inserted

_SetHLUTo0

syscall Adress 022498

What it doesInputsOutputsDestroysNotes

_PutS

syscall Adress 02249C

What it doesInputsOutputsDestroysNotes
Print a string to the current cursor position and blit the buffer when finished.HL = string

_GetCSC

syscall Adress 0224A0

What it doesInputsOutputsDestroysNotes
Get the current keypress and return it in A

_NewLine

syscall Adress 0224A4

What it doesInputsOutputsDestroysNotes

_ClrScrn

syscall Adress 0224A8

What it doesInputsOutputsDestroysNotes
Clear the screen and back buffer

_HomeUp

syscall Adress 0224AC

What it doesInputsOutputsDestroysNotes
Set the cursor position to 0,0

_ErrMemory

syscall Adress 0224B0

What it doesInputsOutputsDestroysNotes
Display a memory error message

_DrawStatusBar

syscall Adress 0224B4

What it doesInputsOutputsDestroysNotes
Clear the screen and display the current working directory.

_os_GetSystemInfo

syscall Adress 0224B8

What it doesInputsOutputsDestroysNotes
return system info. Compatibility define. It actually returns 0xFF0000. lol

_UsbPowerVbus

syscall Adress 0224BC

What it doesInputsOutputsDestroysNotes
I honestly don't know. Included this routine for compatibility with USBDDRVCE.

_UsbUnpowerVbus

syscall Adress 0224C0

What it doesInputsOutputsDestroysNotes
I honestly don't know. Included for compatibility with USBDRVCE.

sys_EraseFlashSector

syscall Adress 0224C4

What it doesInputsOutputsDestroysNotes
Erase flash sectorA sector to erase calls boot routine $2DC

sys_FlashUnlock

syscall Adress 0224C8

What it doesInputsOutputsDestroysNotes

sys_FlashLock

syscall Adress 0224CC

What it doesInputsOutputsDestroysNotes

fs_CreateFile

syscall Adress 0224D0

What it doesInputsOutputsDestroysNotes
Create a file given a path and return a file descriptor.void *fs_CreateFile(const char *path, uint8_t flags, int len);file descriptor. Returns 0 if failed to create file. if len is zero, the file data section will not be initialized.
if len is greater than 65536, this routine fails.

strupper

syscall Adress 0224D4

What it doesInputsOutputsDestroysNotes
convert a string to uppercaseHL pointer to stringHL HL+strlen(HL)

strlower

syscall Adress 0224D8

What it doesInputsOutputsDestroysNotes
convert a string to lowercaseHL pointer to stringHL HL+strlen(HL)

fs_AbsPath

syscall Adress 0224DC

What it doesInputsOutputsDestroysNotes
get absolute path representation of hlchar *fs_AbsPath(const char *path);hl = absolute path. Will be the same as the input if it is already an absolute path
Cf set if failed

fs_MultByBytesPerSector

syscall Adress 0224E0

What it doesInputsOutputsDestroysNotes
multiply by the number of bytes per sectorHL = numberHL*=fs_sector_size

_LoadLibraryOP1

syscall Adress 0224E4

What it doesInputsOutputsDestroysNotes
locate and return a pointer to a library from a ".dll" file in a directory listed in "/lib"OP1 name of libraryhl points to file length, de points to file data. Cf set if failed

fs_OpenFileInDir

syscall Adress 0224E8

What it doesInputsOutputsDestroysNotes
Opens a file given a path and a file descriptor to start searching in. Returns file descriptor.void *fs_OpenFileInDir(char *path, void *dir);hl = file descriptor. hl is -1 if file does not exist, or if trying to start search in a file.

fs_SetSize

syscall Adress 0224EC

What it doesInputsOutputsDestroysNotes
Resizes a file descriptor.void *fs_SetSize(int len, void *fd);new file descriptor if success, -1 and Cf set if fail New file contents will be empty, but old file data will be preserved until the next cleanup.

fs_WriteFile

syscall Adress 0224F0

What it doesInputsOutputsDestroysNotes
Overwrite all data stored in a file from a given data pointer.int WriteFile(void *data, int len, void *fd);New file descriptor. -1 if failed to write

sys_HLToString

syscall Adress 0224F4

What it doesInputsOutputsDestroysNotes
convert a number to a stringHL = number to convertDE = string
string stored at gfx_string_temp

fs_DeleteFile

syscall Adress 0224F8

What it doesInputsOutputsDestroysNotes
delete a file/directory given a pathbool fs_DeleteFile(const char *name);true/nz if success, false/zf if fail

_DelVar

syscall Adress 0224FC

What it doesInputsOutputsDestroysNotes
delete a file in the /usr/tivars/ directoryOP1 = type byte, 8 byte name of var to deleteCf set if failed

_CreateVar

syscall Adress 022500

What it doesInputsOutputsDestroysNotes
create a ram file in the /tivars/ directoryOP1+1 = 8 byte name of var to create
A = var type
hl = length to allocate for file
hl = pointer to (VAT entry) 2 byte file length, de = pointer to file data
Cf set and HL = -1 if failed

gui_InputNoClear

syscall Adress 022504

What it doesInputsOutputsDestroysNotes
get user input without clearing the provided buffer first.uint8_t gui_InputNoClear(char *buffer, int max_len);0 if user exit, 1 if user enter, 9/12 if user presses down/up arrow key

fs_InitClusterMap

syscall Adress 022508

What it doesInputsOutputsDestroysNotes
initialize cluster map given data within the file system.void fs_InitClusterMap(void); uses the first half of vRam as scrap.

sys_WriteFlash

syscall Adress 02250C

What it doesInputsOutputsDestroysNotes
write BC bytes to flash from HL to DE.HL, DE, BCDE points to byte following written data

sys_WriteFlashA

syscall Adress 022510

What it doesInputsOutputsDestroysNotes
write a byte from A to flash at address DEA, DE

sys_JoinArgv

syscall Adress 022514

What it doesInputsOutputsDestroysNotes
Join argv into a space-delimited string.char *sys_JoinArgv(int argc, char *argv[]);Pointer to string.

fs_PathLen

syscall Adress 022518

What it doesInputsOutputsDestroysNotes
Get the length of a path stringint fs_PathLen(const char *path);hl = length of path, de = pointer to end of path, a = end of path character

fs_ParentDir

syscall Adress 02251C

What it doesInputsOutputsDestroysNotes
return a string representing the parent directory of a given path.char *fs_ParentDir(const char *path);HL = string representing path to parent directory. Returns -1 and Cf on fail.

fs_StrToFileEntry

syscall Adress 022520

What it doesInputsOutputsDestroysNotes
convert a file.ext string to a file entrychar *fs_StrToFileEntry(char *dest, const char *src);pointer to file entry, 0 if failed. First byte of file entry will be fsentry_longfilename if file's name is too long for an 8.3 path.
Cf set if failed

fs_DirList

syscall Adress 022524

What it doesInputsOutputsDestroysNotes
list items in a directoryint fs_DirList(void **buffer, const char *path, unsigned int num, unsigned int skip);Returns number of items read. Returns -1 and Cf on fail. integer arguments "num" and "skip" must be less than 65536.

sys_Free

syscall Adress 022528

What it doesInputsOutputsDestroysNotes
Free as block of memory malloc'd by sys_Mallocvoid sys_Free(void *ptr);Cf set if failed.

sys_CallExecuteFile

syscall Adress 02252C

What it doesInputsOutputsDestroysNotes
Jump execution to an executable file and return to caller afterwardshl = program file to execute
de = arguments
bc = program file to return to

sys_JumpExecuteFile

syscall Adress 022530

What it doesInputsOutputsDestroysNotes
Jump execution to an executable filehl = file to execute
de = arguments

sys_OpenDevice

syscall Adress 022534

What it doesInputsOutputsDestroysNotes
Initialize a device (if needed) and return a device structure.device_t *sys_OpenDevice(const char *name);pointer to device structure. (file data)
hl=-1 and Cf set if failed.

fs_CopyFile

syscall Adress 022538

What it doesInputsOutputsDestroysNotes
Copy a file given paths and return a file descriptor.void *fs_CopyFile(const char *src, const char *dest);file descriptor of new file. Returns 0 if failed.

fs_GetSector

syscall Adress 022548

What it doesInputsOutputsDestroysNotes
get the sector a given address lies withinint fs_GetSector(void *address);

fs_WriteByte

syscall Adress 02254C

What it doesInputsOutputsDestroysNotes
write a byte into a file if the byte can be writtenbool fs_WriteByte(uint8_t byte, void *fd, int offset); Fails if the byte can't be written without swapping

fs_RenameFile

syscall Adress 022550

What it doesInputsOutputsDestroysNotes
rename a filevoid *fs_RenameFile(const char *directory, const char *old_name, const char *new_name);file descriptor. returns zero if failed

_SetCursorPos

syscall Adress 022554

What it doesInputsOutputsDestroysNotes
Set the text cursor positionvoid _SetCursorPos(uint8_t row, uint8_t col);

fs_CreateDir

syscall Adress 022558

What it doesInputsOutputsDestroysNotes
Create a directory given a path and return a file descriptor.void *fs_CreateDir(const char *path, uint8_t flags);file descriptor. Returns 0 if failed to create directory.

gfx_BufClear

syscall Adress 02255C

What it doesInputsOutputsDestroysNotes
clears the back bufferA color to fill with

gfx_LcdClear

syscall Adress 022560

What it doesInputsOutputsDestroysNotes
clears the lcdA color to fill with

fs_SanityCheck

syscall Adress 022564

What it doesInputsOutputsDestroysNotes
Sanity check the filesystem and initialize it as needed

sys_SetOnInterruptHandler

syscall Adress 022568

What it doesInputsOutputsDestroysNotes
Set an error handler for an interrupt caused by the [On] key.void *sys_SetOnInterruptHandler(void (*handler)(void));Returns previous error handler. user error handler is called after the interrupt is handled.

gui_PrintChar

syscall Adress 02256C

What it doesInputsOutputsDestroysNotes
Print a character to the back buffer and advance the text cursorA = character to print

gfx_SetDraw

syscall Adress 022570

What it doesInputsOutputsDestroysNotes

gui_PrintString

syscall Adress 022574

What it doesInputsOutputsDestroysNotes
print a string to the current lcd buffer, advancing curcolHL pointer to stringHL pointer to character after the last one printed
Cf set if a control code is encountered or if the text would overflow the line.
A = control code if a control code is encountered. (Cf will be set)
If you need a routine callable from C, this is not the one you'll want to use.

gui_PrintLine

syscall Adress 022578

What it doesInputsOutputsDestroysNotes

gui_PrintUInt

syscall Adress 02257C

What it doesInputsOutputsDestroysNotes
Print an unsigned integer. Dos not swap buffers.hl = integer

fs_GetFilePtrRaw

syscall Adress 022588

What it doesInputsOutputsDestroysNotes
get a pointer to a file's data sectionvoid *fs_GetFilePtrRaw(const char *path);HL = file data pointer, BC = file data length, A = file flags, Cf set and HL = -1 if failed

sys_ExecuteFileHL

syscall Adress 022590

What it doesInputsOutputsDestroysNotes
execute a file given a pointer to it's path in HLHL = pointer to file pathsame as sys_ExecuteFile

sys_TurnOff

syscall Adress 022594

What it doesInputsOutputsDestroysNotes
turns off the calculator until the on key is pressed.

sys_NextProcessId

syscall Adress 022598

What it doesInputsOutputsDestroysNotes
Return the next unused process ID.uint8_t sys_NextProcessId(void);new process ID, or 0 if failed. Used for categorizing malloc'd memory and threads.

sys_PrevProcessId

syscall Adress 02259C

What it doesInputsOutputsDestroysNotes
Return the next open process ID.uint8_t sys_PrevProcessId(void);process ID.

sys_FreeProcessId

syscall Adress 0225A0

What it doesInputsOutputsDestroysNotes
Free all memory allocated by a given process IDvoid sys_FreeProcessId(uint8_t id); DO NOT free process ID 1 since it is used by the OS and should be preserved.

fs_GarbageCollect

syscall Adress 0225A4

What it doesInputsOutputsDestroysNotes
Clean up the filesystem, resetting freed areas.NoneNone

gfx_SwapTextColors

syscall Adress 0225A8

What it doesInputsOutputsDestroysNotes
Swap lcd_text_fg and lcd_text_fg2

fs_WriteNewFile

syscall Adress 0225AC

What it doesInputsOutputsDestroysNotes
Create and write a new filevoid *fs_WriteNewFile(const char *name, uint8_t properties, void *data, int len);HL = file descriptor. HL = -1 and Cf set if failed. Will overwrite file if it exists.

gfx_SetFont

syscall Adress 0225B0

What it doesInputsOutputsDestroysNotes
set the current fontvoid *gfx_SetFont(void *data)HL = old font data data structure: uint8_t num_bitmaps, uint8_t spacing[], uint8_t data[]

gfx_SetDefaultFont

syscall Adress 0225B4

What it doesInputsOutputsDestroysNotes
Reset the current font to the default built-in font

sys_FreeRunningProcessId

syscall Adress 0225B8

What it doesInputsOutputsDestroysNotes
Free all memory allocated by the currently executing process ID.void sys_FreeProcessId(void); Automatically called after program exits.

util_Zx7Decompress

syscall Adress 0225BC

What it doesInputsOutputsDestroysNotes
decompress a block of zx7-compressed data into a user-provided RAM buffervoid util_Zx7Decompress(void *dest, void *src);

sys_CheckMallocRAM

syscall Adress 0225C0

What it doesInputsOutputsDestroysNotes
Check how much memory is free in Malloc RAMint sys_CheckMallocRAM(void);

gfx_Compute

syscall Adress 0225C4

What it doesInputsOutputsDestroysNotes
compute draw location on the current lcd buffer from XY coodinate.HL X coordinate
E Y coordinate
HL pointer to draw location

gfx_FillRectangle

syscall Adress 0225C8

What it doesInputsOutputsDestroysNotes

gfx_FillScreen

syscall Adress 0225CC

What it doesInputsOutputsDestroysNotes

gfx_GetFontPtr

syscall Adress 0225D0

What it doesInputsOutputsDestroysNotes
get pointer to font datahl = current font data

gfx_HorizLine

syscall Adress 0225D4

What it doesInputsOutputsDestroysNotes

gfx_InitStdPalette

syscall Adress 0225D8

What it doesInputsOutputsDestroysNotes
Initialise the standard (8bpp) XLibC palette

gfx_NextLine

syscall Adress 0225DC

What it doesInputsOutputsDestroysNotes
moves the text position 9 rows ahead, and moves the collumn to zero.

gfx_PrintChar

syscall Adress 0225E0

What it doesInputsOutputsDestroysNotes

gfx_PrintHexA

syscall Adress 0225E4

What it doesInputsOutputsDestroysNotes

gfx_PrintUInt

syscall Adress 0225E8

What it doesInputsOutputsDestroysNotes

gfx_Rectangle

syscall Adress 0225EC

What it doesInputsOutputsDestroysNotes

gfx_Set8bpp

syscall Adress 0225F0

What it doesInputsOutputsDestroysNotes
set the lcd to 8bpp mode

gfx_Set16bpp

syscall Adress 0225F4

What it doesInputsOutputsDestroysNotes
set the lcd to 16bpp mode

gfx_SetTextXY

syscall Adress 0225F8

What it doesInputsOutputsDestroysNotes

gfx_Sprite

syscall Adress 0225FC

What it doesInputsOutputsDestroysNotes

gfx_Sprite2x

syscall Adress 022600

What it doesInputsOutputsDestroysNotes
draws a sprite to the current buffer at 2x scaleHL pointer to sprite
BC X<<8 + Y

gfx_VertLine

syscall Adress 022604

What it doesInputsOutputsDestroysNotes

sys_Malloc32Align32

syscall Adress 022608

What it doesInputsOutputsDestroysNotes
Allocate 32 bytes of memory, 32-byte aligned.void *sys_Malloc32Align32(void);hl = malloc'd bytes. hl = 0 if failed to malloc
Cf set if failed to malloc

sys_Malloc64Align256

syscall Adress 02260C

What it doesInputsOutputsDestroysNotes
Allocate 64 bytes of memory, 256-byte aligned.void *sys_Malloc64Align256(void);hl = malloc'd bytes. hl = 0 if failed to malloc
Cf set if failed to malloc

gfx_PrintStringXY

syscall Adress 022610

What it doesInputsOutputsDestroysNotes

gfx_GetTextX

syscall Adress 022614

What it doesInputsOutputsDestroysNotes

gfx_GetTextY

syscall Adress 022618

What it doesInputsOutputsDestroysNotes

sys_OpenFileInPath

syscall Adress 022624

What it doesInputsOutputsDestroysNotes
open a file, looking in directories from $PATH variable if file not foundvoid *sys_OpenFileInPath(const char *path);pointer to file descriptor

sys_VarString

syscall Adress 022628

What it doesInputsOutputsDestroysNotes
Similar to sprintf but uses system vars and malloc's the output buffer.char *sys_VarString(const char *str);hl string where $VAR's are replaced with their respective values. Returns -1 and Cf set if failed. $VAR must be terminated with a space " " which is not included in the output.

fs_GetFreeSpace

syscall Adress 02262C

What it doesInputsOutputsDestroysNotes
Return remaining free space in the filesystemint fs_GetFreeSpace(void);filesystem remaining space in bytes

fs_GetFDPtrRaw

syscall Adress 022630

What it doesInputsOutputsDestroysNotes
Return pointer to file data given a file descriptorvoid *fs_GetFDPtrRaw(void *fd);pointer to file data, or -1 and Cf set if file data has not been allocated yet.

fs_GetFDLenRaw

syscall Adress 022634

What it doesInputsOutputsDestroysNotes
Return length of file data given a file descriptorint fs_GetFDLenRaw(void *fd);length of file data. Will be 0 if data has not been initizlized yet.

_OP1ToPath

syscall Adress 022638

What it doesInputsOutputsDestroysNotes
Convert a variable name from OP1 into a BOS file name.OP1 variable type byte, 8 byte namehl = path
Cf set if failed

th_WaitKeyCycle

syscall Adress 02263C

What it doesInputsOutputsDestroysNotes
Starts a thread that does nothing until a key is pressed and unpressed, passes the keypress to the caller via a callback function, then stops.int th_WaitKeyCycle(void (*callback)(uint8_t key));returns 0 and Cf unset on success, -1 and Cf set on fail. Starts a thread, which won't do anything until handled.

fs_JoinPath

syscall Adress 022640

What it doesInputsOutputsDestroysNotes
join two filesystem pathschar *fs_JoinPath(const char *path1, const char *path2);hl = resultant path.
Cf set, hl = -1 if failed

sys_MallocPersistent

syscall Adress 022644

What it doesInputsOutputsDestroysNotes
Allocate memory to be treated as persistentsame as sys_Mallocsame as sys_Malloc

sys_OpenFileInVar

syscall Adress 022648

What it doesInputsOutputsDestroysNotes
open a file, looking in directories from var variable if file not foundvoid *sys_OpenFileInVar(const char *path, const char *var);pointer to file descriptor

fs_BaseName

syscall Adress 02264C

What it doesInputsOutputsDestroysNotes
return the last path word of a pathchar *fs_BaseName(const char *path);copy of last path word, or same as input if it is the only path word, or pointer to '/' if that is the last character of the path.

fs_MoveFile

syscall Adress 022650

What it doesInputsOutputsDestroysNotes
Move a file given paths and return a file descriptor.void *fs_MoveFile(const char *src, const char *dest);file descriptor of new file. Returns 0 if failed.

fs_WriteDirectly

syscall Adress 022654

What it doesInputsOutputsDestroysNotes
Attempt to write data to a file directly, failing if the data can't be written correctly or if the file isnt large enough.void *fs_WriteDirectly(void *data, int len, uint8_t count, void *fd, int offset);New file descriptor or -1 and Cf set if failed.

_UnpackUpdates

syscall Adress 022658

What it doesInputsOutputsDestroysNotes

sys_ReadSectorCache

syscall Adress 02265C

What it doesInputsOutputsDestroysNotes
Read flash sector A into the sector cache (VRAM)returns pointer to sector cache in hl

sys_WriteSectorCache

syscall Adress 022660

What it doesInputsOutputsDestroysNotes
Write the currently cached sector back to flash sector A

sys_OpenFileInLib

syscall Adress 022664

What it doesInputsOutputsDestroysNotes
open a file, looking in directories listed in /var/LIB.void *sys_OpenFileInLib(const char *path);pointer to file descriptor

sys_LoadHookThreads

syscall Adress 022668

What it doesInputsOutputsDestroysNotes
run threads given a pointer to a file path structurevoid sys_LoadHookThreads(void *ptr, size_t len); data structure: type byte, entry length byte, offset of data in file (2 bytes), stack size byte, file name (null-terminated), end of entry

gfx_BlitScreen

syscall Adress 02266C

What it doesInputsOutputsDestroysNotes
copies the lcd to the back buffer

th_CreateThread

syscall Adress 022670

What it doesInputsOutputsDestroysNotes
spawn a threaduint8_t th_CreateThread(void *pc, void *sp, int argc, char **argv);thread id. 0 if failed void *sp must be allocated at least 12 bytes behind it. If void *sp is 0, it will use the sp from the caller, minus 48 bytes.

gfx_ZeroVRAM

syscall Adress 022674

What it doesInputsOutputsDestroysNotes
clears VRAM with null bytes

th_KillThread

syscall Adress 022678

What it doesInputsOutputsDestroysNotes
Kill a thread by ID, including child threads.uint8_t th_KillThread(uint8_t id);thread ID killed if successful, 0 if failed. Cannot kill thread ID 0.

fs_GetFilePtr

syscall Adress 02267C

What it doesInputsOutputsDestroysNotes
get a pointer to a file's data sectionvoid *fs_GetFilePtr(const char *path);HL = file data pointer, BC = file data length, A = file flags, Cf set and HL = -1 if failed

fs_GetFDPtr

syscall Adress 022680

What it doesInputsOutputsDestroysNotes
Return pointer to file data given a file descriptorvoid *fs_GetFDPtr(void *fd);pointer to file data, or -1 and Cf set if file data has not been allocated yet.

fs_GetFDLen

syscall Adress 022684

What it doesInputsOutputsDestroysNotes
Return length of file data given a file descriptorint fs_GetFDLen(void *fd);length of file data. Will be 0 if data has not been initizlized yet.

fs_ArcUnarcFD

syscall Adress 022688

What it doesInputsOutputsDestroysNotes

util_Zx0Decompress

syscall Adress 02268C

What it doesInputsOutputsDestroysNotes

sys_WaitKeyUnpress

syscall Adress 022690

What it doesInputsOutputsDestroysNotes
Wait until no keys are pressed.NoneNone

sys_MallocDupStr

syscall Adress 022694

What it doesInputsOutputsDestroysNotes
Malloc a copy of a string.char *sys_MallocDupStr(const char *str);Malloc'd copy and Cf unset or zero and Cf set if failed.

sys_MallocDupStrN

syscall Adress 022698

What it doesInputsOutputsDestroysNotes
Malloc a copy of a string up to N characters.char *sys_MallocDupStrN(const char *str, size_t len);Malloc'd copy and Cf unset or zero and Cf set if failed.

_SearchSymTable

syscall Adress 02269C

What it doesInputsOutputsDestroysNotes
Search the symbol table (VAT) for a file specified in OP1Same as ti.ChkFindSym, except that 0xFF is treated as a wildcard.Same as ti.ChkFindSym.

fs_Rename

syscall Adress 0226A0

What it doesInputsOutputsDestroysNotes
rename a filevoid *fs_Rename(const char *old_name, const char *new_name);file descriptor. returns zero if failed

fs_AllocChk

syscall Adress 0226A4

What it doesInputsOutputsDestroysNotes
Check if a memory block can be allocated in flashunsigned int fs_AllocChk(unsigned int len);hl = first sector that would be allocated, or -1 and Cf set if failed.

sys_GetExecType

syscall Adress 0226A8

What it doesInputsOutputsDestroysNotes
Check the executable type of a given fileconst char *sys_GetExecType(const char *path);pointer to executable magic bytes, or -1 and Cf set if failed. returns pointer to executable code in de and length of executable code in bc if hl != -1

sys_GetExecTypeFD

syscall Adress 0226AC

What it doesInputsOutputsDestroysNotes
Check the executable type of a given file descriptorconst char *sys_GetExecType(void *fd);pointer to executable magic bytes, or -1 and Cf set if failed. returns pointer to executable code in de and length of executable code in bc if hl != -1

util_Zx7Compress

syscall Adress 0226B0

What it doesInputsOutputsDestroysNotes
Zx7 compress a block of memory.int util_Zx7Compress(void *dest, void *src, int len, void (*progress_callback)(int src_offset));length in bytes written to dest.

sys_OpenRecoveryMenu

syscall Adress 0226B4

What it doesInputsOutputsDestroysNotes

util_Relocate

syscall Adress 0226B8

What it doesInputsOutputsDestroysNotes
Relocate code in data offsetting 24-bit values (offsets of data) by origin_delta.void util_Relocate(void *data, unsigned int *offsets, int origin_delta); relocates data in place. (data MUST be stored in ram, otherwise this will crash) offsets should be terminated with 0xffffff.

fs_GetFDAttr

syscall Adress 0226BC

What it doesInputsOutputsDestroysNotes
Return file attribute byte for a given descriptoruint8_t fs_GetFDAttr(void *fd);attribute byte in A

util_InitAllocSymList

syscall Adress 0226C0

What it doesInputsOutputsDestroysNotes
Allocate and initialize a Symbol list.symlist *util_InitSymList(void);Pointer to new Symbol list. 0 if failed. All this does is allocate 6 bytes and set to 0. The memory location doesn't matter as long as it's in RAM and initialized to 0.

util_AppendSymList

syscall Adress 0226C4

What it doesInputsOutputsDestroysNotes
Allocate and add an entry to a Symbol list.symbol *util_AppendSymList(symlist *list, const char *name, unsigned int value, uint8_t flags);Pointer to new Symbol. 0 if failed.

util_RemoveFromSymList

syscall Adress 0226C8

What it doesInputsOutputsDestroysNotes
Remove a symbol by name from a Symbol list.symbol *util_RemoveFromSymList(symlist *list, const char *name);Pointer to unlinked symbol. 0 if failed. Unlinked symbol should be freed manually if not needed.

util_SearchSymList

syscall Adress 0226CC

What it doesInputsOutputsDestroysNotes
Search a Symbol list for a given symbol.symbol *util_SearchSymList(symlist *list, const char *name);Pointer to Symbol. 0 if failed. Returns pointer to symbol preceeding the found symbol in de.

util_FreeSymList

syscall Adress 0226D0

What it doesInputsOutputsDestroysNotes
Free a Symbol list.void util_FreeSymList(symlist *list); symlist pointer passed should be freed manually if it was malloc'd or initialized from util_InitAllocSymList.

sys_Exec

syscall Adress 0226D4

What it doesInputsOutputsDestroysNotes
Execute a null-terminated command string.int32_t sys_Exec(const char *str);process exit code.
exit code also stored in bos.LastCommandResult

sys_ExecV

syscall Adress 0226D8

What it doesInputsOutputsDestroysNotes
Execute a program with argc/argv.int sys_ExecV(const char *program, int argc, char *const argv[]);process exit code.

sys_ExecData

syscall Adress 0226DC

What it doesInputsOutputsDestroysNotes
Execute a command string given its length.int32_t sys_ExecData(const char *str, size_t len);process exit code.
exit code also stored in bos.LastCommandResult

sys_ExecBegin

syscall Adress 0226E0

What it doesInputsOutputsDestroysNotes
Begin execution from begPC to endPC.int32_t sys_ExecBegin(void);process exit code. Returns Cf set if begPC >= endPC.
exit code also stored in bos.LastCommandResult
exit code is undefined if begPC >= endPC.

sys_ExecContinue

syscall Adress 0226E4

What it doesInputsOutputsDestroysNotes
Continue Execution from curPC.int32_t sys_ExecContinue(void);process exit code.
exit code also stored in bos.LastCommandResult