Announced in Summer 1979, NAS-SYS was, of course, the monitor for the new NASCOM-2. It was the first of the “new generation” monitors with better support for external devices and better command editing. It was developed from Nasbug 4 (by Richard Beal again), but was no longer fully compatible with past monitors. Compatibility had been sacrificed with good cause though.

This monitor was the first to provide true expansion capabilities – a fact which made it extremely popular very quickly. Because of the compatibility problem some users fitted their systems with switches to allow selection of either T4 or NAS-SYS operation.

One notable omission from this monitor is the hex keyboard facility, but we finally had a flashing cursor that could be moved anywhere on screen using the arrow keys.

 

Commands

A – hexadecimal arithmetic

A xxxx yyyy responds with:   SSSS DDDD JJ

SSSS is sum of xxxx and yyyy

DDDD is difference of xxxx and yyyy

JJ is displacement required in a Jump Relative instruction which starts at xxxx, to cause a jump to yyyy. If such a jump is not possible ?? is displayed instead.

B – set breakpoint

B xxxx

Set a breakpoint at xxxx. B 0 de-activates the breakpoint. This must only be set as the first byte of an instruction, as it temporarily replaces the instruction with E7H.

C – copy

C xxxx yyyy zzzz

Copy a block of length zzzz from xxxx to yyyy. One byte is copied at a time, starting with the first byte, so if there is an overlap in the two areas data may be destroyed. This command is useful for filling a block with a single value. Make yyyy one greater than xxxx and put the required value into address xxxx. Set zzzz to the number of bytes required.

E – execute

E xxxx

Execute program at xxxx. If xxxx is omitted then the stored program counter is used. This means that to continue execution after a breakpoint, just enter E.

G – generate

G xxxx yyyy zzzz

Generate auto-start tape. Data from xxxx up to yyyy-1 is written to tape and the auto-start address is set to zzzz.

H – operate as half-duplex ASCII terminal

H

Just waits for input characters and outputs them. Can only be ended by pressing reset. To make the nascom act as a terminal enter X 30 then enter the H command.

I – intelligent copy

I xxxx yyyy zzzz

Like the Copy command but starts copying at the end of the block which will not cause data corruption in an overlapping section.

J – execute at FFFA (to start BASIC etc)

J

Just a jump. Normally 8k BASIC cold start address.

K – set keyboard options

K xx

K 0 is the normal mode following a reset.

K 1 reverses the shift key on the letters

K 4 reverses the effect of the GRAPHICS key (nascom 2 only!)

K 5 has the effect of both K1 and K4

L – load from tape

L

Intended to load data from paper tape (!). The data must be in the format used by the Tabulate command for writing a paper tape. The loaded data is checked and any lines containing errors are scrolled up the screen so that they can be re-loaded or corrected. All correct lines are displayed for a moment and then vanish.

M – modify store

M xxxx

Modify memory starting at address xxxx. The address is displayed followed by the current data. This value may be changed. Enter a “.” at the end of the line to end the command. Enter “:” to go back to the previous address. Enter “/yyyy” to change to address yyyy. If you enter several values then the successive address values are changed. This allows several values to be entered at once.

N – return to normal mode

N

Resets the input and output table pointers to their normal values. This turns off an X or U command. All input will then be via the keyboard or the serial input and all output will be to the screen.

O – output to PIO port

O xx yy

Sends value yy to I/O port xx. e.g “O 7 F” would send 0FH to port number 07H. This requres knowlege of the PIO registers.

Q – query input from port

Q xx

Reads value from port xx and displays it in hexadecimal.

R – read tape

R

Reads a tape which has been written using the Write command. As each block is read the header information is displayed: SSSS BBLL. SSSS is the start address of the block, BB is the block number and LL is the length (0=256 bytes). The command ends automatically when the last block has been read.

S – single step

S xxxx

Executes the single instruction at address xxxx. If xxxx is not specified then the stored program counter is used. This means that to continue single stepping after a breakpoint, just enter S. If the previous command was S then even this need not be re-typed for successive steps – just the enter key. Program registers are stored and displayed after each step. Note that it is not possible to single step through some parts of NAS-SYS. It is best to enter a breakpoint immediately after the call to NAS-SYS and enter E to call the routine. Single stepping through the user program can then continue.

T – tabulate

T xxxx yyyy zzzz

Tabulate (display) a block of memory starting at xxxx and continuing to yyyy-1 displaying zzzz lines at a time. Press any key to display the next block or ESC or Shift/ENTER to end the command. Set zzzz to 0 to output all the data without a pause. By entering the command X 0 then entering the tabulate command with zzzz set to 0 the data is sent to the serial port, where it can be punched onto paper tape (sic). A checksum is output at the end of each line. The data can be read back using the Load command.

U – activate user I/O routines

U

The user output routine must be pointed to by an address at 0C78H and the user input routine must be pointed to by an address at 0C72H. On reset these point to a return instruction within NAS-SYS so if these addresses have not been changed entering a U instruction will have no effect.

V – verify tape

V

Identical to the Read command but the data is not stored in memory. Used to checking tape data. Note that this does not compare memory contents with the tape.

W – write tape

W xxxx yyyy

