0013H
Inputs a byte from an input device.
call:
LD DE,nnnn
address of DCB
CALL 0013H
;get byte
JP NZ,NRDY
;get byte
001BH
Outputs a byte to an output device.
call:
LD DE,nnnn
address of DCB
CALL 001BH
;put byte
JP NZ,NRDY
;output dev not ready
002BH
INKEY subroutine – scans keyboard. The data is not echoed on your screen. Note that calling 0358H instead will eliminate need to save DE.
call:
PUSH DE
save
CALL 002BH
;scan keyboard – Result in Register A
POP DE
;restore
JP Z,NOKEY
;no key pressed
0033H
DISPLAY subroutine- prints character in A at current cursor position on video display. Cursor position is stored at 4020-4021. Note that calling 033AH instead will eliminate need to save DE.
call:
PUSH DE
save
LD HL,nnnn
;* optionally position cursor
LD (4020H),HL
;* before displaying byte
CALL 0033H
;dislay character
POP DE
;restore
003BH
LPRINT subroutine- prints character in A on line printer. Note that calling 039CH instead will eliminate need to save DE.
call:
PUSH DE
save
CALL 003BH
;print character
PNP DE
;restore
JP NZ,NRDY
;printer not ready
0049H
INPUT subroutine- scans keyboard and waits for key to be pressed. Note that calling 0384H instead will eliminate need to save DE.
call:
PUSH DE
save
CALL 0049H
;wait for key
POP DE
;restore
0060H
Delay loop in 14.66 microsecond increments. A value of 0 will be equal to .96 seconds.
call:
PUSH AF
;save
LD BC,nnnn
;number of delays
CALL 0060H
;delay a little
POP AF
;restore
0066H
NMI vector. Jumps here on non-maskable interrupt (ie. HALT or press of RESET button). Note- see 41BE.
0150H
SET, RESET, POINT graphics functions. You must make sure that the coordinates are within legal range.
call:
LD B,nn
x coordinate (0-127)
LD A,nn
;y coordinate (0-47)
LD H,nn
;POINT=00, RET=80H, RESET=01
CALL GRAPH
;B, A, and HL will be destroyed
LD A,(4121H)
;*if POINT was done
NR A
;*
JP Z,OFF
;* the point was off
JP ON
;* the point was on
.
.
.
GRAPH
PUSH HL
push indicator
PUSH BC
;push x coordinate
LD HL,DUMMY
;fake out BASIC’s RST8
JP 0150H
;go do the selected function
DUMMY
DEFM ‘);’
make believe this is a BASIC program
01C9H
CLS subroutine- homes cursor and clears screen.
call:
PUSH AF
save
CALL 01C9H
;cls
POP AF
;restore
02B2H
SYSTEM command- prints “*?” and waits for entry. When using the SYSTEM command, if your program machine language program has an ORG for 41BEH with a 3 byte instruction following, then that 3 byte instruction will be automaticly executed after your tape is finished loading. For example:
ORG 41BEH
JP 7000H
ORG 7000H
START
.
; first instruction of your program
.
.
END
START
02B2H
LINE INPUT subroutine- accepts a line of keyboard input terminated by ENTER or BREAK. Echoes characters typed and recognizes control functions (backspace, shift-backspace, etc.). None of these special characters ever get put into your buffer.
call:
PUSH DE
;save
LD B,nn
;maximum chars allowed to input (including terminator); register C holds what Register B was on entry
LD HL,nnnn
;address of buffer to store chars in
CALL 05D9H
;get a line of input
POP DE
;restore
JP C,BRK
;BREAK was hit
06CCH
Ref 1A19.
0A7FH
Used to pass a 06-bit value to a machine language program.
call:
CALL 0A7FH
;get value from BASIC (Results in HL)
0A9AH
Used to pass a 16-bit value back to BASIC.
call:
D HL,nnnn
;get value to give BASIC
JP 0A9AH
;Return to BASIC.
1A19H
Normal entry point for a READY in Level II or Disk BASIC. Note that it is better to jump to 06CCH because it does not cause an OM error on the first command that follows. On exit, HL= points to 1st character minus 1.
1BB2H
Prints “?”, inputs up to 241 characters from the keyboard and echoes characters typed. Data goes into BASIC’s input buffer. 0361H is the same as 1BB3H, less the prompt.
call:
PUSH AF
save
PUSH DE
CALL 1BB3H
;get input
POP DE
;restore
POP AF
1D78H
(RST10H) Finds next non-blank character in a sting. It increments through string, ignoring spaces and control characters 9 and 10 (enters) and returns when the next non-blank character is encountered.
call:
LD HL,nnnn
start address of string minus 1
CALL 1D78H
;search string. Results of non-blank character stored in Register A
JP Z,END
;found a 00 byte (end of line) or a “:” (end of statement)
JP C,NBR
;got an ASCII numeric digit
JP ALPHA
;not a numeric digit
1E5AH
ASCII integer decimal to HEX converter. On Exit, DE= HEX result and HL= points to first non-decimal character.
call:
LD HL,nnnn
address of ASCII decimal num
CALL 1E5AH
;translate to HEX
260DH
Point to the VARPTR of a variable. If the variable doesn’t exist then create it first. On exit, DE= points to VARPTR of the variable.
call:
LD HL,nnnn
;point to ASCII variable name
CALL 260DH
;look for/create it
28A7H
PRINT subroutine- prints a string of text on the video display, terminated by ENTER (13) or NULL (00), at current cursor position.
call:
PUSH DE
;save
PUSH IY
LD HL,nnnn
;address of text
CALL 28A7H
;display text
POP IY
;restore
POP DE