jumptable

jumptable

filesystem | kernel | sdcard | spi | textui | video |


filesystem

krn_chdir | krn_close | krn_fopen | krn_fread_byte | krn_fseek | krn_getcwd | krn_mkdir | krn_open | krn_opendir | krn_read_direntry | krn_readdir | krn_rmdir | krn_unlink | krn_update_direntry | krn_write_byte |


krn_chdir

change current directory

In
A, low byte of pointer to zero terminated string with the file path
X, high byte of pointer to zero terminated string with the file path
Out
C, C=0 on success (A=0), C=1 and A= otherwise
X, index into fd_area of the opened directory (which is FD_INDEX_CURRENT_DIR)

krn_close

close file, update dir entry and free file descriptor quietly

In
X, index into fd_area of the opened file
Out
C, 0 on success, 1 on error
A, error code

krn_fopen

open file regardless of file/dir

In
A, low byte of pointer to zero terminated string with the file path
X, high byte of pointer to zero terminated string with the file path
Y, file mode constants O_RDONLY = $01, O_WRONLY = $02, O_RDWR = $03, O_CREAT = $10, O_TRUNC = $20, O_APPEND = $40, O_EXCL = $80
Out
C, 0 on success, 1 on error
A, error code
X, index into fd_area of the opened file

krn_fread_byte

read byte from file

In
X, offset into fd_area
Out
C=0 on success and A=received byte, C=1 on error and A=error code or C=1 and A=0 (EOK) if EOF is reached

krn_fseek

seek n bytes within file denoted by the given FD

In
X - offset into fd_area
A/Y - pointer to seek_struct - @see fat32.inc
Out
C=0 on success (A=0), C=1 and A= or C=1 and A=0 (EOK) if EOF reached

krn_getcwd

get current directory

In
A, low byte of address to write the current work directory string into
Y, high byte address to write the current work directory string into
X, size of result buffer pointet to by A/X
Out
C, 0 on success, 1 on error
A, error code

krn_mkdir

create directory denoted by given path in A/X

In
A, low byte of pointer to directory string
X, high byte of pointer to directory string
Out
C, 0 on success, 1 on error
A, error code

krn_open

open file regardless of file/dir

In
A, low byte of pointer to zero terminated string with the file path
X, high byte of pointer to zero terminated string with the file path
Y, file mode constants O_RDONLY = $01, O_WRONLY = $02, O_RDWR = $03, O_CREAT = $10, O_TRUNC = $20, O_APPEND = $40, O_EXCL = $80
Out
C, 0 on success, 1 on error
A, error code
X, index into fd_area of the opened file

krn_opendir

open directory by given path starting from directory given as file descriptor

In
A/X - pointer to string with the file path
Out
C, C=0 on success (A=0), C=1 and A= otherwise
X, index into fd_area of the opened directory

krn_read_direntry

readdir expects a pointer in A/Y to store the F32DirEntry structure representing the requested FAT32 directory entry for the given fd (X).

In
X - file descriptor to fd_area of the file
A/Y - pointer to target buffer which must be .sizeof(F32DirEntry)
Out
C - C = 0 on success (A=0), C = 1 and A = otherwise. C=1/A=EOK if end of directory is reached

krn_readdir

readdir expects a pointer in A/Y to store the next F32DirEntry structure representing the next FAT32 directory entry in the directory stream pointed of directory X.

In
X - file descriptor to fd_area of the directory
A/Y - pointer to target buffer which must be .sizeof(F32DirEntry)
Out
C - C = 0 on success (A=0), C = 1 and A = otherwise. C=1/A=EOK if end of directory is reached

krn_rmdir

delete a directory entry denoted by given path in A/X

In
A, low byte of pointer to directory string
X, high byte of pointer to directory string
Out
C, 0 on success, 1 on error
A, error code

unlink (delete) a file denoted by given path in A/X

In
A, low byte of pointer to zero terminated string with the file path
X, high byte of pointer to zero terminated string with the file path
Out
C, C=0 on success (A=0), C=1 and A= otherwise

krn_update_direntry

update direntry given as pointer (A/Y) to FAT32 directory entry structure for file fd (X).

In
X - file descriptor to fd_area of the file
A/Y - pointer to direntry buffer with updated direntry data of type F32DirEntry
Out
C - C = 0 on success (A=0), C = 1 and A = otherwise. C=1/A=EOK if end of directory is reached

krn_write_byte

write byte to file

In
A, byte to write
X, offset into fs area
Out
C, 0 on success, 1 on error

kernel

krn_chrout | krn_execv | krn_getkey | krn_upload |


krn_chrout

output character

In
A, character to output

krn_execv

load PRG file at path and execute it

In
A, low byte of pointer to zero terminated string with the file path
X, high byte of pointer to zero terminated string with the file path
Out
A error code on error

krn_getkey

get byte from keyboard buffer

Out
A, fetched key
C, 1 - key was fetched, 0 - nothing fetched

krn_upload

jump to kernel XMODEM upload


sdcard

krn_sd_read_block | krn_sd_write_block |


krn_sd_read_block

Read block from SD Card

In
lba_addr, LBA address of block
sd_blkptr, target adress for the block data to be read
Out
A, error code
C, 0 - success, 1 - error
Clobbers
A,X,Y

krn_sd_write_block

Write block to SD Card

In
lba_addr, LBA address of block
sd_blkptr, target adress for the block data to be read
Out
A, error code
C, 0 - success, 1 - error
Clobbers
A,X,Y

spi

krn_spi_deselect | krn_spi_select_device | spi_r_byte | spi_rw_byte | uart_rx | uart_tx |


krn_spi_deselect

deselect all SPI devices


krn_spi_select_device

select spi device given in A. the method is aware of the current processor state, especially the interrupt flag

In
; A, spi device, one of devices see spi.inc
Out
Z = 1 spi for given device could be selected (not busy), Z=0 otherwise

spi_r_byte

read byte via SPI

Out
A, received byte
Clobbers
A,X

spi_rw_byte

transmit byte via SPI

In
A, byte to transmit
Out
A, received byte
Clobbers
A,X,Y

uart_rx

receive byte via serial interface

Out
A, received byte

uart_tx

send byte via serial interface

In
A, byte to send

textui

textui_blank | textui_cursor_onoff | textui_disable | textui_enable | textui_init | textui_reset | textui_setmode | textui_update_crs_ptr | textui_update_screen |


textui_blank

blank screen, set cursor to top left corner

In

textui_cursor_onoff

toggle the blinking cursor on if off or off if on

In

textui_disable

disable text ui - cursor will be disabled

In

textui_enable

enable text ui

In

textui_init

init the text ui if used for the first time. like kernel start or kind of

In

textui_reset

reset text ui by setting the internal state accordingly.

In

textui_setmode

set desired text mode which is either 40 (MSX TEXT 1) or 80 columns (MSX TEXT 2)

In
A - the desired mode, either VIDEO_MODE_80_COLS or 0 to reset to 40 column mode

textui_update_crs_ptr

update to new cursor position given in crs_x and crs_y zeropage locations

In

textui_update_screen

update internal state - is called on v-blank

In

video