Write data to cassette tape. Data from xxxx to yyyy-1 is written to tape. Data is in blocks of 256 bytes (but the last block may have less). 256 nulls are written when the command starts followed by the data. Each block starts with one null and ends with 10 nulls.

X – set eXternal device options

X xx

Activate input and output routines contained within NAS-SYS.

X 0 support a terminal in full duplex mode.
every character typed is echoed to the terminal
line feed is automatically sent after every CR
all output is even parity
X 10 same as X 0 but LF is not sent after CR
X 20 same as X 0 but half-duplex.
characters are not echoed to the terminal
X 30 same as X 20 but LF is not sent afer CR
this option makes the Nascom into a half-duplex termina
1, 11, 21, 31 same as 0, 10, 20, 30 but output parity is always odd instead
of even. (Input parity is always ignored).

To input a Backspace on a terminal which does not have this key use Ctrl/H.

The X command is automatically suspended during L, R, W and G commands and re-activated afterwards.

The X command also automatically activates the U command output routine if one has been supplied. This makes it easy to support the Nascom keyboard and display, a teletype keyboard and printer and a parallel printer, all working at the same time.

Z – execute at FFFD (warm start for BASIC)

Z

Just a Jump command. Normally 8k BASIC warm-start address.

Program register display:

The registers are displayed in the following format during the S command or when an E7H (breakpoint) is encountered
-SP-   -PC-   -AF-   -HL-   -DE-   -BC-   -I-   -IX-   -IY-   Flags

The flags are a decoded representation of the F register, showing the following characters as each flag is set:  S  Z  H  P  N  C

ROM calls

The new system did away with direct calls into Nas-Sys. Instead the Z80 restart addresses were used, followed by a number to select the required routine. This allowed Nas-Sys routines to be changed or redirected without affecting any programs using them. Commonly used routines were called using only 2 bytes. The SCAL restart, although still using 3 bytes, now allowed a large number of system calls to be easily made.

Restart instructions:

C7 RST 0 START Reset the computer. Initialise NAS-SYS
CF RST 8h RIN Obtain an input character in the A register
D7 RST 10h RCAL Relative call. Follow by the displacement to the routine to be called. This works in a similar way to the Z80 Jump Relative instruction and allows relocatable code to be written.
DF RST 18h SCAL User subroutine call.The code DF is followed by a one byte value or the ASCII code which specifies the routine to be called.
E7 RST 20h BRKPT Breakpoint – stop & display registers
EF RST 28h PRS Output following string until 0H found
F7 RST 30h ROUT Call the routine pointed to by the address at $CRT. This is normally the CRT routine. Outputs the character in the A register
FF RST 38h Provide a delay proportional to the value in A. 00 gives maximum delay of about 7.5mS.

NAS-SYS routines can be called using SCAL instruction followed by the ASCII letter of the command. Registers HL, DE and BC should be set to the xxxx, yyyy and zzzz values as required.. e.g. DF 57 would call the NAS-SYS Write command.
Data would be written from (HL) to (DE)-1.

You can also call some routines as follows:

DF 5B DF [ MRET Controlled return to NAS-SYS
(best way to end program)
DF 5C DF \ SCALJ Calls the routine whose number is
stored at 0C0A
DF 5D DF ] TDEL Wait for about 1 sec (at 4MHz)
DF 5E DF ^ FFLP Flip 1 or more bits of output port 0
then flip them back again. Register A
to hold a 1 for each bit to flip.
DF 5F DF _ MFLP Invert the state of the tape LED
DF 60 DF ` ARGS Load the contents of the ARG addresses
into registers
ARG1 -> HL
ARG2 -> DE
ARG3 – > BC
These are the three arguments entered
after a command.
DF 62 DF b IN Scan for an input. Don’t wait.C set and
value in A if scan successful.
DF 63 DF c INLIN Obtain input line. DE set to start of
recieved line.
DF 64 DF d NUM Examine input line & convert a hex
value from ASCII to binary. DE set to
start of line.
DF 66 DF f TBCD3 Output data in HL as ASCII followed by
a space. Also add H and L into C.
DF 67 DF g TBCD2 Output value in A register as ASCII.
Also add A into C.
DF 68 DF h B2HEX Output value in A as ASCII.
DF 69 DF i SPACE Output a space
DF 6A DF j CRLF Output a CR/LF sequence.
DF 6B DF k ERRM Output the “Error” message and CR
DF 6C DF l TX1 Output HL in ASCII, space DE in ASCII,
space. H,L,D,E are added into C.
DF 6D DF m SOUT Send string direct to serial port. HL
points to start, B to length. C is set
to 0 and all chars added to it.
DF 79 DF y RLIN Examine input line & convert up to 10
decimal values separated by spaces
from ASCII to binary. Set DE to point to
start of line, which must end with 0H.
DF 7A DF z B1HEX Output low order (rh) half of A in ASCII
DF 7B DF { BLINK Obtain an input character in A. Blink
cursor while waiting.
DF 7C CPOS Set cursor position to screen address
pointed to by HL. Returns with HL set
to position of first character on that
screen line.

Simple I/O

To simply display the contents of A to the screen just enter the code F7H (RST 30H) into your program. You simply type in F7 as part of your program.
To read a character from the keyboard or from the serial input enter the code CFH (RST 8 ) as part of your program. The value will be returned in the A register.
In both cases no other registers will be affected.


Nascom Pages