Function Reference

Back to Index

Sorted by file Sorted alphabetically
base.asm
errcheck.asm
flashram.asm
fs.asm
fs_high.asm
keypad.asm
lcd.asm
libs.asm
loadinit.asm
locks.asm
memmngt.asm
pgmmngr.asm
procs.asm
restrict.asm
screen.asm
startup.asm
strings.asm
textio.asm
timer.asm
usrspcsp.asm
A
B
C
D
E
F
G
H
I
K
L
M
N
P
Q
R
S
T
U
W
Name
addmultilock (locks.asm)
Input HL lock to obtain
Output A Zero on success, $01 when to process already had the lock, $FF on failure
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description Tries to obtain a lock on multi-process lock HL.

Name
backuprom (flashram.asm)
Input HL Block to move (in normal Flash-driver format, see also the OS Documentation page).
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $FFFF on Failure, $0000 on success.
Description Used internally for sector cleaning (removing "dead" blocks). Copies (physically) a file to another sector or to the swap sector (sector 6). Deletes ("kills") the source afterward. WARNING: You should have cleaned the swap-page before calling this function.

Name
basename (fs.asm)
Input HL A full path
Output HL Pointer to the start of the filename in the given string.
Description Strips a filename from a complete path (i.e. "file" from "/a/directory/with/a/file")

Name
become_kernel (procs.asm)
Description Used internally to make a context-switch to the kernel process without saving the current context. Used by endproc

Name
become_screen_master (screen.asm)
Output A Garbage
Output B Garbage
Output HL 0 on succes, on failure the PID from the process that owns the screen.
Description Used to get full access over the LCD display. When a process is the master of screen, there is no other process that may lock to screen to write to it. This means no process can write to the LCD display until it is released by share_screen. Since to OS should handle all data to the LCD display (using virtual screens), this function should only to be used by the OS.

Name blink (screen.asm)
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description This function is called by the timer-trigger-routine. It simply show or hides the cursor, to create the cursor blinking effect. Only used by the system.

Name
blk2byte (flashram.asm)
Input HL Block-address
Output A Garbage
Output HL Pointer to the first byte of that block.
Description This function takes a flash block-address (in [rom-page][blocknr] format), switches to the corresponding flash-page and returns a pointer to the first byte of that block.

Name
BOOT (startup.asm)
Description System execution starts here ($0066).

Name
boot_timeout (base.asm)
Output B Always 0
Description A simple timeout-loop for debugging the booting of BAOS.

Name
busywaitforLCD (lcd.asm)
Description Busy-waits for the LCD driver IC to become ready, but preserves A

Name
byte2blk (flashram.asm)
Input HL Logical address ($4000 to $7FFF).
Output HL Block number
Description Calculates the Flash-driver block number from a exact address (and the current flash page).

Name
byteRDY (flashram.asm)
Input A Value that is written
Input DE Byte that is written
Output A Is always $F0
Output DE Byte that is written
Output HL $0000 on success, $FFFF on failure.
Description Waits until byte DE of the current flash page is ready writing value A to itself.

Name
calclock (locks.asm)
Input A lock
Output HL Position of lock.
Description Used internally to calculate position of lockfile

Name
calllib (libs.asm)
Description Jumped from RST $20 run a library routine

Name
calloc (memmngt.asm)
Input HL Bytes needed
Output A Garbage
Output B Garbage
Output DE Garbage
Output HL Pointer to memory at succes, zero at failure.
Description Called does the same as malloc, but will initialize the memory with zeros.

Name
checkclear (base.asm)
Description This function is called during booting. It checks if the CLEAR key is pressed. If this is the case, it will call sysclrflash and clears the flash.

Name
checkfs (fs.asm)
Description Called by the system at boot-time, checks the filesystem for errors. Errors are automatically repaired. If too much errors are found, the system will format the filesystem and reboot.

Name
checkinmultilock (locks.asm)
Input A Lock to check
Input B size of lock
Output A $00 when lock was aquired, $ff otherwise
Description Used to check whether the current process has obtained a certain multi-process lock

Name
checklock (locks.asm)
Input A lock
Output A Current lock value
Description Returns current lock value

Name
checkmultilocked (locks.asm)
Input A lock
Input B locksize
Output A $00 when free, number of first process that was found otherwise
Output B Garbage
Output HL Garbage
Description Used to check whether any process has obtained a multi-process lock.

Name
check_flash_access (locks.asm)
Output HL 1 of allowed, 0 if not
Description Check if the current process is allowed to do direct flash I/O

Name
cleansec (flashram.asm)
Input A Sector to clean.
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $FFFF on Failure, $0000 on success.
Description Cleans a single sector from "dead" blocks, to get some free space.

