Nascom Newsletter |
Volume 3 · Numbers 5 & 6 · June 1984 |
Page 13 of 69 |
---|
In volume 3, number 2 of the Nascom Newsletter, I described the addition of two more commands and two more pseudo ops to the Compass assembler (version 1.3). This article describes the addition of a further command.
As there were only two ‘spare’ command letters, the BADCMD facility of Compass is used. This was thoughtfully provided by Level 9 as a jump at £0F00 for the addition of extra commands, and the address of this sump is changed to the address of the new routine.
The new routine, the ‘Z’ command, provides a means of listing label addresses without having to reassemble the program. Once a program has been assembled, pressing ‘Z’ followed by a Newline will list the labels and their addresses immediately, the number being displayed at a time being controlled by the ‘H’ command. The command will work before assembly but rubbish will be displayed.
The program as shown below has its origin at Compass+£1A53, as it is assumed that the previous additions have been incorporated. If they have not, then the origin is at Compass+£197E and line 10 will have to be altered accordingly.
The Compass Assembler is unusual in that the labels are not restricted in length, and so the storage of their addresses is also unusual. The usual way is to split the symbol area into 8 byte blocks, six bytes being for the label and two for its address. In this instance, the symbol area is split up into four byte blocks, with two bytes for the address and the other two bytes as the address of the label in the source area. As an example, the label ‘RIN’ of this program appeared in the symbol table as:
01 60 08 00
the first two bytes being the label address and the second, the abject address. A label address of 00 00 indicates the end of the list and, as the program outputs the object address first, it is erased in lines 36 and 37.
The following listing shows how simple it is to display the labels once the storage is understood. Lines 56 and 57 put the command address in the jump table, so a cold start is necessary for the program to work.
Page 13 of 69 |
---|