Micro­power

  

Volume 2, Number 1 – February 1982

Page 30 of 37

The NAS-SYS Monitors

By J. Haigh

The External Command X xx

When this command is executed, the low byte of the argument after the X is stored at £0C28, and the pointers to the input and output command tables at £0C75 and £0C73 are reset. Input now scans a routine called XKBD (SCAL £74) and then scans the ‘normal’ Nascom keyboard routine, which in the case of Nas-Sys 1 is SCAL £61 while Nas-Sys 3 uses the Repeat Keyboard routine SCAL £7D. Output sends data to an external output routine XOUT (SCAL £6E), then to the user output (SCAL £75) and finally to the CRT (SCAL £65).

The external keyboard routine scans the serial input port. If no input is received it returns from this routine and scans the Nascom keyboard in the normal way – any options set under the X command have no effect on the Nascom keyboard, so to the user the operation of the system is unchanged.

If an input is received from the serial input port, bit 7 of the input byte is first set to zero. This is done because many systems use the most significant bit for parity checking to eliminate errors; the number of ones in the lower seven bits is counted and the value of bit 7 is then adjusted so that the number of ones in the byte is either always even (even parity) or always odd (guess what that’s called). The Nascom may have to communicate with systems which use either (or no) system of parity checking, and it does this the easy way by merely stripping off the parity bit and ignoring it.

The value of the byte entered as argument to the X command is now used to control various options available, If bit 5 of the byte was zero, the input routine ‘echos’ each byte received from the external keyboard, that is, it transmits it back to the sender through the serial port; if bit 5 is set, echo is suppressed. Nas-Sys 3 also tests bit 1 of the option byte; if this bit is zero, any echo of an input byte by the user program is suppressed. This is done by using bit 7 of the option byte as a “suppression flag”. The flag is tested on output to determine whether to transmit a byte or not, and is then reset. Nas-Sys 1 does not use bit 1 of the option byte

The external output routine tests the parity of the byte to be transmitted; if it is odd it inverts bit 7. Bit 0 of the option byte is now tested; if bit 0 is set, this tells the Nascom to transmit in ‘odd parity’ format to it re-inverts bit 7. The byte is now sent out through the serial port. Although you can ignore the parity of the received data, you will usually be communicating with a device which tests parity and must therefore conform to its requirements.


Page 30 of 37