Micro­power

  

Volume 1, Number 1 – August 1981

Page 18 of 33

machine code. One way to communicate with your Nascom is thus for you to learn machine code, but a simpler method is to make the computer do the ‘thinking’ and use the Basic interpreter with which the Nascom is provided. A Basic interpreter is a list of instructions, written in machine code, which tell the Nascom how to obey a series of standard command words. Because most of the commands are simple English words it is much easier to learn to control a computer with Basic than to learn machine code. In the Nascom 2 the Basic interpreter is stored in a device known as a read-only memory (ROM) because, while data can be read from this memory when required, the processor cannot change the contents of the device by writing new data to it.

After switching on the computer you start the Basic interpreter by entering J. This is known as a ‘cold start’; it allows the interpreter to intialise an area of memory, known as the Basic workspace, in which it stores information it needs during the operation of the interpreter. After a cold start the machine displays the prompt “Memory Size?” and then waits for you to tell it how many memory locations are available to it. If you press enter without typing in the number of locations the machine will work out the number for itself by searching through possible memory locations from the end of its workspace upwards until it finds a position that does not change when it writes to it. You only need to enter a value if you wish to stop Basic using a particular region of memory.

Once you are in Basic you can enter programs, that is, lists of instructions, from the keyboard or from tape. If you enter a line number, that is, any whole number up to 65535, followed by a command or series of commands the whole line will not be obeyed immediately, but it will be stored in the computers memory. Any command entered without a line number is executed as soon as you press “newline”. Should you come out of Basic and then return to it with another cold start you will lose any program you may have entered. To get back to the interpreter without loss of program you must use the ‘warm start’ command, Z.

At this point the ‘reset’ button must be mentioned. When you press reset you force the processor to stop doing whatever it is doing at the moment and obey the instructions which begin at location 0, which is the start of the operating system. Data in memory is not corrupted by a reset, and so you can use the reset button to exit from Basic, and can then return to Basic with your program intact by entering Z.

Finally, as a demonstration of the power of Nas-Sys screen editing in Basic, try the following. Cold start the interpreter and type the lines:

10 REM: NAS­COM RULES!

and then press ‘enter’. If you move the cursor with the control keys to the line number, modify this to 20, and press ‘enter’ you will now have two lines stored, as you can check by entering the command LIST. Line duplication may seem to be of limited use, but in fact it can be an extremely effective method for changing the order of lines when ‘debugging’ (removing errors) or modifying complicated programs.

In the next article I shall delve further into Basic, and also cover a few points on the use of the cassette interface.

**     **     **     **     **     **     **     **


Page 18 of 33