July 1982, Volume 2, Number 3

Page 23 of 37

8 contains the checksum for the data. and HL points to the next byte following the data. Note that 1f B is zero on entry, 256 bytes will be output.


XOUT provides facilities for communication with external serial devices. On entry the contents of the accumulator are saved on the stack and HL is set to point to $XOPT (£0028), which is the byte used to store the flags for the various options available with XOUT. ‘The value stored at $XOPT is controlled by the X command; it 15 alsa affected by characters input via the XKBD routine.

The state of bit 7 of XOPT 15 first tested. If bit 7 is 1, the character is not output and the routine terminates by resetting bit 7 to zero (so that only one character at a time 15 suppressed) and recovering the accumulator from the stack. If bit 7 15 zero, the character is output by a cal to an external serial output routine , XSOF, before the routine is terminated as above.

XSOP outputs the character in the accumulator by a relative call to a subroutine, XSOPO. Here the accumulator is ORed, which sets the zero flag if the accumulator

contained a null (00). In Nas-Sys 1 the subroutine is terminated if a null is found; thus the Nas-Sys 1 Externa output routine will mot send nulls. In Nas-Sys 3 however

the Return on Zero instruction has been omitted, and nulls can be output.

@ second effect of the OR A instruction which starts XS0PO is to set the parity/overflow flag if the number of bits in the accumulator which are ‘1’ 15 even: otherwise the parity/overflaw flag will be reset. If the parity of the accumulator was odd, the output routine now changes the state of bit 7; the result is that the accumulator now contains a code of even parity, the bottom seven bits (bits 0 – 6) representing the ASCII character to be output.

Next bit 9 of £0028, the external option byte, 15 tested; if this bit 15 zero, the character is to be output with even parity, and the routine jumps straight to the final section, where SRLX is called. However, if bit 0 of £0028 was 1, bit 7 of the accumulator is first inverted, so that all output is of odd parity.

After return from subroutine XSOPO, the routine is terminated, unless the character that has just been output was a Carriage return. In this case, bit 4 of the option

byte is checked, and if it is zera the accumulator is loaded with the line feed code (£08); this is then output by a ‘fall through? to XSOPO

This is an OCR’d version of the scanned page and likely contains recognition errors.

Page 23 of 37