Nascom Newsletter |
Volume 3 · Number 2 · May 1983 |
Page 16 of 36 |
---|
of the assembler so that setting the address of your copy of Compass in line 1 will ensure that all subsequent addresses are correct. The additions are £05 bytes long so you will probably have to move your copy to fit the extra code at the and of it. This is advisable as the last two lines of the listing alter the length of code checked after a warm start, so that the new code is protected by a checksum, as well as the original.
The two new psuedo-ops use the CODE and BADOPC jumps to break into the program and use similar legal coves for the assembler to process.
When the assembler cones across a bad opcode, it jumps to £0F06 where it is redirected to NEWOPS. Here a check is made of the opcode and, if neither RCAL nor SCAL, jumps back to the BADOPC address in the assembler. If either is found then the first character is stored and the compressed code for either JR or SUB are substituted for processing. The reasons for these two being chosen are that they are single codes which are followed by appropriate operands. RCAL is similar to JR in operation and SCAL, like SUB, is followed by a single operand which must be £FF or less. Note that no check is made for illegal SCAL values.
This is all that is done on the first pass, but on the second a check has to be made of the ‘N’ option is only checked if the code is to be stored. If the option has been taken then it is reset and a flag set so that the break can be made at the CODE jump.
The CODE jump at £0F03 is diverted to Substitute and the first check is whether it is one of the new codes that is being loaded. If not, then the program returns to the assembler. At this point registers A and B contain the opcode to be loaded and this is changed to either £D7 or £DF as appropriate before allowing the program to continue. If the ‘N’ option was taken then this is reset and the return to the assembler avoids that part where the opcode is loaded.
That completes the alterations to the program operation and if the program is loaded as in the listing then only one thing remains to be done. This is the alteration of the checksum. The length of the program to be checked has already been altered but, of course, the checksum, which is stored after the last byte of the program, will be incorrect. The way to find out the new checksum is to set a breakpoint at Compass+£0409 and then warm start the assembler. When the breakpoint is reached HL will point to the checksum store (+£1A19 in the listing) and the accumulator will contain the checksum. As Compass+£0409 contained £E7 instead of £BE when it was checked, the checksum in the accumulator will be £29 greater than it should be, so enter the accumulator value minus £29 in the checksum store and save the program, not forgetting to include the checksum.
Page 16 of 36 |
---|