Table of Contents

FLOS v612 Kernal Manual

The following FLOS kernal routines can be executed simply by using a “CALL name” instruction, with registers pre-set to the routines requirements (Remember to INCLUDE the labels definitions from the equates folder.)

EG:

---------------------------------------------------------------------------------

         LD HL,  my_text
         CALL    kjt_print_string

         [rest of program..]
	
my_text  DB "HELLO WORLD!",0

----------------------------------------------------------------------------------

Notes

Kernal Call Index

File System Routines

kjt_change_dirChange to subdirectory
kjt_change_volumeSelects drives VOL0: to VOL7:
kjt_check_volume_formatChecks if current volume is formatted to FAT16.
kjt_continue_file_readSame as KJT_READ_FROM_FILE except this does not set the load address/bank (uses working values instead)
kjt_create_fileMakes a new file stub
kjt_delete_dirDeletes an (empty) directory
kjt_dir_list_first_entryFind first entry in current directory
kjt_dir_list_get_entryReturns data from directory list (see output registers)
kjt_dir_list_next_entryMoves directory list pointer to the next entry
kjt_erase_fileDeletes a file
kjt_format_deviceFormats entire SD card to FAT16
kjt_get_device_infoReturns info about the storage devices
kjt_get_dir_nameReturns the name of the current directory
kjt_get_dir_clusterReturns the cluster address of the current dir
kjt_get_fs_vars_locationReturns address of Filesystem's control variables
kjt_get_total_sectorsReturns total sectors on current volume
kjt_get_volume_infoReturns data about the volumes mounted
kjt_load_fileLoads a file in its entirety from disk to RAM
kjt_make_dirCreates a new sub directory in current directory
kjt_mount_volumesInitializes the attached disk list
kjt_open_fileLooks for a file on current disk, resets file pointer etc
kjt_parent_dirMove up a directory level
kjt_root_dirGo to root directory of drive
kjt_read_from_fileReads data from the opened file to RAM
kjt_rename_fileRenames files and directories
kjt_restore_dir_positionLegacy routine: In preference, use KJT_SET_DIR_CLUSTER with previously saved value in DE
kjt_save_fileCreates and saves a file from RAM to disk
kjt_set_dir_clusterSets the dir from a cluster address
kjt_set_file_pointerMoves the read point from the start of a file
kjt_set_load_addressSpecifies the load address and bank for a file read (when using KJT_continue_file_read)
kjt_set_read_lengthSets the read length of a file transfer to a certain value
kjt_store_dir_positionLegacy routine: In preference, Use KJT_GET_DIR_CLUSTER and save DE externally
kjt_write_to_fileAppends new data to an existing file
kjt_parse_pathChanges volume / directory according to a path string (basically, run the CD command)

Low-Level Sector Access Routines

kjt_file_sector_listTo list the disk sectors that files occupy
kjt_get_sector_read_addrReturns data and pointers allowing sector buffer relocation etc
kjt_read_sectorLoads 512 byte sector to the sector buffer
kjt_write_sectorWrites 512 byte sector to the current device

Kernal Serial Comms Routines

kjt_serial_receive_headerWaits for a file header from serial port
kjt_serial_receive_fileReceives serial file data
kjt_serial_rx_byteWait for a byte from serial port
kjt_serial_send_fileSends a file to serial port (Serial Link App format)
kjt_serial_tx_byteSend a byte to serial port

Kernal Keyboard And Mouse Routines

kjt_enable_mouseActivates mouse driver (enables IRQ etc)
kjt_get_keyReturns value of key, if one has been pressed (does not wait)
kjt_get_key_bufferAllows monitoring of the keyboard without affecting the buffer
kjt_get_key_mod_flagsReturns status of the shift, ctrl, alt etc keys
kjt_get_mouse_positionReturns absolute mouse position and button data
kjt_get_mouse_motionReturns relative mouse displacement
kjt_keyboard_irq_codeAllows external apps to invoke FLOS keybaord IRQ code
kjt_mouse_irq_codeAllows external apps to invoke FLOS mouse IRQ code
kjt_wait_key_pressPauses until a key is pressed

