Spring 1979, Issue 2

Page 5 of 18

If HL = DE, the 2 flag is set, otherwise it is reset.
If HL is greater than or equal to DE, the carry flag is reset.
If HL is less than DE, the carry flag is set.

And it only takes four bytes!

2. Not everyone has realised that the Nascom monitor program uses the Z80 restart instructions to provide some useful features. Print String is an easy way of putting out messages.

EF                   RST 28H
48 45 4C 4C 4F       DEFM /HELLO/
00                   DEFB 0

These seven bytes will make the message ‘HELLO’ be displayed. Don’t forget to put the value 00 at the end of the message, or the screen will fill up with the contents of the rest of your program!

3. Have you wondered about the meaning of the characters which hex values 00 to 1F give you on the screen? Each one is, in fact, a picture which represents the equivalent ASCII code. For example, is a bell!

4. The breakpoint command uses a restart to stop the program and display the registers. If you want, you can put the same code, E7 in hex, in several places in your program. You may find it a good idea to fill any empty space with this code, because if you jump to it by mistake, the program will stop, and the register display may give you some clues.

5. In case all this has been too easy, here is a puzzle for you.

AF             XOR A           Set A to 0
06 00          LD B,0          Set B to 0

3C     LABL    INC A           Increment A
27             DAA             Decimal adjust
10 FC          DINZ LABL       Repeat, 256 times.
E7             RST BRKPT       Display registers.

Now A has been incremented 256 times, and the DAA instruction makes this work in decimal, so A should be 56 at the end. Why isn’t it, and how would you correct the program? (No, the Z80 doesn’t have a fault in it!)

6. The original Nascom Software notes suggested jumping to an

/ .. ..

This is an OCR’d version of the scanned page and likely contains recognition errors.

Page 5 of 18