Micro­power

  

Volume 2 · Number 3 · July 1982

Page 25 of 37

Register Disable line low, which allow the data in the Receive Buffer to pass on to the data bus and thus to the accumulator.

SCAL NOM, DF 71

All input/​output in Nas-Sys is controlled by tables of routines. If you want to change the sequence of operations carried out on output you merely have to set up a new table, which must consist of a list of the numbers of the subroutine calls to be carried out terminated by a null, and then tell Nas-Sys where this table starts by loading the address into the HL register pair and calling NOM.

The address of the new table is first saved on the stack and the address of the current output table is loaded into HL from the output table pointer at £0C73. The contents of HL are now exchanged with the top two bytes of the stack; thus HL now contains the new output table address, and the stack holds the current address. Finally, the new address is stored at £0C73, becoming the address for all subsequent output operations, the old address is POPped of the stack into HL, and the subroutine ends.

SCAL NIM, DF 72

This subroutine operates in the same manner as DF 71 to change the address of the input table, which is stored at £0C75.

SCAL ATE, DF 73

This subroutine call is used by input and output procedures to get the routine numbers from the appropriate tables and call them in turn. On entry to ATE the address of the appropriate table pointer, £0C73 for output and £0C75 for input, should be in HL. However, before ATE is used within Nas-Sys, the original contents of HL are saved on the stack; consequently, if you try to use ATE from a machine code program you will find that there is an extra POP instruction at the end which throws away your return address, creating havoc. Of course, there is no need to call ATE, because the standard input and output routines in Nas-Sys, SCAL IN (DF 62) and ROUT (F7), jump directly to ATE after saving HL.

The address stored at the table pointer is loaded into DE, and the routine numbers are then picked up successively from the table until the null that marks the end is detected. The routines in the table are called differently by the two versions of Nas-Sys. In Nas-Sys 1 the routine number is stored at ARGC (£0C0A) and the routine executed by calling SCALJ (DF 5C). In Nas-Sys 3 the number is transferred to the E register and the routine is called via SCALI.

Page 25 of 37