Kernal Text and Display Routines

kjt_clear_screenClears OS screen and sets cursor position to top left (0,0)
kjt_draw_cursorDraws (or removes) the cursor at the current cursor position
kjt_flos_displayRenamed to kjt_flos_settings
kjt_get_coloursReturns RGB values of the FLOS border, paper, cursor and colour list location
kjt_get_cursor_positionReturns the current cursor position
kjt_get_display_sizeReturns size of OS_window
kjt_get_charmap_addr_xyReturns the charmap address of coordinates x,y
kjt_get_input_stringWaits for user to enter a string of characters
kjt_get_penReturns current pen colour
kjt_patch_fontAllows easy (and individual) user defined characters in the FLOS font
kjt_plot_charPrints character at given coords using current pen colours
kjt_print_stringPrints ASCII text string at the current cursor position
kjt_scroll_upScrolls the screen (and character map) up a line
kjt_set_coloursSets FLOS border, paper and cursor colours and writes to the pen colour list
kjt_set_cursor_positionRepositions the text printing (cursor) position
kjt_set_penChanges current pen colour
kjt_wait_vrtWait for vertical retrace (IE: last scanline of display)

Kernal Memory Management Routines

kjt_inc_bankChange to the next bank
kjt_get_bankReturns the current bank number in A
kjt_get_flos_bankReturns the bank seelcted by FLOS before the current command executed
kjt_page_in_videoPages video memory into $2000-$3FFF
kjt_page_out_videoPages system memory into $2000-$3FFF
kjt_read_sysram_flatRead flat system memory location (E:HL) into A
kjt_read_baddrReads a byte into A from address BANK:ADDRESS
kjt_set_bankSwitches the upper RAM page to a specific bank
kjt_write_baddrWrites a byte from A into address BANK:ADDRESS
kjt_write_sysram_flatWrite A into flat system memory location (E:HL)

Kernal Misc Routines

kjt_ascii_to_hex_wordConverts ASCII hex number at HL to numeric 16bit hex in DE
kjt_ascii_to_hex32Converts ASCII hex number at HL to numeric 32bit hex in BC:DE
kjt_bchl_memfillFill memory with value in accumulator
kjt_compare_stringsCompares two ASCII strings
kjt_dont_store_registersStops FLOS updating the stored register values when program quits
kjt_get_versionReturns FLOS and OSCA version
kjt_hex_byte_to_asciiMakes ASCII version of a numeric hex byte
kjt_set_commanderSpecifies a command string to be run when programs exit
kjt_timer_waitWaits n periods of 16 microseconds and returns
kjt_flos_settingsRestores the FLOS video mode, sets up FLOS IRQs, clears keyboard buffer etc

Environment Variable Routines

kjt_delete_envarDeletes an environment variable
kjt_get_envarGets (address of) value of an environment variable
kjt_set_envarSets/updates an environment variable



Some Details:

There are two main ways to load a file, a simple single-call approach and a more flexible random-access approach.

To do a simple file load, set HL to a zero terminated ASCII filename string, IX to the destination address and B to the destination bank, then call “kjt_load_file” Check the return code - see table below - if the zero flag is set, everything is OK.

The more flexible way to load file data is as follows: Set HL to a zero terminated ASCII filename string and call “kjt_open_file”. If the zero flag is set on return, the file was found and the length of the file will be in IX:IY (if the zero flag is not set, check the error code).

Next, the following two routines can be called *if required*

kjt_set_file_pointer” - This allows data to be read from anywhere within a file, instead of right from the start. Registers required:

kjt_set_read_length” - This allows the length of transfer to be set. Registers required:

Finally, call “kjt_read_from_file” to transfer the data to memory. Registers required:

Again, on return, if the zero flag is set then the operation completed OK.

The file pointer is automatically incremented by the number of bytes transferred, therefore it is not necessary call “kjt_set_file_pointer” each time if chunks of a file are required sequentially. Attempting to read beyond the end of a file will return an error (code $1B). The load length MUST be set for each read (and load address and bank set appropriately each call).

To maintain speed, a fresh seek from the start of the file is not performed each time “kjt_read_from_file” is called unless the file pointer has been changed. Internal variables must be maintained, therefore do not perform any other disk / serial operations (or anything that changes the sector buffer) between successive calls to this routine.

Whenever a disk file transfer reaches address $FFFF, it wraps around to $8000 and continues on into the next bank.

Most of the file system kernal calls return one of these standard error codes:

$01disk full
$02file not found
$03(root) dir table is full
$04directory requested is actually a file
$05can't delete dir, it is not empty
$06not a file
$07file length is zero
$08address error (file too big for memory)
$09filename already exists
$0aalready at root directory
$0einvalid volume
$13unknown/incorrect disk format
$1brequested bytes beyond end of file
$22device not present
$23directory not found
$24end of directory list
$2edevice does not use MBR

Advanced:

In FLOS v599 the following routines were added to allow external programs to hook into the filesystem variables used by FLOS:

kjt_get_fs_vars_location

The data at the returned location (see link for format) can be backed up and restored by a user program, allowing multiple open files to managed etc.

Notes:

Additionally, the following two new routines were added:

kjt_continue_file_read
kjt_set_load_address

The normal file read call kjt_read_from_file requires the bank and address to be specified, which may be a nuisance when working with multiple files. With the kjt_continue_file_read routine, the file bytes are written to an address from the end of the last read operation. kjt_set_load_address sets the address and bank to a specific location.


kjt_check_volume_format

Action: Checks if current volume is available and formatted to FAT16

Input Registers :

Output Registers :



kjt_change_volume

Action: Selects a new volume (the directory will be that which was last selected in the new volume)

Input Registers :

Output Registers :

Note: Will not allow a change to an invalid Volume (non-FAT16 etc)


kjt_format_device

Action: Formats a device (entire drive as single partition, no MBR)

Input Registers :

Output Registers :

Note: It is highly recommended that “kjt_mount_volumes” is called after this routine.


kjt_make_dir

Action: Creates a new sub directory in current directory

Input Registers :

Output Registers :



kjt_change_dir

Action: Change to subdirectory

Input Registers :

Output Registers :



kjt_parent_dir

Action: Move up a directory level

Input Registers :

Output Registers :



kjt_root_dir

Action: Go to root directory of volume

Input Registers :

Output Registers :



kjt_delete_dir

Action: Deletes an (empty) subdirectory

Input Registers :

Output Registers :



kjt_erase_file

Action: Deletes a file in the current directory

Input Registers:

Output Registers :



kjt_get_total_sectors

Action: Returns total sectors on current volume

Input Registers :

Output Registers :



kjt_load_file

Action: Loads the specified file from current directory in its entirity to the specifed address.

Input registers :

Output registers :

Note: This routine both opens a file and reads all the data to RAM - for more flexibility use “kjt_open_file”, “kjt_set_file_pointer”, “kjt_set_read_length” and “kjt_read_file_data


kjt_save_file

Action: Saves a file to current directory.

Input registers:

Output registers:

Note: This routine both creates a new file and saves data to it - it cannot be used append new data to an existing file (will return “file already exists” error if attempted).


kjt_open_file

Action: Looks for a file in current directory and sets internal registers ready for ”kjt_read_from_file” call.

Input Registers :

Output Registers :
If the Zero Flag is set: All OK. Registers are:

If zero flag is not set: standard error codes.

Note: File pointer is set to 0, default transfer length = total file size


