This page contains quick reference information for the Small Computer Monitor. You will need to be familiar with the monitor before this reference information will make much sense. The Small Computer Monitor User Guide contains the necessary detailed information and the Small Computer Monitor Tutorial will help you get started.
Monitor Command Line Interpreter
The following commands are available from the Monitor’s command line. These can be entered following the Monitor’s prompt (an asterisk character).
Command | Parameters | Function |
? | Display help | |
A | [address] | Assemble instructions |
API | <fn> [<A>] [<DE>] | Call API function |
B | [<address>] | Breakpoint set or clear |
BAUD | <device> <rate code> | Set baud rate |
CONSOLE | <device identifier> | Select console device |
D | [<address>] | Disassemble instructions |
DEVICES | List devices detected | |
DIR | List files in ROM | |
E | [<address>] | Edit memory |
F | [<flag or condition>] | Flags display or modify |
FILL | <start> <end> <byte> | Fill memory |
G | [<address>] | Go to program |
HELP | Display help | |
I | <port> | Input from port |
M | [<address>] | Memory display |
O | <port> <data> | Output to port |
R | [<register name>] | Register display or edit |
RESET | Reset monitor | |
S | [<address>] | Step one instruction |
The Monitor ROM may also include additional commands, such as “BASIC”.
Memory Map
ROM (minimum) | 10k bytes, 0x0000 to approx 0x2800 used |
RAM (minimum) | 32k bytes assumed from 0x8000 to 0xFFFF, 0xFC00 to 0xFFFF used |
Self-test (performed at reset)
Results of the test are shown via LEDs on the system’s status display port (eg. RC2014 or LiNC80 digital I/O module).
Pass | Single sweep of lights followed by all lights off |
Failed RAM | Continuous sweeping lights |
Failed serial | LED bit 0 stays on if serial port not found |
API
To call an API function from the monitor’s command line, enter:
API <function number> [<A>] [<DE>]
results displayed:
<A> <DE>
To call an API function using assembly language instructions:
LD C, <function number> RST $30
Below is a summary of the Small Computer Monitor’s Application Programming Interface (API) functions.
API | Function | On Entry | On Exit |
$00 | System reset | A = Reset type | none |
$01 | Input character waits for character | none | A = Character input |
$02 | Output character waits to complete | A = Character to output | A = Character output |
$03 | Get input status | none | NZ if character available |
$04 | Input line | A = Size DE = Address | A = Length DE = Address |
$05 | Input line default | none | A = Length DE = Address |
$06 | Output line | DE = Address | none |
$07 | Output new line | none | none |
$08 | Get version details | none | A B C D E H L = version info |
$09 | Claim jump table entry | A = Number DE = Address | none |
$0A | Delay in milliseconds | DE = Time in milliseconds | none |
$0B | Output message | A = Message number | none |
$0C | Read jump table entry | A = Entry number | DE = Address |
$0D | Select console in/out device | A = Device number | none |
$0E | Select console input device | A = Device number | none |
$0F | Select console output device | A = Device number | none |
$10 | Input char from console device | E = Device number | A = Character NZ if input ok |
$11 | Output char to console device | A = Character E = Device | NZ if output ok else A = Char |
$12 | Poll idle events | none | none |
$13 | Configure idle events | A = Mode (0=Off, 1=On) | none |
$14 | Time r1 control (A x 1ms) | A = Period DE = Address | none |
$15 | Timer 2 control (A x 10ms) | A = Period DE = Address | none |
$16 | Timer 3 control (A x 100ms) | A = Period DE = Address | none |
$17 | Output port initialise | A = Port address | A = Output byte (zero) |
$18 | Write to output port | A = Output byte | A = Output byte |
$19 | Read output port | none | A = Output byte |
$1A | Test output port bit | A = Bit (0 to 7) | A = Output masked |
$1B | Set output port bit | A = Bit (0 to 7) | A = Output byte |
$1C | Clear output port bit | A = Bit (0 to 7) | A = Output byte |
$1D | Invert output port bit | A = Bit (0 to 7) | A = Output byte |
$1E | Input port initialise | A = Port address | A = Input byte |
$1F | Read from input port | none | A = Input byte |
$20 | Test input port bit | A = Bit (0 to 7) | A = Input masked |
$21 | Set baud rate | A = Device E = Rate code | NZ flagged if ok |
$22 | Execute command line | DE = Pointer to line | Z flagged if ok |
$23 | Get pointer to command line | none | DE = Pointer to line |
$24 | Skip delimiter in command | DE = Pointer to line | A = Character DE = Pointer |
$25 | Skip non-delim. in command | DE = Pointer to line | A = Character DE = Pointer |
$26 | Get hex param from command | DE = Pointer to line | A = Status, DE = Pointer HL = Value |
$27 | Get console I/O devices | none | D = Output E = Input |
$28 | Get top of free memory | none | DE = Top of free memory |
$29 | Set top of free memory | DE = Top of free memory | none |
$2A | Read from banked RAM | DE = Address | A = Byte read |
$2B | Write to banked RAM | A = Byte DE = Address | A = Byte written |
Flag and Condition Names
Flags and test condition names are identified as follows.
Flag | Set | Clear |
Zero | Z | NZ |
Carry | C | NC |
Negative | S | NS |
Half carry | H | NH |
Parity even | Pa | NP |
Subtract | N | NN |
Condition | Flag | Description |
Zero | Z | Zero flag set |
Not zero | NZ | Zero flag clear |
Carry | C | Carry flag set |
Not carry | NC | Carry flag clear |
Negative | M | Sign flag set |
Positive | P | Sign flag clear |
Even | PE | Parity flag set |
Odd | PO | Parity flag clear |
Jump Table
Some monitor functions are directed through a jump table in RAM. This enables the routines to be replaced, as needed, with API function $09.
Entry | Function |
$00 | Non-maskable interrupt handler |
$01 | Restart $08, console character output |
$02 | Restart $10, console character input |
$03 | Restart $18, get console input status |
$04 | Restart $20, handler (not currently used) |
$05 | Restart $28, breakpoint handler |
$06 | Restart $30, API handler |
$07 | Restart $38, mode 1 interrupt handler |
$08 | Console input routine |
$09 | Console output routine |
$0A | Reserved for get console input status |
$0B | Reserved for et console output status |
$0C | Idle event handler |
$0D | Timer 1 event handler |
$0E | Timer 2 event handler |
$0F | Timer 3 event handler |
$10 | Device 1 input character (default = serial port channel A) |
$11 | Device 1 output character (default = serial port channel A) |
$12 | Device 2 input character (default = serial port channel B) |
$13 | Device 2 output character (default = serial port channel B) |
$14 | Device 3 input character |
$15 | Device 3 output character |
$16 | Device 4 input character |
$17 | Device 4 output character |
$18 | Device 5 input character |
$19 | Device 5 output character |
$1A | Device 6 input character |
$1B | Device 6 output character |
Baud Rate Codes
Baud rates are specified by baud rate codes. Either of the codes listed below can be used.
Baud rate | Rate code | Rate code |
230 400 | $1 | $23 |
115 200 | $2 | $11 |
57 600 | $3 | $57 |
38 400 | $4 | $38 |
19 200 | $5 | $19 |
14 400 | $6 | $14 |
9 600 | $7 | $96 |
4 800 | $8 | $48 |
2 400 | $9 | $24 |
1 200 | $A | $12 |
600 | $B | $60 |
300 | $C | $30 |
Console Devices
Six console devices are supported. These can be identified by either of the identifier codes listed below.
Device | Example | Identifier | Identifier |
#1 | SIO #1 port A | $1 | $A |
#2 | SIO #1 port B | $2 | $B |
#3 | SIO #2 port A | $3 | |
#4 | SIO #2 port B | $4 | |
#5 | not yet used | $5 | |
#6 | Bit-bang serial port | $6 |