Micro­power

  

Volume 2 · Number 3 · July 1982

Page 22 of 37

The NAS-SYS Monitors

by J. Hargh

SCAL SPACE. DF 69

This subroutine call outputs a single space by loading the accumulator with £20 and calling the ROUT restart, £F7. The section of code which does this is the end of routine TBCD3 (DF 66), which outputs a space after the contents of HL have been printed in hexadecimal.

SCAL CRLF, DF 6A

A carriage return/​line feed is output by loading the accumulator with £0D and calling restart ROUT. The code used is the end of the next, ‘Error message’. subroutine.

SCAL ERRM, DF 6B

This subroutine prints the word ‘Error’. followed by a Carriage return to position the cursor at the start of the next line. This call is very useful for reporting input errors in machine code programs. Just print the type of error and call DF 6B; this saves six bytes (‘Error’ + CR/LF) by the use of two.

SCAL TX1, DF 6C

The main use of this subroutine call is to print out the header on each block of data for tape input/​output. The start address of the block is in the HL register pair, the length of the block in E, and the block number in D. After the header data has been received from or sent to tape it is printed out using DF 6C; the routine sums H, L, D and E into the C register, and the value obtained is used as a checksum by the Read and Write routines. SCAL TX1 really consists of a single routine which prints out the contents of HL by a call to TBCD3 (DF 66) and then exchanges the HL and DE registers. Because this section of code is preceded by a relative call to itself (D7 00), it is carried out twice The result is that first HL is printed. HL and DE are transposed, then DE is printed and HL and DE are restored to their original positions. If you use this subroutine and need the checksum, you must first set register C to zero.

SCAL SOUT, DF 6D

This routine sends up to 256 bytes of data to the serial output. On entry HL must contain the address of the start of the data to be sent, and the number of bytes must be in B. The C register is first set to zero, then each successive byte is added into C and sent to the serial port. using SCAL SRLX, DF 6F. On exit from the routine B is zero,

Page 22 of 37