Micro­power

  

Volume 1 · Number 2 · September 1981

Page 29 of 33

the NMI handling routine. Here bit 3 of port 0 is reset, and CONFLG is tested to see if the program has arrived at this point from an E command (in which case CONFLG is not zero), or from some other source, such as a single step command, a breakpoint, or a hardware NMI. If it came an E command CONFLG is now set to zero, so that a subsequent NMI is handled correctly, if a breakpoint has been entered Restart 32 (£E7) is inserted, and the NMI handling routine jumps back to the executed program with a RETN. At last the program you started with Exxxx is running. You will see what happens if CONFLG is zero when we discuss the single step command.

F (Error)

F is not a valid command letter in either Nas-Sys 1 or Nas-Sys 3, and an error message is produced when it is entered. I use the command for a Find routine, which searches from a specified address for a string of up to 9 bytes.

2BFINDDEC HLHL holds start address
3A 0B 0CLD A, (ARGN)Get number of values
FE 02CP 2Must be at least 2
30 03JR NC, VALIDIf so, continue
DF 6BSCAL ERRMiF not, print Error
C9RETand end routine
3DVALIDDEC AGet string length
4FLD C, ASave string length in C
41SRCHLPLD B, CTransfer to B
11 0E 0CLD DE, £0C0EPoint DE to first byte
1ALD A, (DE)Get first byte
23SRCH1INC HLLook for first byte
BECP (HL)Found it?
20 FCJR NZ, SRCH1If not, continue to look
05DEC BOnly on byte to find
28 09JR Z, CALLDSIf so, go to display
13SRCH2INC DEIf not, look for second
13INC DEGet next in string
1ALD A, (DE)Go to next memory byte
23INC HLAre they the same?
BECP (HL)If not, start again
20 EDJR NZ, SRCHLPLook for rest of string
10 F7DJNZ SRCH2All found, so tabulate
D7 08RCAL TABWait for keypress
CFRST 8Is it an escape?
FE 1BCP "ESCAPE"Look for next string
20 E4JR NZ, SRCHLPOutput, CR
DF 6ASCAL CRLFEnd routine
C9RET

* * TAB routine starts here * *

The TAB routine used by the above program is the same as the one in the comparison routine, and the code for this should be entered at the position marked above. Of course, if you use both the compare and the Find routine,

Page 29 of 33