Foenix Kernel Documentation
Kernel Essentials
On the FMX, the Foenix Kernel resides in bank $39 of the system RAM. It provides for the initialization of the hardware and a certain minimalist level of access to the hardware.
Kernel routines are called through a kernel jump table that starts at $00:1000.
All kernel routines must be called using the JSL instruction (long, or 24-bit subroutine call), since they all terminate with an RTL.
This allows the kernel routines to be called from anywhere in system memory.
Kernel Calls
Name |
Address |
Description
|
BOOT |
$00:1000 |
Cold boot routine
|
PUTC |
$00:1018 |
Print a character to the currently selected channel
Register |
Width |
Contents
|
A |
8 |
ASCII code of the character to print
|
|
PUTS |
$00:101C |
Print a null-terminated ASCII string to the currently selected channel
Register |
Width |
Contents
|
B |
8 |
Bank containing the data to print
|
X |
16 |
Address within that bank of the first character to print
|
|
SETIN |
$00:1038 |
Set the current input channel used by the GET subroutines
Register |
Width |
Contents
|
A |
8 |
Input channel to use
- 0 = Keyboard
- 1 = COM1 (external serial)
- 2 = COM2 (internal serial)
|
|
SETOUT |
$00:103C |
Set the current output channel used by the PUT subroutines
Register |
Width |
Contents
|
A |
8 |
Input channel to use
- 0 = Screen
- 1 = COM1 (external serial)
- 2 = COM2 (internal serial)
|
|
GETCHW |
$00:104C |
Get a character from the input channel. Waits until data received. A=0 and Carry=1 if no data is waiting
|
GETCHE |
$00:1050 |
Get a character from the input channel and echo to the screen. Wait if data is not ready.
|
PRINTCR |
$00:106C |
Print Carriage Return
|
PRINTH |
$00:1078 |
Print hex value in memory.
Register |
Width |
Contents
|
B |
8 |
Bank containing the data to print
|
X |
16 |
Address within that bank of the last byte to print
|
Y |
16 |
Number of bytes to print
|
|
PRINTAH |
$00:1080 |
Prints hex value in A. Printed value is 2 wide if M flag is 1, 4 wide if M |
0
|
LOCATE |
$00:1084 |
Move the cursor to a new position on the screen.
Register |
Width |
Contents
|
X |
16 |
The column for the cursor
|
Y |
16 |
The row for the cursor
|
|
CSRRIGHT |
$00:1090 |
Move the cursor one position to the right
|
CSRLEFT |
$00:1094 |
Move the cursor one position to the left
|
CSRUP |
$00:1098 |
Move the cursor up one row
|
CSRDOWN |
$00:109C |
Move the cursor down one row
|
CSRHOME |
$00:10A0 |
Move the cursor to the upper-left corner
|
SCROLLUP |
$00:10A4 |
Scroll the screen up one line. Creates an empty line at the bottom.
|
CLRSCREEN |
$00:10B0 |
Clear the screen
|
INITCHLUT |
$00:10B4 |
Init character look-up table
|
INITSUPERIO |
$00:10B8 |
Init Super-IO chip
|
INITKEYBOARD |
$00:10BC |
Init keyboard
|
INITRTC |
$00:10C0 |
Init Real-Time Clock
|
INITCURSOR |
$00:10C4 |
Init the Cursors registers
|
INITFONTSET |
$00:10C8 |
Init the Internal FONT Memory
|
INITGAMMATABLE |
$00:10CC |
Init the RGB GAMMA Look Up Table
|
INITALLLUT |
$00:10D0 |
Init the Graphic Engine (Bitmap/Tile/Sprites) LUT
|
INITVKYTXTMODE |
$00:10D4 |
Init the Text Mode @ Reset Time
|
INITVKYGRPMODE |
$00:10D8 |
Init the Basic Registers for the Graphic Mode
|
Console Special Characters
The console routines support several special control codes for both input and output.
When the key on the keyboard is pressed, the associated code is returned by the GET routines.
If the code is printed through the PUTC or PUTS, the associated operation will be performed on the screen.
Note that this means that any graphics characters associated with those code points will not be displayed by PUTC or PUTS.
If those characters must be displayed, they would have to be written to the text memory directly.
Code |
Name |
Keyboard |
Description
|
$08 |
BS |
Backspace |
Deletes the character to the left of the cursor, pulling characters in from the right.
|
$09 |
TAB |
TAB |
Moves the cursor right to the next tabulated column (every eight columns).
|
$0A |
LF |
N/A |
Puts the cursor at column 0 on the next line on the same column.
|
$0D |
CR |
RETURN |
Creates a newline on the screen. Puts the cursor at column 0 on the next line.
|
$0F |
INS |
Insert |
Inserts a blank space under the cursor (pushing characters to the right).
|
$11 |
UP |
Up Arrow |
Moves the cursor up one row.
|
$1D |
RIGHT |
Right Arrow |
Moves the cursor right one column. May wrap to the next line.
|
$7F |
DEL |
Delete |
Deletes the character under the cursor, pulling characters in from the right.
|
$91 |
DOWN |
Down Arrow |
Moves the cursor down one row. May scroll the screen.
|
$9D |
LEFT |
Left Arrow |
Moves the cursor left one column.
|
Special Kernel Variables