All ROM functions are called using the C calling convention. Parameters are pushed onto the stack from right to left. All return values are stored in the d0 register.

Graphics Functions

void tios::DrawStrXY(WORD x,WORD y,BYTE *string,WORD color)
Prints string at (x,y) using the current font. The valid colors are:
0 - White on black
1 - Black on black
2 - XOR mode
3 - Gray on white
4 - Black on white

BYTE tios::FontSetSys(BYTE font)
Sets the current font to font. Returns the previous font. The available fonts are:
0 - Small font (seen on the status line)
1 - Normal font (seen in the menus and history text)
2 - Large font (seen on the home screen editor)

BYTE tios::FontGetSys()
Returns the current font.

void tios::DrawTo(WORD x,WORD y)
Draws a line from the graphics cursor to (x,y), moving the graphics cursor to the new position.

void tios::MoveTo(WORD x,WORD y)
Moves the graphics cursor to (x,y).

void tios::PortSet()

void tios::PortRestore()

Status Line Functions

void tios::ST_busy(WORD mode)
Switches to idle, busy, or paused. The indicator is displayed on the status bar. The valid modes are:
0 - Idle
1 - Busy
2 - Paused

void tios::ST_eraseHelp()
If a help message is currently being shown on the status bar, this function redraws the status bar, effectively removing the message.

void tios::ST_showHelp(BYTE *message)
Displays message on the status bar.

Memory Management Functions

WORD tios::HeapAlloc(LONG size)
Allocates a memory handle. Returns the handle, or 0 if out of memory.

WORD tios::HeapAllocThrow(DWORD size)
Allocates a memory handle, doing an ER_throw(ER_MEMORY) if there is not enough memory. Returns the handle to the allocated memory.

WORD tios::HeapRealloc(WORD handle,LONG newsize)
Allocates or resizes a memory handle. A new handle will be created if handle is 0. Otherwise, handle will be resized. Returns the reallocated handle, or 0 if out of memory.

void tios::HeapFree(WORD handle)
Deletes the allocated memory block handle.

void tios::HeapFreeIndir(WORD *handle)
Deletes the allocated memory block handle and sets it to zero.

Error Functions

WORD tios::ER_catch(void *ErrorFrame)
Saves the state in ErrorFrame, which is a 0x38 byte structure. The state consists of the values of a2-a7, d3-d7, and pc. It also records a pointer to the previously saved state. Returns zero on the initial call. When ER_throw is called later on, it simulates a return from ER_catch with the return value equal to the error code. The processor must be in user mode.

void tios::ER_success()
Pops the previously saved state from ER_catch off the stack.

void tios::ER_throwVar(WORD errorNum)
Restores the state saved by ER_catch, setting the return value to errorNum.

void tios::ERD_dialog(WORD errorNum)
Displays an error dialog box with the message corresponding to error code errorNum.

Link Functions

void tios::reset_link()
Resets the link interface.

WORD tios::tx_free()
Returns the number of free bytes in the transmit buffer.

BYTE tios::transmit(BYTE *buffer,WORD num)
Inserts num bytes from buffer into the link transmit buffer. Returns 0 on success, 0xFF on failure. The a0 register contains data+num on success, data on failure. The parameter num must be at least 0x01 and no greater than 0x80.

DWORD tios::receive(BYTE *buffer,WORD num)
Reads at most num bytes from the receive buffer into buffer. Returns the number of bytes actually read. The a0 register points to buffer+(number of bytes read).

void tios::flush_link()
Flushes the link transmit buffer.

C Library Functions (explanations of these functions can be found in a C library reference)

int tios::sprintf(char *buffer,char *format[,arg1,arg2,...])

int tios::strcmp(char *s1,char *s2)

DWORD tios::strlen(char *s)

int tios::strcmp(char *s1,char *s2)

int tios::strncmp(char *s1,char *s2,DWORD n)

char* tios::strncpy(char *dest,char *src,DWORD n)

char* tios::strcat(char *dest,char *src)

char* tios::strchr(char *s,int c)

void* tios::memset(void *s,int c,DWORD n)

int tios::memcmp(void *s1,void *s2,DWORD n)

void* tios::memcpy(void *dest,void *src,DWORD n)

void* tios::memmove(void *dest,void *src,DWORD n)

Window Functions

DWORD tios::WinOpen(WINDOW *window,RECT *rect,WORD flags[,BYTE *title])
Creates a window descriptor at window.

void tios::WinActivate(WINDOW *window)
Draws window as created by WinOpen.

void tios::WinClose(WINDOW *window)
Replaces background and frees memory used by window.

void tios::WinStrXY(WINDOW *window,WORD x,WORD y,BYTE *string)
Prints string to window at (x,y).

Integer Math Functions

tios::_du32u32
Input: D0.L = Unsigned 32-bit integer x
D1.L = Unsigned 32-bit integer y
Output: D1.L = y / x

tios::_ds32s32
Input: D0.L = Signed 32-bit integer x
D1.L = Signed 32-bit integer y
Output: D1.L = y / x

tios::_du16u16
Input: D0.W = Unsigned 16-bit integer x
D1.W = Unsigned 16-bit integer y
Output: D1.W = y / x

tios::_ds16u16
Input: D0.W = Signed 16-bit integer x
D1.W = Unsigned 16-bit integer y
Output: D1.W = y / x

tios::_ru32u32
Input: D0.L = Unsigned 32-bit integer x
D1.L = Unsigned 32-bit integer y
Output: D1.L = y % x

tios::_rs32s32
Input: D0.L = Signed 32-bit integer x
D1.L = Signed 32-bit integer y
Output: D1.L = y % x

tios::_ru16u16
Input: D0.W = Unsigned 16-bit integer x
D1.W = Unsigned 16-bit integer y
Output: D1.W = y % x

tios::_rs16u16
Input: D0.W = Signed 16-bit integer x
D1.W = Unsigned 16-bit integer y
Output: D1.W = y % x

Other Functions

SYM_ENTRY* tios::DerefSym(HSYM hsym)
Converts an HSYM into a pointer to a SYM_ENTRY structure. An HSYM is a 32-bit number containing a handle in its high word, and a displacement in its low word. The handle is that of the symbol list, and the displacement is that of the symbol entry within the list. Returns the pointer in the a0 register.


Back to Programming Information

Questions? Comments? E-mail me at river@gte.net
This page is maintained by Rusty Wagner