kjt_set_file_pointer

Action: Moves the read point from the start of a file

Input Registers :

Output Registers :

Note: Use after “kjt_open_file” (if required)


kjt_set_read_length

Action: Forces the read length of the file transfer to a certain value

Input Registers :

Output Registers :

Note: Use after kjt_find_file (if desired)


kjt_read_from_file

Action: Loads data (from the previously opened file) to a specified address.

Input Registers :

Output Registers :

Notes



kjt_create_file

Action: Makes a file stub for a new file in current directory.

Input Registers :

Output Registers :



kjt_write_to_file

Action: Appends new data to an existing file in current directory.

Input Registers :

Output Registers :

Note: Returns “file not found” error if the file has not been previously created with “kjt_create_file” or “kjt_save_file


kjt_dir_list_first_entry

Action: Finds the first listing of current directory, returns info.

Input registers:

Output registers:
If zero flag is set:

If zero flag is not set, standard error codes (EG: $24 = Reached end of directory)


kjt_dir_list_get_entry

Action: Returns data about the entry at the current position in the directory list.

Input registers :

Output registers :
If zero flag is set:

If zero flag is not set, standard error codes (EG: $24 = Reached end of directory)


kjt_dir_list_next_entry

Action: Moves the internal directory list pointer to the next entry and returns details about the entry found

Input registers :

Output registers:
If zero flag is set:

If zero flag is not set, standard error codes (EG: $24 = Reached end of directory)


kjt_get_dir_name

Action: Returns ascii string of current directory name (null terminated)

Input registers :

Output registers :
If zero flag set:

If zero flag is not set, standard error codes


kjt_mount_volumes

Action: Reinitializes the drives and mount list

Input registers :

Output registers :

Note: Also attempts to create the assign Envar 'EX0' for VOL0:COMMANDS (FLOS v609+)


kjt_get_volume_info

Action: Returns info about the volumes mounted.

Input Registers :

Output Registers :



kjt_get_device_info

Action: Returns info from the device list.

Input Registers :

Output Registers :



kjt_get_dir_cluster

Action: Returns the location of the directory cluster

Input Registers :

Output Registers :



kjt_set_dir_cluster

Action: Sets the directory cluster (for use with above command)

Input Registers :

Output Registers :

Note: The routine attempts to validate the dir by looking for the directory name, if this fails, the dir is set to ROOT and error code $23 is returned (DIR not found).


kjt_rename_file

Action: Rename files / folders.

Input Registers :

Output Registers :



kjt_get_fs_vars_location

Action: Sets HL to the address of the filesystem's control variables.

Input Registers :

Output Registers :

$00 bytefs_filepointer_valid
$01 longwordfs_file_pointer
$05 longwordfs_file_length
$09 longwordfs_bytes_to_go
$0d wordfs_file_start_cluster
$0f wordfs_file_working_cluster
$11 wordfs_z80_address
$13 bytefs_z80_bank

Note: When restoring altered data, the first byte “fs_filepointer_valid” should always be cleared. This causes the read operations to cleanly seek from the beginning of files when file transfer (re)commences. (Access will be noticeably slower than a single continuous load.)


kjt_continue_file_read

Action: Same as kjt_read_from_file except this does not set the load address/bank

Input Registers :

Output Registers :



kjt_set_load_address

Action: Specifies the load address and bank for a file read (when using kjt_continue_file_read)

Input Registers :

Output Registers :



kjt_parse_path

(added in FLOS v607)

Action: Changes volume and directory according to the path string supplied. This is basically the same as the “CD” command.

Input Registers :

Output Registers :

Note: If the path is invalid (dir or volume not found) an error code is returned and the dir remains unchanged.


Low-Level Disk Sector Access Routines

kjt_read_sector

Action: Loads a 512 byte sector from the device and address selected to the sector buffer

Input registers :

Output registers :



kjt_write_sector

