Nascom Newsletter |
Volume 3 · Number 3 · August 1983 |
Page 6 of 37 |
---|
Upon entry to the user routine, various Z80 registers have preset values. These values are: HL = value from ARG1, DE = value from ARG2, BC = value from ARG3, SP = 0C5FH within the NAS-SYS stack. Forty two bytes are available on the stack for use by the user routine. Calls to NAS-SYS routines or to SYS-EX routines, from within a user routine, will require a number of stack levels to be available.
Call user routine number 2
Calls a user routine whose execution address has been stored in the NAS-SYS argument ARG9.
The command is identical to the ‘x’command except that the argument ARG9 is used in place of ARG8.
Call user routine number 3
Calls a user routine whose execution address has been stored in the NAS-SYS argument ARG10.
The command is identical to the ‘x’command except that the argument ARG10 is used in place of ARG8.
The three user routine calls, ‘x”, ‘y’ and ‘z’, provide an easy method of attatching individually tailored commands to the monitor. Unlike the NAS-SYS Execute command, these commands allow a return to the monitor (SYS-EX) with a single RET instruction. Also, the ‘Error’ message can be output under user control by manipulating the carry flag prior to the RET. The commands are ideally suited to calling individual monitor type functions. e.g. – Display the character represented by the ASCII code entered as ARG1 –, or – Print screen contents of attatched printer –. It might even be possible to directly call some of the functions within Basic.
In addition to ‘x’, ‘y’ and ‘z’, there is another method of calling user routines. The commands ‘g’, ‘j’, ‘m’, ‘o’ and ‘p’, which are not used directly by SYS-EX, all call a memory address 0400H (1K) beyond the start of SYS-EX (i.i. immediately after SYS-EX). If you put your own code here, these commands can be used in a similar way to ‘x’, ‘y’ and ‘z’. The register values on entry are the same as for ‘x’, ‘y’ and ‘z’. A word of warning here – if you haven’t put any code beyond SYS-EX, don’t use ‘g’, ‘j’, ‘m’, ‘o’ or ‘p’ as the results will be unpredictable.
That completes the description of the keyboard commands. In the next issue of the magazine we will look at, amongst other things, how the 8K Basic can make use of forty two character program names.
Page 6 of 37 |
---|