SCM, v1.1, Reference

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).

CommandParametersFunction
?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
DEVICESList devices detected
DIRList 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
HELPDisplay help
I<port>Input from port
M[<address>]Memory display
O<port> <data>Output to port
R[<register name>]Register display or edit
RESETReset monitor
S[<address>]Step one instruction

The Monitor ROM may also include additional commands, such as “BASIC”.

Memory Map

ROM (minimum)8k bytes, 0x0000 to approx 0x1E00 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).

PassSingle sweep of lights followed by all lights off
Failed RAMContinuous sweeping lights
Failed serialLED 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.

APIFunctionOn EntryOn Exit
$00System resetA = Reset typenone
$01Input character
waits for character
noneA = Character
input
$02Output character
waits to complete
A = Character
to output
A = Character
output
$03Get input statusnoneNZ if character
available
$04Input lineA = Size
DE = Address
A = Length
DE = Address
$05Input line defaultnoneA = Length
DE = Address
$06Output lineDE = Addressnone
$07Output new linenonenone
$08Get version
details
noneA B C D E H L
= version info
$09Claim jump table
entry
A = Number
DE = Address
none
$0ADelay in
milliseconds
DE = Time in
milliseconds
none
$0BOutput messageA = Message
number
none
$0CRead jump table
entry
A = Entry
number
DE = Address
$0DSelect console
in/out device
A = Device
number
none
$0ESelect console
input device
A = Device
number
none
$0FSelect console
output device
A = Device
number
none
$10Input char from
console device
E = Device
number
A = Character
NZ if input ok
$11Output char to
console device
A = Character
E = Device
NZ if output ok
else A = Char
$12Poll idle
events
nonenone
$13Configure idle
events
A = Mode
(0=Off, 1=On)
none
$14Time r1 control
(A x 1ms)
A = Period
DE = Address
none
$15Timer 2 control
(A x 10ms)
A = Period
DE = Address
none
$16Timer 3 control
(A x 100ms)
A = Period
DE = Address
none
$17Output port
initialise
A = Port
address
A = Output
byte (zero)
$18Write to output
port
A = Output
byte
A = Output
byte
$19Read output
port
noneA = Output
byte
$1ATest output
port bit
A = Bit (0 to 7)A = Output
masked
$1BSet output
port bit
A = Bit (0 to 7)A = Output
byte
$1CClear output
port bit
A = Bit (0 to 7)A = Output
byte
$1DInvert output
port bit
A = Bit (0 to 7)A = Output
byte
$1EInput port
initialise
A = Port
address
A = Input
byte
$1FRead from
input port
noneA = Input
byte
$20Test input
port bit
A = Bit (0 to 7)A = Input
masked
$21Set baud rateA = Device
E = Rate code
NZ flagged
if ok
$22Execute
command line
DE = Pointer
to line
Z flagged if
ok
$23Get pointer to
command line
noneA = Pointer to
line
$24Skip delimiter
in command
DE = Pointer
to line
A = Character
DE = Pointer
$25Skip non-delim.
in command
DE = Pointer
to line
A = Character
DE = Pointer
$26Get hex param
from command
DE = Pointer
to line
A = Status,
DE = Pointer
HL = Value
$27Get console
I/O devices
noneD = Output
E = Input
$28Get top of
free memory
noneDE = Top of
free memory
$29Set top of
free memory
DE = Top of
free memory
none
$2ARead from
banked RAM
DE = AddressA = Byte
read
$2BWrite to
banked RAM
A = Byte
DE = Address
A = Byte
written

Flag and Condition Names

Flags and test condition names are identified as follows.

FlagSetClear
ZeroZNZ
CarryCNC
NegativeSNS
Half carryHNH
Parity evenPaNP
SubtractNNN
ConditionFlagDescription
ZeroZZero flag set
Not zeroNZZero flag clear
CarryCCarry flag set
Not carryNCCarry flag clear
NegativeMSign flag set
PositivePSign flag clear
EvenPEParity flag set
OddPOParity 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.

EntryFunction
$00Non-maskable interrupt handler
$01Restart $08, console character output
$02Restart $10, console character input
$03Restart $18, get console input status
$04Restart $20, handler (not currently used)
$05Restart $28, breakpoint handler
$06Restart $30, API handler
$07Restart $38, mode 1 interrupt handler
$08Console input routine
$09Console output routine
$0AReserved for get console input status
$0BReserved for et console output status
$0CIdle event handler
$0DTimer 1 event handler
$0ETimer 2 event handler
$0FTimer 3 event handler
$10Device 1 input character (default = serial port channel A)
$11Device 1 output character (default = serial port channel A)
$12Device 2 input character (default = serial port channel B)
$13Device 2 output character (default = serial port channel B)
$14Device 3 input character
$15Device 3 output character
$16Device 4 input character
$17Device 4 output character
$18Device 5 input character
$19Device 5 output character
$1ADevice 6 input character
$1BDevice 6 output character

Baud Rate Codes

Baud rates are specified by baud rate codes. Either of the codes listed below can be used.

Baud rateRate codeRate 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.

DeviceExampleIdentifierIdentifier
#1SIO #1 port A$1$A
#2SIO #1 port B$2$B
#3SIO #2 port A$3
#4SIO #2 port B$4
#5not yet used$5
#6Bit-bang serial port$6

Homebrew 8-bit retro computing