Action: Writes a 512 byte sector from the sector buffer to the device and address selected

Input registers :

Output registers :



kjt_file_sector_list

Action: Retrieves the location of the (next) disk sector that a file occupies.

Input registers:

Output registers:

How to use:

To obtain the list of sectors that a file uses, first call ”kjt_find_file” with the filename in HL as normal. On exit, DE will be equal the first cluster that the file occupies. Clear the accumulator (as we're starting at the first sector of this cluster), and call “kjt_file_sector_list”. On return A and DE are updated to the values required for the next time the routine is called and HL points to the lowest significant byte of the sector address (LBA0). Next, copy the 4 bytes from HL to HL+3 to your sector list buffer and loop around, calling “kjt_file_sector_list” for as many sectors as are used by the file (simply subtract 512 from a variable holding the file size every call until variable is = < 0)


kjt_get_sector_read_addr

Action: Returns the address of the selected drive's sector read routine, also LBA variable and sector_location_variable

Input Registers :

Output Registers :

Notes



Serial I/O Routines

To load a file serially you would call: kjt_serial_receive_header, setting A and HL as appropriate (see docs below). Once it has been received, kjt_serial_receive_file may be called (setting B and HL appropriately).

As with the disk routines, whenever a serial file transfer command reaches address $FFFF, it wraps around to $8000 and continues onto the next bank.


kjt_serial_receive_header

Action: Waits for a file header from serial port.

Input Registers :

Bits 5:0Waiting time in seconds before time out error
Bit 6Allow abort with Enter Key (if 1)
Bit 7Allow abort with ESC Key (if 1)

Output Registers :
Zero Flag: If set, all OK

If Zero Flag is NOT set, A = serial error code:

$07Save length is zero
$08File too big (IE: Memory address out of range)
$0fChecksum bad
$11Comms error
$14Time out error
$25Filename mismatch
$2AAborted with ESC / Enter key



kjt_serial_receive_file

Action: Receives serial file data

Input Registers :

Output Registers :
Zero Flag: If set, all OK

If Zero Flag is NOT set, A = serial error code:

$07Save length is zero
$08File too big (IE: Memory address out of range)
$0fChecksum bad
$11Comms error
$14Time out error
$25Filename mismatch

Note:kjt_serial_receive_header” MUST be called before this routine!


kjt_serial_send_file

Action: Sends a file to serial port (Serial Link App format)

Input Registers :

Output Registers :
Zero flag, set if all OK.

If zero flag not set, A = serial error code:

$07Save length is zero
$08File too big (IE: Memory address out of range)
$0fChecksum bad
$11Comms error
$14Time out error
$25Filename mismatch



kjt_serial_rx_byte

Action: Wait for a byte from serial port

Input Registers :

[0:5]max time to wait in seconds
[6]If set, the wait can be aborted with the ENTER key
[7]If set, the wait can be aborted with ESCAPE key

Output Registers :
If Carry flag is clear all OK, A = byte received.

If Carry flag is set, error code in A as follows:
A = $14 - Timed out
A = $2A - Aborted with key

Note: All registers except A are preserved.


kjt_serial_tx_byte

Action: Send a byte to serial port

Input Registers :

Output Registers :

Note: All registers except A preserved.


Keyboard And Mouse Routines

kjt_wait_key_press

Action: Pauses until a key is pressed (and returns value)

Input Registers :

Output Registers :

Note: ASCII code is modified by shift / Alt key status


kjt_get_key

Action: Returns value of key, if one has been pressed (does not wait)

Input Registers :

Output Registers :

Note: ASCII code is modified by shift / Alt key status


kjt_get_key_mod_flags

Action: Returns current status of key modifiers

Input Registers :

Output Registers :

[0]left shift
[1]left/right ctrl
[2]left GUI
[3]left/right alt
[4]right shift
[5]right GUI
[6]Apps



kjt_keyboard_irq_code

Action: Keyboard IRQ handler.

When a custom interrupt handler is set up but kernal-based keyboard handling is required, this routine can be called when the keyboard IRQ flag is set. The above kernal keyboard routines will then still work. (The call clears the relevant IRQ flag).


kjt_enable_mouse

Action: Activates mouse pointer (called by MOUSE.EXE) and sets x/y boundaries

Input Registers :

Output Registers :



kjt_get_mouse_position

Action: Returns absolute mouse position and button data

Input Registers : none

Output Registers : Zero Flag - If not set, the mouse driver was not enabled, otherwise: HL = x coordinate DE = y coordinate A = buttons status

The x and y coordinates cannot overflow from the boundaries set with “kjt_enable_mouse

Note: the mouse driver is currently somewhat primative - it may become out of sync with the three-byte packets that the mouse sends if say, interrupts are disabled)