Name
clearswap (flashram.asm)
Output HL $0000 on success, $FFFF on failure,
Description Checks if there is any data in the swap-sector. If that is the case, the swap space will be wiped out.

Name
clrscrn (textio.asm)
Output A Garbage
Output B Always zero
Output DE Always zero
Output HL Garbage
Description Clears the virtual screen of this process.

Name
ClrSec (flashram.asm)
Input B Sector to Erease
Output A Always $F0
Output B Garbage
Output DE Garbage
Output HL Zero on success, $FFFF on failure.
Description Ereases one flash sector to $FF. However, important sectors are protected. If you put a zero into the variable flashprotmode, only sector 7 is not ereasable.

Name
cls (lcd.asm)
Output A Always 48
Output B Always zero
Output D Always 48
Description Clears the LCD screen by hardware. You probably want to use clrscrn.

Name
cntdeadblks (flashram.asm)
Input A Sector to scan.
Output A Always zero.
Output BC Number of dead blocks.
Output DE Garbage.
Output HL Number of dead blocks.
Description Counts the number of dead blocks in the given sector. Used by trycleansec.

Name
copyblk (flashram.asm)
Input DE Pointer to 64 previous allocated bytes in the RAM.
Input HL Pointer to the first byte ot the FLASH block to copy ($4000 to $7fc0).
Output A Garbage
Output BC Always $0000
Output DE End of data in RAM.
Output HL End of data in FLASH.
Description Copies one block (64 bytes) from the flash to a specified place in the RAM.

Name
copytoram (flashram.asm)
Input BC Amount of bytes to copy.
Input HL Pointer to the source ($4000 to $7FFF).
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $FFFF on failure, otherwise a pointer to the start of your data in the RAM.
Description Copies data from the flash to the RAM.

Name
debug_printstr (base.asm)
Description Calls printstr but saves all registers.

Name
debug_print_a (base.asm)
Description Prints the number stored in register A and goes to the next line. No register is touched while doing this.

Name
debug_print_ahex (base.asm)
Description Prints the hexadecimal number stored in register A and goes to the next line. No register is touched while doing this.

Name
debug_print_hl (base.asm)
Description Prints the number stored in register HL and goes to the next line. No register is touched while doing this.

Name
debug_print_hlhex (base.asm)
Description Prints the hexadecimal number stored in register HL and goes to the next line. No register is touched while doing this.

Name
debug_puts (base.asm)
Description Calls puts but saves all registers.

Name
debug_wait (base.asm)
Description Executes HALT 200 times. Operation time depends on whether multitasking is on. All registers keep their values. Never call this function when interrupts are disabled!

Name
delmultilock (locks.asm)
Input A lock
Input B locksize
Output A $00 on success, $FF when no lock was found
Output B Garbage
Output HL Garbage
Description Used to remove a process from a multiple process lock

Name
endproc (procs.asm)
Description This function terminates the process instandly and cleans up the system (freeing memory, clean op process table). After this it switches to the next process.

Name
execfile (fs_high.asm)
Input HL Path to the program.
Output A Depends on the program.
Output BC Depends on the program.
Output DE Depends on the program.
Output HL $FFFD if the file couldn't be found, $FFFE if the file isn't executable, $FFFF if an other error occurs. Depends on the program on success.
Output IX Depends on the program.
Output IY Depends on the program.
Description Loads a file from the filesystem into the memory and starts executing that file. The loaded program will take over control. If the program exits in a normal way, execution will be resumed. See also startfile.

Name
falloc (flashram.asm)
Input B Amount of needed blocks (1 block = 64 bytes).
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $FFFF on failure, otherwise the first block of your empty space.
Description Searches for an empty place in the flash. A wrapper around seekempty and trycleansec, to provide automatic sector cleaning.

Name
findfile (fs_high.asm)
Input HL Filename (full or relative path is also possible).
Output A File's flags.
Output BC Length of the file on success, or the Directory IDentifier of the file's directory when HL is $FFFF.
Output DE Garbage.
Output HL Pointer to the file's data on success, $FFFF if the file couldn't be found, $FFFE if there was a problem resolving the path.
Output IX Pointer to the file-header.
Description Tries to find a file in the filesystem.

Name
findparentdir (fs.asm)
Description Returns the parent directory of a specified directory.

Name
findscrnloc (screen.asm)
Output A Garbage
Output HL Pointer the the current screen location.
Description This function checks the current virtual screen and calculates a pointer to the current cursor location on that screen. It is internally called by getscrnloc.

