EMAC PRIMER Instruction Manual page 74

Table of Contents

Advertisement

CURRENT PC
FF01
Load HL with FFE0 so H will be greater than L then single step and H will be copied to the A register.
FF02
Single step and A will be compared with L and the flags will be set accordingly. According to the definition
of the CMP L instruction if A is greater than L then the zero flag and the carry flag will both be 0 (examine
the flag register to verify this).
FF03
Single step and the PC will then point to the instruction following the JC FF0E instruction. Remember that
because the carry flag is not 1 the JC FF0E instruction will not be executed.
FF06
Single step and the PC will point to the instruction following JZ FF13 because the zero flag must be 1
before the jump will occur.
FF09
Single step and the A register will be loaded with the value that will be displayed on the digital output
LEDs. Single step twice more and the program will jump to the OUT 11 instruction and it will display the
bit pattern in the A register.
FF17
This is the end of the program.
Press the reset button and load the HL register pair with 22C0 so the H register will be less than the L register and do the
following:
FF01
Single step twice to copy H to A and compare A with L. Examine the flag register and you will see that the
carry flag is 1 and the zero flag is 0 because A is less than L.
FF03
Single step and since the carry flag is 1 the JNC FF0E instruction will occur.
FF0E
Single step three times and A will be loaded with the bit pattern that indicates that H is less than L, the
program will jump to the OUT 11 instruction which will display the bit pattern in the A register.
FF17
This is the end of the program
Press the reset button and Load the HL register pair with 1010 so H will be equal to L.
FF01
Single step twice to copy H to A and compare A with L again. Examine the flag register and you will see
that the carry flag is 0 because A isn't less than L and the zero flag is 1 because A equals L.
FF03
Single step the JC FF0E instruction and it won't be executed because the carry flag is 0.
FF06
Single step and the JZ FF15 instruction will be executed because the zero flag is 1.
FF13
Single step three times and A will be loaded with the bit pattern that indicates that H equals L, the program
will jump to the OUT 11 instruction which will display the bit pattern in the A register.
FF17
This is the end of the program.
74

Advertisement

Table of Contents
loading

Table of Contents