kjt_get_mouse_motion

Action: Returns relative mouse motion and button data

Input Registers :

Output Registers :
Zero Flag: if not set, the mouse driver was not enabled, Otherwise:

Note: the mouse driver is currently somewhat primitive - it may become out of sync with the three-byte packets that the mouse sends if say, interrupts are disabled


kjt_mouse_irq_code

Action: Mouse IRQ handler

When a custom interrupt handler is set up but kernal-based mouse handling is required, this routine can be called when the mouse IRQ flag is set. The above kernal mouse routines will then still work. (The call clears the relevant IRQ flag).


kjt_get_key_buffer

Action: Returns values for monitoring the keyboard buffer

Input Registers :

Output Registers :
* HL = Location of the keyboard buffer WRITE index variable (The actual keyboard buffer starts 32 bytes lower in memory) * A = The value of the keyboard READ index variable.

Note: On return, if A = (HL) no key has been pressed (IE: the keyboard buffer is empty)


Memory Mamagement Routines

Under FLOS, Z80 Address space $5000-$FFFF is available for user programs. FLOS allows the upper 32KB of Z80 address space ($8000-$FFFF) to be paged. 15 pages of system RAM can appear in this region, starting at system RAM address $08000 (FLOS does not normally allow the first 32KB of system RAM to be paged into $8000-$FFFF). Therefore, when using the KJT routines for bank management, the figures are as follows:

BankSYSTEM RAMZ80 ADDRESS
$00$08000-$0ffff$8000-$ffff
$01$10000-$17fff$8000-$ffff
$02$18000-$1ffff$8000-$ffff
$03$20000-$27fff$8000-$ffff
$04$28000-$2ffff$8000-$ffff
$05$30000-$37fff$8000-$ffff
$06$38000-$3ffff$8000-$ffff
$07$40000-$47fff$8000-$ffff
$08$48000-$4ffff$8000-$ffff
$09$50000-$57fff$8000-$ffff
$0a$58000-$5ffff$8000-$ffff
$0b$60000-$67fff$8000-$ffff
$0c$68000-$6ffff$8000-$ffff
$0d$70000-$77fff$8000-$ffff
$0e$78000-$7ffff$8000-$ffff

(Notice that the figures are different to the values used if writing directly to the bank selection hardware port: sys_mem_select).


kjt_set_bank

Action: Changes the currently selected upper RAM page

Input Registers : A = bank number $00 to $0e

Output Registers : none

Trashes: A


kjt_get_bank

Action: Returns the upper bank number in A

Input Registers : none

Output Registers : A = current bank number ($00 to $0e)

Trashes: none


kjt_inc_bank

Action: change to the next bank

Input Registers : none

Output Registers : If Zero flag set: all OK, If Zero is not set: A = $08 - bank out of range


kjt_page_in_video

Action: Pages 8KB of video memory specified by (hardware register vreg_vidpage) into Z80 address space $2000-$3FFF.

CAUTION: This area is used by part of FLOS so ideally no other FLOS call should be made until kjt_page_out_video is called.

