EMAC PRIMER Instruction Manual page 30

Table of Contents

Advertisement

examine registers A,B,C,D,E,H and L you will see that pressing the reset button clears them to 0.
To examine this program we will use a breakpoint. A breakpoint is an address in memory where you desire the program to
stop (or break) and return to the data entry mode. This allows you to run part of your program at full speed and then stop
before executing the instruction that the breakpoint points to so you can examine registers or single step or other things.
The software break is performed by the MOS (Monitor Operating System) program using the RST 7 software interrupt.
When the user specifies a break address the MOS replaces the op code at this address with the RST 7 (FF hex)
instruction. The user's program can then execute full speed until encountering the RST 7 instruction. When the user's
program reaches the break, the RST 7 instruction returns control to the MOS program. The MOS program then restores
the op code that was replaced by the RST 7 instruction. The MOS program only allows the use of one breakpoint at a time,
and this is automatically reset to 0000 after the breakpoint has been encountered. The user can however hand insert
breakpoints by placing RST 7 instructions at strategic locations throughout the user's program. Remember that any hand
inserted breakpoints must also removed by hand when they are no longer needed. When inserting a software breakpoint it
is important to remember that if the program execution never reaches the breakpoint address it will not stop. All
breakpoints must point to op codes before they will work. If the breakpoint address is pointing to a byte other than the op
code in a two or three byte instruction, the program will not stop at the breakpoint address. Not only will the program not
stop, the program will also not work properly because one of the bytes in the two or three byte instruction will have been
changed to FF hex. All breakpoint addresses must be above 8000 hex. Those below 8000 hex will not stop execution,
even if the op code at that address is executed.
To select a breakpoint, press the "func." key followed by the "8/B.P." key and the display will show the breakpoint address
in the "ADDRESS/REGISTER PAIR" displays and "B.P." in the "DATA/OP" display. A breakpoint is selected the same
way you change a register and all the rules regarding changing registers apply to setting a breakpoint; just type the address
and press "enter". Remember that B.P. (breakpoint) is not a register within the 8085 microprocessor, it is just a function
supported by the MOS. Follow these steps:
CURRENT PC
FF01
Set a breakpoint at address FF0F and run the program. After the breakpoint occurs the PRIMER will be in
data entry mode displaying the address FF0F. Examine the registers and you will see that A,B,C,D,E,H
and L have been loaded with 1 - 7 respectively. Remember that when you examine the A register the flag
register is also shown, so the displays will show "0100 A.F.".
FF0F
Single step and the first XCHG instruction will be executed. Examine the DE and HL register pairs and
you will see the previous value of HL is now in DE and the previous value of DE is now in HL.
FF10
Single step and the second XCHG instruction will be executed which will exchange DE with HL again.
Examine the DE and HL register pairs and you will see that their values are the same as before the first
XCHG instruction.
FF11
Single step and the instruction MOV A,B will be executed which copies the B register to the A register.
Examine these registers to verify this.
FF12
Finally, single step the MOV B,C instruction and the C register will be copied to the B register. Examine
the BC register pair.
FF13
This is the end of the program.
The last instruction in the machine language program is FF which is the RST 7 instruction. Read the instruction's definition
at the beginning of this lesson, again (stack will be explained later). The PRIMER's ROM has instructions at address 0038
which return control of the microprocessor to the MOS. Try to single step the RST 7 instruction; As you can see nothing
happens. Now press the reset button, then run the program by pressing the "STP/RUN" key (don't press "FUNC") and you
will see that the program stops at the address of the RST 7 instruction and returns to the data entry mode showing "FF13
FF" on the displays.
30

Advertisement

Table of Contents
loading

Table of Contents