Micropower |
Volume 1 · Number 1 · August 1981 |
Page 28 of 33 |
---|
The purpose of this series of articles is to dissect the latest Nascom monitors, Nas-sys 1 and Nas-Sys 3, partly to provide a backcloth for a discussion of machine code programming; and partly because you can only use monitor routines effectively when you understand them and I hope to gain understanding by writing the articles.
Anyone who has used other microcomputer systems will realise that the Nascom monitors in general are very powerful for their size. This does not mean that they should be regarded as sacrosanct – ideally the standard monitor supplied with your machine should be regarded as the starting point for a truly personal system. Tampering with monitors has a peculiar fascination; you usually have a strictly limited space in which to fit the routine you are rewriting, and it always seems to be too short. In the articles I shall try to stick to the authorised versions of Nas-Sys , but I shall probably suggest the occasional ‘improvement’. I hope this will encourage people to write in with their own modifications, or at least to write and say why mine are wrong.
I shall assume that the reader is familiar with the commoner ‘buzz words’ for computing and knows what hexadecimal code is (if you have never heard of hexadecimal, you should read the series Teach Yourself Z80 in INMC 80). If there is anything you don’t understand, you can always write and ask.
The Z80 has a set of eight single-byte instructions which call subroutines on page zero.
HEX. Code | Assembly Name | Address Called | Nas-Sys Function |
---|---|---|---|
£C7 | RST £00 | £0000 | Resets the system |
£CF | RST £08 | £0008 | Waits for an input character |
£D7 | RST £10 | £0010 | Relative call routine |
£DF | RST £18 | £0018 | Access to Nas-sys routines |
£E7 | RST £20 | £0020 | Breakpoint code |
£EF | RST £28 | £0028 | Print a character string |
£F7 | RST £30 | £0030 | Output the character in A |
£FF | RST £38 | £0038 | Delay determined by value in A |
RST 0 can be used on any monitor to reset the system at the end of a program, but any information on display will be lost, so its value is limited.
The second restart is the Nas-sys equivalent of the CHIN routine (CD 3E 00) in T4 and the earlier monitors; it uses a subroutine in the monitor to scan continuously through a table of routines until one of them receives an input. The address of the table is stored in the workspace at £0C75, and on initialisation this points to a keyboard and a serial input routine. The user can extend or change the table with the U and X commands, or he can provide his own input table. If one of the routines in the table sets the carry flag, subsequent routines will be skipped.
Page 28 of 33 |
---|