Input Registers :

Output Registers :

Trashes :



kjt_page_out_video

Action: Pages normal system memory (part of the FLOS!) back into $2000-$3FFF

Input Registers :

Output Registers :

Trashes :



kjt_read_sysram_flat

Action: Reads system memory in a flat, linear addressing mode

Input Registers :

Output Registers :

Trashes :

Notes



kjt_write_sysram_flat

Action: Writes to system memory in a flat, linear addressing mode

Input Registers :

Output Registers :

Trashes :

Notes



kjt_read_baddr

Action: Reads a byte from system memory (allows programs in paged RAM (8000-FFFF) to easily read data from a different bank)

Input Registers :

Output registers :

Notes



kjt_write_baddr

Action: Writes a byte to system memory, allows programs in paged RAM (8000-FFFF) to write data to a different bank

Input Registers :

Output Registers :

Notes



kjt_get_flos_bank

Action: Returns the value of the bank being used by FLOS before the current command executed.

This is useful when a location header places a program in paged memory ($8000-$FFFF) thus changing the bank selection to that of the program, but the program wants to act on the memory in the bank selected by FLOS as if it were an internal command.

Input Registers :

Output Registers :



Text And Display Routines

kjt_print_string

Action: Prints null-terminated ASCII text string at cursor position

Input Registers :

Output Registers :

Notes

All other registers are preserved by this routine.

This routine moves the current cursor position.


kjt_clear_screen

Action: clears OS screen and set cursor position to top left (0,0)

Input Registers :

Output Registers :



kjt_plot_char

Action: Prints ASCII character at supplied coordinates using current pen colours

Input Registers :

Output Registers :

Notes



kjt_get_pen

Action: Returns current pen colour

Input Registers :

Output Registers :

Available (default) colours:

0transparent (shows UI “paper” colour)
1black
2blue
3red
4magenta
5green
6cyan
7yellow
8white
9dark grey
amid grey
blight grey
corange
dlight blue
elight green
fbrown



kjt_set_pen

Action: Changes current pen colour

Input Registers :

Available (default) colours:

0transparent (shows UI “paper” colour)
1black
2blue
3red
4magenta
5green
6cyan
7yellow
8white
9dark grey
amid grey
blight grey
corange
dlight blue
elight green
fbrown

Output Registers :



kjt_get_colours

Action: Returns the location of the FLOS colour list.

Input registers :

Output registers :

Colour List :
+$00 - Paper
+$02 - Border
+$04 - Cursor
+$06 - 15 pen colours starting with pen 1

Note: FLOS stores its colour list under the hardware registers so system memory needs to paged into that region if writing directly to the address returned from this call. (Simply reading the list poses no such problem). In all cases, kjt_set_colours needs to be called to actually change the palette (unless writing directly to the Hardware Palette Registers)


kjt_set_colours

Action: Sets FLOS border, paper and cursor colours and updates the pen colour list

Input registers :

Colour List :
+$00 - Paper
+$02 - Border
+$04 - Cursor
+$06 - 15 pen colours starting with pen 1

Output registers :

Input registers are trashed.

Note: Changes persist until FLOS restarts (whereas any changes made with the FLOS command “COLOUR” are permanent until reset)


kjt_draw_cursor

Action: Draws (or removes) the cursor at the current cursor position

Input Registers :

$0000 - $07FFAll zeroes
$0800 - $0FFFRaster font image (256 horizontal bytes * 8 vertical bytes)
$1000 - $17FFAs above but with the bits inverted
$1800 - $1FFFAll ones
 EG: 

 HL = $0000 : No data, IE: Delete the cursor
 HL = $085f : Underscore cursor ($800-$8ff = top line of  ASCII chars 0-255)
 HL=  $1800 : Solid block cursor

Output Registers :

Note: Remember, kjt_print_string moves the cursor position so the cursor image should be deleted before that routine is called.