Name
findsym (fs.asm)
Input B Directory IDentifier of the file's directory.
Input HL Name of the file.
Output A The file's flags.
Output BC The file's length (in bytes) on success or same as input (with B as parent DID) on failure.
Output DE Garbage.
Output HL Pointer to the file's data (or $FFFF on failure).
Output IX Pointer to the file-header.
Description This function will lookup a certain file in the filesystem. It's called by findfile.

Name
flash_init (flashram.asm)
Description Called by the OS, initializes the flash-driver.

Name
free (memmngt.asm)
Input HL Pointer to previous allocated memory
Output A Garbage
Output BC Garbage
Output DE Always $8000
Output HL Zero on succes, $FFFF on failure.
Description Frees memory that was allocated by this process (using malloc, calloc or pgmalloc. If it was not allocated by this process, HL will be $FFFF.

Name
freeflashaccess (locks.asm)
Description Used to free a direct flash I/O read lock

Name
freeflashrecwritelock (locks.asm)
Description Free a lock obtained by getflashrecwritelock

Name
freeflashwritelock (locks.asm)
Output A Zero on success, PID of actual locker on failure.
Description Used to free a flash write lock

Name
getc (textio.asm)
Output A ASCII code of the key that was pressed.
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description This function waits for a user to press a key (while on the correct virtual screen ofcourse) and returns the ASCII code for this key. The ASCII-code is not returned before the key was released! This functions also prints the key on the screen to let the user know he/she pressed the key.

Name
getfileinfo (fs_high.asm)
Input HL Filename (full or relative path is also possible).
Output A File's flags.
Output BC Length of the file.
Output DE Garbage.
Output HL Pointer to the file's data on success, $FFFF if the file couldn't be found, $FFFE if there was a problem resolving the path.
Output IX Pointer to the file-header.
Description Wrapper for a filesystem-locked call to findfile

Name
getflashaccess (locks.asm)
Output A $00 on success, $01 when lock was already aquired, $FF on failure
Description Used to obtain a direct flash I/O read lock

Name
getflashrecwritelock (locks.asm)
Description Get a recursive flash write lock, used internally

Name
getflashwritelock (locks.asm)
Output A $00 on success, first blocker PID found on failure
Description Used to obtain a flash write lock

Name
getkey (textio.asm)
Output A ASCII code of the key that was pressed.
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description Same as getc, but doesn't filter out control characters (in the case of BAOS, everything > ASCII 127).

Name
getlibaddr (libs.asm)
Input HL address to read from and write to.
Output A Current flash page
Output BC Garbage
Output DE Garbage
Output HL $0000 on Success, $ffff on failure
Description Get the address of a library function and write it to the memory

Name
gets (textio.asm)
Input BC Maximal number of characters to recieve.
Input HL Pointer to the momery the characters should be stored.
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Pointer to the end of the string (trailing zero)
Description This function saves a series of ASCII-codes given by the keypad into a specified location inside the memory. This happends until the user presses the ENTER key or the user is trying to enter more characters than the integer stored in BC. The character-string will be automatically closed with a trailing zero ('\0') character. The characters are also printed to the display when they are read.
NOTE: you may never put the number of allocated bytes into BC, since the trailing zero ('\0') byte will exceed this value by one. You can use the number of allocated bytes minus one as BC at max.
NOTE2: This function is still under development, special "control characters" (as backspaces, arrows, delete, etc.) are not yet implemented.

Name
getscrnloc (screen.asm)
Output DE Current Screen cursor location.
Description This function puts the location of the cursor into DE (D = row, E = column), the left-upper corner is DE = $0000.

Name
giveflashaccess (locks.asm)
Input A PID to tranfer it to
Output BC Garbage
Output HL Zero in success, $FFFF on failure
Description Used to transfer a flash-read lock to another process, used internally by startpgm and startpgmex.

Name
givemem (memmngt.asm)
Input A PID of the new process
Input HL Pointer to previous allocated memory
Output A Garbage
Output BC Garbage
Output DE Always $8000
Output HL Zero on succes, $FFFF on failure.
Description Set the 'owner' of a piece of memory that was allocated by this process (using malloc, calloc or pgmalloc to another process.

Name
halt (base.asm)
Description Halts forever, only usefull to stop the OS (which can only be done when the OS itself calls halt), when something critical happends.

Name
handle_lib (libs.asm)
Input DE Address of program loaded in memory
Input IY IY that should be passed to the program
Output A Returned from the program
Output BC Returned from the program
Output DE Returned from the program
Output HL Returned from the program
Output IX Returned from the program
Output IY Returned from the program
Description Checks for library calls in a loaded program and pre-calculates them

Name
INIT (base.asm)
Description This function is started from the function BOOT and will initialize all OS Drivers and after this start the program INIT, which should start everything that runs in "user-space" (some services and a login prompt).

Name
inkey (keypad.asm)
Output A ASCII value of pressed key (or zero when no key was pressed)
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description This function return the ascii code of the key currently pressed on the keypad, or a zero if no key was pressed. Special keys will return a non-printable character between 128 and 255. All characters above 127 are not conform ascii.

Name
INTERRUPT (timer.asm)
Description This function is called by the OS when an interrupt happends. From here for example the timer-table is read to react on the interrupt.

Name
kernel_lockHL (locks.asm)
Input HL address of the lock
Description Performs a context-switch to the kernel process in order to obtain a lock OUT A; Zero on success, otherwise PID of the blocker process

Name
kernel_setHL_zero (locks.asm)
Input HL Address of the lock
Description Performs a context-switch to the kernel process in order to free a lock. Since this is a low-level function, no checking is done.

Name
killblk (fs.asm)
Input HL The block to 'kill' (in [page][blknr] format).
Output A Garbage.
Output BC Garbage.
Output DE Garbage.
Output HL $FFFF on failure, $80xx on success.
Description Flag the given block as dead

Name
killme (procs.asm)
Input HL Pointer to a message
Description Kills the calling process, optionally using a specified message.

Name
ldcode_rst (usrspcsp.asm)
Description Used for the LDCODE macro, should never be called manually.

Name
libflashio (libs.asm)
Input A 0 if the function can be used without flash access, 1 if flash access is required, 2 if it is only necessary to restore the library flash page after the call.
Input HL Address to call.
Input IY Pointer to stack frame at begin of library function
Output A Garbage
Output BC From function
Output DE From function
Output HL From function
Output IX Garbage
Output IY From function
Description Set the flash page using the stack and call a OS library function. Used for OS library functions that require direct access to the flash.
NOTE: This function can not be used when the called function uses the IY register as argument

Name
load (fs_high.asm)
Input DE Pointer to a place in the RAM to load the file to (or $0000 to let the function allocate memory).
Input HL Path to the file to load.
Output A file flags
Output BC file length
Output DE Pointer to the last byte of the file in the RAM + 1.
Output HL Start of the file in the RAM on success, $FFFF or $FFFE on failure (see also findfile).
Output IX Pointer to the file-header in the flash.
Description Loads a file from the flash to the RAM (for editing and reading purposes).

Name
loadpgm (pgmmngr.asm)
Input HL Pointer to start of program.
Output A Depending on the program.
Output BC Depending on the program.
Output DE Depending on the program.
Output HL Depending on the program, $FFFF can indicate loading was unsuccessfull.
Output IX Depending on the program.
Output IY Depending on the program.
Description Load and starts a program, waits until it's finished and continues executing.
NOTE: if the program loaded calls endproc, then the programm that was calling loadpgm will also die.
NOTE: You should have a lock on the flash before calling this function! The lock will be freed by this function.

Name
locate (lcd.asm)
Input D Row (starting at 0)
Input E Column (starting at 0)
Description Description locate is used by the screen-manager the set the position of the next character that will be written to the LCD display. Because of the screen manager, you should use setscrnloc instead.

Name
locks_init (locks.asm)
Description Initialise system locks.

Name
lock_screen (screen.asm)
Description This function is called by every function that communicated with the LCD display. It sets a special byte to lock other communication to the LCD driver until the caller function is done. This is automatically done, so you shouldn't need it. To get a full lock on the LCD driver, you should use become_screen_master, however you should only use this in for example games, since all normal communication is done by the screenmanager.

Name
malloc (memmngt.asm)
Input HL Bytes needed
Output A Garbage
Output B Garbage
Output DE Garbage
Output HL Pointer to memory at succes, zero at failure.
Description malloc can be called by any process that needs some (more) memory. It returns a pointer to a bit of free memory that will only be used by the process that allocated it. After the process is done using it, it should call free with the same pointer.

Name
mem_init (memmngt.asm)
Description Called by the OS at boot time to initialize the memory manager.

Name
mkdir (fs.asm)
Input D Directory IDentity of the parent directory (the directory the new one will reside in).
Input HL The name of the new directory.
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $0000 on success, $FFFF on failure.
Output IY Garbage
Description Creates a new directory.

Name
mkfile (fs.asm)
Input BC The length of the file (in bytes).
Input D Directory IDentity of the parent directory (directory the file should be placed in).
Input E The flags of the file.
Input HL The name of the file (Should reside in the RAM!!).
Input IX A pointer to the file's data (Also somewhere in the RAM!!).
Output A Garbage.
Output BC Garbage.
Output DE Garbage.
Output HL $0000 on success, $FFFF on failure.
Output IX Garbage.
Output IY Garbage.
Description Creates a new file.

Name
mvrom (flashram.asm)
Input DE First block of some free space in the flash (the destination).
Input HL First block of the source.
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $FFFF on Failure, something else on success.
Description Copies a file (only phisically) from one place in the FLASH to another. Deletes ("kills") the source afterward.

Name
need_os_stage_multitask (base.asm)
Description Check if the OS is already multitasking If not, return from the calling function

Name
need_os_stage_procswitch (base.asm)
Description Check if the OS loading process is at a stage where context-switching is possible If not, return from the calling function

Name
newline (textio.asm)
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description newline scrolls down one line, and sets the location of the next character to print on the first column of the current screen (like the ENTER key does in a word-processor). It gives the same result as printing the ASCII character 10 (decimal), a.k.a. '\n'. (Note that in DOS/Windows ASCII character 13 is used in text-files and ASCII character 10 in binary files).

Name
newproc (procs.asm)
Input HL Pointer to start address of process
Output A PID of the child on success
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description This function starts a new process (which is very different from starting a program, see the OS Documentation page) and returns the the place it was called from.

Name
newprocex (procs.asm)
Input A State of the new process (0 = sleeping, 1 = running)
Input B Directory of the process
Input C Virtual screen to start on.
Input DE Pointer to the name of the new process (string)
Input HL Pointer to start address of process
Output A Garbage.
Output BC Garbage.
Output DE Garbage.
Output HL Garbage.
Description Same as newproc, but with more options.

Name
newtimer (timer.asm)
Input B Countdown time (measured in interrupts, 140 = ~ 1 sec).
Input C Repeat-countdown, after the first time the timer is triggered, every C interrupts, the timer will be triggered again (use 0 ('zero') for no repeat).
Input DE Pointer to the function that should be called by the timer.
Output A Garbage
Output BC Same as input
Output DE Same as input
Output HL Zero on success, $FFFF on failure.
Description This function sets up a timer for a scheduled execution of a function. This is internally used for the sleep function, multitasking and cursor blinking. It can be used for practicly anything that needs timer interrupts.

Name
nextblk (flashram.asm)
Input HL Pointer to the current file header ($4000 to $7fc0)
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Logical address of next file header on this page ($4000 to $7fc0) or $FFFF if no header could be found on the current page.
Description Used internally to find the location of the next "file-header" on the current flash page.

Name
nextproc (procs.asm)
Description Let the process manager make a switch to the next process.

Name
nextprocentry (procs.asm)
Description Updates (userspc_proc_entry) to the next process table entry that is in use and not asleep.

Name
nolib (libs.asm)
Description Called when needed routine could not be found, to exit() the program

Name
page2page (flashram.asm)
Input A Destination page.
Input B Source page.
Output A Garbage.
Output BC Garbage.
Output DE Garbage.
Output HL Garbage.
Description Copies a full page to another. Stops copying when an empty block is found. Used by the clrsec routine.

Name
pgmalloc (memmngt.asm)
Input HL Bytes needed
Output A Garbage
Output B Garbage
Output DE Garbage
Output HL Pointer to memory at succes, zero at failure.
Description Same as malloc, but returns returns only pointers to memory that is executable.

Name
precalclib (libs.asm)
Description Call a library directly with a precalculated address.

Name
printc (textio.asm)
Input A Character to print
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description Print a single character the the screen.

Name
printf (textio.asm)
Input A Type of data. num, hex, str and char are predefined integers to use.
Input DE Data (16-bit integer, pointer to a string or (only E) character)
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description Prints a character, integer or string (depending on input) to the screen.

Name
printfat (textio.asm)
Input A Type of data. num, hex, str and char are predefined integers to use.
Input DE Position to print to.
Input HL Data (16-bit integer, pointer to a string or (only E) character)
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description Same as printf, but prints at a specified location.

Name
printhl (textio.asm)
Input HL 16-bit integer
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description Prints a 16-bit unsigned integer to the screen (in decimal format).

Name
printhlhex (textio.asm)
Input HL 16-bit integer
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description Prints a 16-bit unsigned integer to the screen in hexadecimal format.

Name
printstr (textio.asm)
Input HL Pointer to a string
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description Prints a text string to the screen.

Name
procentry2pid (procs.asm)
Input A Table entry number.
Output A PID
Description Translates a Process Table entry number to a PID value.

Name
procinfo (procs.asm)
Input A Pid of the process to obtain information of
Output A Status of the process
Output B Current directory of the process
Output C Virtual Screen of the process
Output DE Program Counter of the process
Output HL Stack pointer of the process on success, or $0000 on failure
Output IX Process table entry (most significant byte) and current flash page (least significant byte)
Output IY Name of the process.
Description This function obtains process information of the process with the PID specified in A.
If a process with the specified PID does not exists, the function will fail and HL will be $0000.

Name
proc_init (procs.asm)
Description Called at boot time to initialize the process manager.

Name
putc (lcd.asm)
Input A Character to display.
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description Prints a singe character to the LCD display. Under normal circumstances you should use printc instead.

Name
puts (lcd.asm)
Input HL Pointer to a string.
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description Prints a text-string to the LCD display, under normal circumstances you should use printstr instead.

Name
quickbusywaitforLCD (lcd.asm)
Output A Garbage
Description Busy-waits for the LCD driver IC to become ready.

Name
quickwaitforLCD (lcd.asm)
Output A Garbage
Description These days exactly the same as quickbusywaitforLCD.

Name
readblk (flashram.asm)
Input DE Pointer to 64 previous allocated bytes in the RAM.
Input HL Block to copy (in [page][blknr] format, see OS Documentation page).
Output A Garbage
Output BC Always $0000
Output DE End of data in RAM.
Output HL End of data in FLASH.
Description Copies one block (64 bytes) from the flash to a specified place in the RAM.

Name
releaselock (locks.asm)
Input A Position of lock
Output A Zero on success, PID of actual locker on failure.
Description Used to release a lock created by setlock.

Name
release_screen (screen.asm)
Description Is called by all functions that communicate with the LCD display, to release the lock on the screen. After this functions is called, any process will be able to communicate with the LCD screen again. Only needed by the LCD-driver functions.

Name
removebackn (strings.asm)
Input HL A string.
Output A Garbage
Output HL Location of the '\0' (previously '\n') character.
Description Changes the first '\n' character in a string to an end-of-string character ('\0').
NOTE: make sure there is actually a '\n' character in the string !

Name
rom2rom (flashram.asm)
Input DE First block of some free space in the flash (the destination).
Input HL First block of the source.
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $FFFF on Failure, $0000 on success.
Description Copies a file (only phisically) from one place in the FLASH to another.

Name
RomLock (restrict.asm)
Input B 0 to disable, 1 to enable.
Output A Garbage
Description Enables / disables flash-writing.

Name
save_calloc (errcheck.asm)
Input A Amount of needed bytes.
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Pointer to memory
Description Only needed by the OS. It calls calloc and if for whatever reason the system is unable to allocate memory while it needs to set up critical services it displays a message and just halts (you should remove the batteries and reboot).

Name
save_malloc (errcheck.asm)
Input A Amount of needed bytes.
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Pointer to memory
Description Only needed by the OS. It calls malloc and if for whatever reason the system is unable to allocate memory while it needs to set up critical services it displays a message and just halts (you should remove the batteries and reboot).

Name
screenmanager (screen.asm)
Description The actual screen manager that runs in it's own process.

Name
screen_init (screen.asm)
Description Called by the OS at boot time to initialize the screen manager.

Name
scrngetramloc (screen.asm)
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Pointer to memory location of the character belonging to the cursor of this virtual screen.
Description This function returns the location in the memory where the next character printed on this virtual screen will be stored.

Name
scrnrefresh (screen.asm)
Description Refreshes the Physical screen from the buffer of the currently selected virtual screen.

Name
scrnscroll (textio.asm)
Description If a virtual screen is full (for example if there is an newline character printed on the last line), this function will be called. It simplies scrolls up the whole screen one line, which creates an empty line on the bottom while the top line will be dismissed.

Name
scrnsetloc (screen.asm)
Input D Row (starting at 0)
Input E Column (starting at 0)
Description Sets the location where the next character will be printed on the screen. Same as locate, but used with virtual screens.

Name
seekempty (flashram.asm)
Input A (optional, zero to disable) sector to skip, normally sectors 1-4 will be searched.
Input B Amount of needed blocks (1 block = 64 bytes).
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $FFFF on failure, otherwise the first block of your empty space.
Description Searches for an empty place in the flash.

Name
seeknewdirid (fs.asm)
Output A Garbage
Output BC Garbage
Output D New DID on success.
Output HL $0000 on success, $FFFF on failure.
Output IX Garbage
Description Tries to find a Directory IDentifier that is not already in use.

Name
setlock (locks.asm)
Input A Lock to set
Output A Zero on success, blocker PID on failure.
Description Tries to set a system lock

Name
setprocname (procs.asm)
Input A The PID the name should be changed of.
Input HL Pointer to string (new name of the process)
Output A Garbage.
Output BC Garbage.
Output DE Garbage.
Output HL Pointing to the end of the string, or $FFFF if the caller process doesn't exists (after which you better directly force a system reboot), which should never happen.
Description This function will name the current process, after which the given name can be found in the process-table. If the given name is longer than the table can store, it will automatically be shortened. It's called by the system when you start a program, but programs may rename themself too.

Name
setscrnloc (screen.asm)
Input DE New cursor location on the current virtual screen.
Description This function sets the location of the cursor (D = row, E = column) on the current virtual screen, without destroying registers.

Name
setupfs (loadinit.asm)
Description Format and set up a basic filesystem

Name
share_screen (screen.asm)
Output A 0 on success, otherwise PID of process that actually owns the screen
Description When this function is called, the previous "master-of-screen"-lock (previous got by the become_screen_master function) will be released so any process will be able to use the LCD display again. Usefull when designing games so the screen-manager will not interfere.

Name
shutdown (base.asm)
Description This function will power down the calculator. Called by the OS when ON and 2ND keys are pressed at the same time.

Name
sleep (timer.asm)
Input B Interrupts to sleep (see also newtimer).
Output HL Zero on success, $FFFF on failure.
Description If a program has to wait a certain amount of time, you can call this function. It will set a special flag inside the process-table, which makes the mutitasking engine just skip this process. After a specified amount of time, a timer will be triggered, which simply calls the wakeup function. This routine resets the flag, after which the process will be acting like a normal one again.

Name
standby (base.asm)
Output A Always $0B
Description This function will turn off the calculator, but when the ON-key is pressed, the calculator continous execution.

Name
startfile (fs_high.asm)
Input HL Path to the program
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $0000 on success, $FFFD if the file couldn't be found, $FFFE if the file isn't executable, $FFFF if an other error occurs.
Output IX Garbage
Description Loads a file from the filesystem into the memory and starts executing that file. The program will be started in a seperate process, and the caller will imediatly resume operation. See also execfile. For more options see startfileex.

Name
startfileex (fs_high.asm)
Input B Directory the program will start from.
Input C Virtual screen to run on.
Input DE Pointer to name of the program.
Input HL Path to the program
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $0000 on success, $FFFD if the file couldn't be found, $FFFE if the file isn't executable, $FFFF if an other error occurs.
Output IX Garbage
Description Loads a file from the filesystem into the memory and starts executing that file. The program will be started in a seperate process, and the caller will immediately resume operation. Has more options than startfile. See also execfile and startfile

Name
startinit (loadinit.asm)
Description Starts the init program. If this fails, the function tries to format the filesystem and set up some basic programs.

Name
startpgm (pgmmngr.asm)
Input HL Pointer to start of program.
Output A Garbage.
Output BC Garbage.
Output DE Garbage.
Output HL $FFFF on failure.
Output IX Garbage.
Description Starts a program after which execution is immidiatly continued.
NOTE: You should have a lock on the flash before calling this function! The lock will be freed by this function.

Name
startpgmex (pgmmngr.asm)
Input B Current directory of the process
Input C Virtual screen to run on.
Input DE Pointer to name of the program.
Input HL Pointer to start of program.
Output A Garbage.
Output BC Garbage.
Output DE Garbage.
Output HL $FFFF on failure
Output IX Garbage.
Description Extended version of startpgm.
NOTE: You should have a lock on the flash before calling this function! The lock will be freed by this function.

Name
strcat (strings.asm)
Input DE Source string
Input HL Destination String
Output A Always zero
Output DE Pointing to the end of the string
Output HL Pointing to the end of the string
Description Concatenates one string to another.

Name
strcmp (strings.asm)
Input DE Source string 1
Input HL Source string 2
Output A Garbage
Output C Garbage
Output DE Pointing to the end of the string it was given as argument + 1
Output HL $0000 if both strings were the same, $FFFF otherwise.
Description This function tests if two strings are equal.

Name
strcpy (strings.asm)
Input DE Source string
Input HL Destination String
Output DE Pointing to the end of the string
Output HL Pointing to the end of the string
Description OUT A Always zero Copies a string to a place in the memory.

Name
strlen (strings.asm)
Input DE Pointer to the string
Output A Always zero
Output DE Pointer to the end of the string
Output HL Length of the string (including trailing zero-byte)
Description Returns the length of the given string.

Name
strncat (strings.asm)
Input A Maximum number of characters to copy
Input DE Source string
Input HL Destination String
Output A Garbage
Output B Garbage
Output DE Garbage
Output HL Pointing to the end of the string
Description Same as strcat, but has a maximum limit of added characters.

Name
strncmp (strings.asm)
Input A Number of bytes to test
Input DE String 1
Input HL String 2
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $0000 if the first 'A' characters of both strings were the same, $FFFF otherwise.
Description Checks if the first X bytes of two strings are the same.

Name
strncpy (strings.asm)
Input A Maximum number of characters to copy
Input DE Source string
Input HL Destination String
Output A Garbage
Output B Garbage
Output DE Garbage
Output HL Pointing to the end of the (destination) string.
Description Same as strcpy, but has a maximum limit of copied characters.

Name
switchscrn (screen.asm)
Input A Screen to switch to
Description Switches the active virtual screen (the screen "connected" to the physical screen) to the screen A (can be 1-5, where 5 is the graphical screen, which requires a third-party window manager).

Name
sysclrflash (base.asm)
Description Will wipeout the filesystem and reboot the calculator. Handy when the filesystem is corrupted and booting fails.

Name
sysinkey (keypad.asm)
Output A ASCII value of pressed key (or zero when no key was pressed)
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description This function return the ascii code of the key currently pressed on the keypad, or a zero if no key was pressed. Special keys will return a non-printable character between 128 and 255. All characters above 127 are not conform ascii. WARNING: This function is system-wide and will also return values if the virtual screen your program is running on is currently NOT selected.

Name
timer_init (timer.asm)
Description Initialises the timer-table, sets up interrupts and enables multitasking. Is called by the OS at boot-time.

Name
to_kernel (procs.asm)
Description Make a context switch to the kernel process

Name
to_userspc (procs.asm)
Description Make a context switch to the userspace process corresponding to the process-table entry pointed to by (userspc_proc_entry)

Name
trycleansec (flashram.asm)
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $FFFF on Failure (no dead blocks or flash-driver error), $0000 on success.
Description Searches for sectors with dead blocks and tries to clean them.

Name unlink (fs_high.asm)
Input HL Path to the file.
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $FFFF on failure, something else on success.
Output IX Garbage
Output IY Garbage
Description Deletes ("kills") a file from the filesystem. In case of a directory, all files and directories inside it are also deleted.

Name
unlockpid (locks.asm)
Input A PID to unlock
Output BC Garbage
Output HL Garbage
Description Used internally to remove all locks of a certain process OUT A; Garbage

Name
waitforflashaccess (locks.asm)
Description Used to obtain a direct flash I/O read lock, waits until lock position is free

Name
waitforflashwritelock (locks.asm)
Description Used to obtain a flash write lock - waits for the lock until it's free

Name
waitforLCD (lcd.asm)
Description These days exactly the same as busywaitforLCD.

Name
waitforlock (locks.asm)
Input A lock
Output A Always Zero
Description Waits until the caller process has a lock on A

Name
waitnokey (keypad.asm)
Output A Always Zero.
Output BC Garbage
Output DE Garbage
Output HL Garbage
Description Waits until all keys are released.

Name
wakeup (timer.asm)
Input A PID to wake up.
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL Zero on success, $FFFF on failure.
Description This function wakes up a sleeping process. Under normal circumstances this function will only be called from a timer, activated by the sleep function, however it's theoretically possible to call it to wake-up a process from within another process.
NOTE: When called in a normal way (not triggered by a timer), the calling process must disable interrupts before calling (and offcourse enable them afterwards), to prevent a system crash.

Name
writeblk (flashram.asm)
Input DE Destination block (in flash-driver format, see also the OS Documentation page)
Input HL Pointer to data.
Output A Garbage
Output BC Garbage
Output DE Garbage
Output HL $FFFF on failure, pointer to end of data (source) on success.
Description Writes 1 block of data to the flash.

Name
writebyte (flashram.asm)
Input DE Destination address (a 'normal' address between $4000 and $7FFF).
Input HL Pointer to the byte to write. This byte must reside in the RAM.
Output A Garbage
Output BC Garbage
Output DE Initial value + 1
Output HL $FFFF on failure, Initial value + 1 on success.
Description Writes a single byte some place in the FLASH.

Name
writefile (fs_high.asm)
Input BC The length of the file (in bytes).
Input HL The file's path (Must reside in the RAM!!)
Input IX Pointer to the file's data (Must reside in the RAM!!)
Output A Garbage.
Output BC Garbage.
Output DE Garbage.
Output HL $0000 on success, $FFFF on failure.
Output IX Garbage.
Output IY Garbage.
Description Creates a new file. If the file already exists, it is overwritten. All files written by this function are not executable.