kjt_get_input_string

Action: waits for user to enter a string of characters followed by Enter (characters appear on screen)

Input Registers :

Output Registers :



kjt_set_cursor_position

Action: Repositions the text printing (cursor) position. If a coordinate is out of range it will be set to 0.

Input Registers :

Output Registers :



kjt_get_cursor_position

Action: Returns the current cursor position

Input Registers :

Output registers :



kjt_scroll_up

Action: Scrolls the screen (and character map) up a line, inserting a blank line at the bottom of the screen.

Input Registers :

Output registers :



kjt_get_display_size

Action: Returns size of OS_window.

Input registers :

Output registers :

Note: All other registers preserved.


kjt_get_charmap_addr_xy

Action: Returns the charmap address of the character at coordinates x,y

Input registers :

Output registers :

Note: All other registers are preserved.


kjt_wait_vrt

Action: Wait for last scanline of display

Input Registers :

Output Registers :

Trashes:



kjt_patch_font

Action: Change an individual character in the FLOS font.

Input registers :

Output registers :



Misc Routines

kjt_hex_byte_to_ascii

Action: puts ASCII version of the hex byte value in A at HL (two chars), HL=HL+2

Input Registers :

Output Registers :

Note: HL=HL+2

Trashes :



kjt_ascii_to_hex_word

Action: converts text string version of hex number at HL to actual hex word in DE

Input Registers :

Output Registers :

A = $0cBad chars for hex
A = $1ANumber is greater than $FFFF
A = $1FNo chars found



kjt_ascii_to_hex32

Action: converts text string version of hex number at HL to actual hex word in BC:DE

Input Registers :

Output Registers :

A = $0cBad chars for hex
A = $1ANumber is greater than $FFFFFFFF
A = $1FNo chars found



kjt_dont_store_registers

Action: Prevents the OS from noting the register values when a program exits and returns to OS.

Input Registers :

Output Registers :

Trashes :



kjt_get_version

Action: Returns FLOS / OSCA / BOOTCODE version values (also reports the V6Z80P PCB version if OSCA > version $673.)

Input Registers :

Output Registers :

0Data is not available (because OSCA < 674 or FLOS < 610)
1Original V6Z80P
2V6Z80P+
3V6Z80P+ V1.1

Also, if C = 0:

$0 [WORD]Bootcode version (BCD) (if $0000 = Bootcode is < version $617)
$2 [BYTE]Devices available at boot time (Bit 0 = SD card)
$3 [BYTE]Device OS booted from (1=SD CARD, 2=EEPROM, 3=SERIAL)

If C <> 0 : FLOS < 610 = data not available


kjt_compare_strings

Action: Compares two ASCII strings (not case sensitive)

Input Registers :

Output Registers :

Notes



kjt_bchl_memfill

Action: Fill memory with value in accumulator

Input Registers :

Output Registers :

Trashes :

Note: Does NOT overflow from $FFFF into next bank.


kjt_timer_wait

Action: Waits n x 16 microseconds and returns.

Input Registers :

Output Registers:

Note: Preserves all registers except A


kjt_set_commander

Action: Sets a “permanent” command string that is to be launched when progams exit

Input Registers :

Output Registers :

Notes\



kjt_flos_settings

Action: Restores the video registers and IRQ vectors/enables to the state used by the OS. Also clears the keyboard buffer. Can be called by programs that have changed the display mode etc before exit so that FLOS does not have to be completely restarted.

Note: This does not restore the data in the Video RAM area used by FLOS ($10000-$1ffff).

Input registers :

Output registers :



kjt_set_envar

Action: Sets an environment variable (or updates a variable if it already exists)

Input Registers :

Output Registers :



kjt_get_envar

Action: gets (address of) value of an environment variable

Input Registers :

Output Registers :



kjt_delete_envar

Action: deletes an environment variable

Input Registers :

Output Registers :