You are on page 1of 6

Saint Louis University

SCHOOL OF ENGINEERING
AND ARCHITECTURE

LABORATORY MANUAL

Name: _________________________ Class Schedule: _______________

Activity 3
GENERAL ARITHMETIC AND CPU CONTROL INSTRUCTIONS

At the end of this activity, the student should be able to:


∙ Understand the syntax and use of Z-80 general arithmetic and CPU control
instructions.
∙ Develop Z-80 programs with general arithmetic and CPU control instructions.

I. EQUIPMENT/ MATERIALS NEEDED:


Z80 IDE Simulator

II. PROCEDURES WITH DATA AND RESULTS

1. Complete ‘Machine Code’ column of the following program. The program adds
two 8-bit numbers, stored at memory locations 8100H adn 8101H. Results of the
addition is stored at memory location 8102H.
Address Machine Code Mnemonic

8000 3A LD A,(8100H)

8001 00

8002 81

8003 47 LD B,A

8004 3A LD A,(8101H)

8005 01

8006 81

8007 80 ADD A,B

8008 32 LD (8102H),A

8009 02

800A 81

800B 76 HALT
2. Enter the numbers in Table 3-1 into the memory locations, run the program, and
record results in the table. Complete all four tests.
Table 3-1
Test Addend Adder Results (Point Results (Point
nbr. number number 2) (8102H) 4) (8102H)
(8100H) (8101H)

1 08H 01H 09H 09H

2 07H 04H 0BH 11H

3 19H 24H 3DH 43H

4 69H 29H 92H 98H

ELECTRONICS ENGINEERING DEPARTMENT ECE3211L: DIGITAL ELECTRONICS 2


MICROPROCESSOR AND MICROCONTROLLER SYSTEMS (LAB)

Saint Louis University


SCHOOL OF ENGINEERING
AND ARCHITECTURE

LABORATORY MANUAL

3. Complete ‘Machine Code’ column of the following program.


Address Machine Code Mnemonic

8000 21 LD HL,8100H

8001 00

8002 81

8003 7E LD A,(HL)

8004 23 INC HL

8005 86 ADD A,(HL)

8006 27 DAA

8007 32 LD (8102H),A
8008 02

8009 81

800A 76 HALT

4. Enter numbers in Table 3-1 into the memory locations, run the program, and
record results in the table. Complete all four tests.

5. Complete ‘Machine Code’ column of the following program.The program


subtracts 8-bit number stored location 8201H from number at location
8200H.
Address Machine Code Mnemonic

8000 21 LD HL,8200H

8001 00

8002 82

8003 7E LD A,(HL)

8004 23 INC HL

8005 96 SUB A,(HL)

8006 00 NOP

8007 32 LD (8202H),A

8008 02

8009 82

800A 76 HALT

6. Enter numbers in Table 3-2 into the memory locations, run the program, and
record results in the table. Complete all four tests.
Table 3-2
Test Minuend Subtrahend Results (Point Results (Point
nbr. (8200H) (8201H) 6) (8202H) 7) (8202H)

1 10H 05H 0BH EFH

2 09H 02H 07H F6H


ELECTRONICS ENGINEERING DEPARTMENT ECE3211L: DIGITAL ELECTRONICS 2
MICROPROCESSOR AND MICROCONTROLLER SYSTEMS (LAB)

Saint Louis University


SCHOOL OF ENGINEERING
AND ARCHITECTURE

LABORATORY MANUAL
3 27H 19H 0EH D8H

4 65H 52H 13H 9AH

7. Change NOP instruction in point 5 to DAA, then repeat point 6.

8. Complete ‘Machine Code’ column of the following program.


Address Machine Code Mnemonic

8000 3A LD A,(8100H)

8001 00

8002 81

8003 2F CPL

8004 32 LD (8101H),A

8005 01

8006 81

8007 76 RST 08H

9. Enter numbers in Table 3-3 into the memory location 8100H, run the program,
and record results in the table. Complete all three tests.
Table 3-3
Test Number Results
nbr. (8100H) (Binary nbr)
(8101H)

1 01100101B 65 9BH

2 10011010B 9A 66H
3 01010101B 55 ABH

10.Complete ‘Machine Code’ column of the following program.


Address Machine Code Mnemonic

8000 3A LD A,(8200H)

8001 00

8002 82

8003 ED NEG

8004 44

8005 32 LD (8201H),A

8006 01

8007 82

8008 76 RST 08H

11.Enter data in Table 3-4 into the memory location 8200H, run the program,
observe content of location 8201H, and record results in the table. Complete all
four tests.
ELECTRONICS ENGINEERING DEPARTMENT ECE3211L: DIGITAL ELECTRONICS 2
MICROPROCESSOR AND MICROCONTROLLER SYSTEMS (LAB)

Saint Louis University


SCHOOL OF ENGINEERING
AND ARCHITECTURE

LABORATORY MANUAL

Table 3-4
Test Data (8200H) Results (8201H)
Nbr.
DEC HEX BINARY DEC HEX BINARY

1 00 00 00000000B 00 0 0

2 01 01 00000001B -01 1 1
3 02 02 00000010B -02 2 2

3 +127 7F 01111111B -127 7F 1111111

ELECTRONICS ENGINEERING DEPARTMENT ECE3211L: DIGITAL ELECTRONICS 2


MICROPROCESSOR AND MICROCONTROLLER SYSTEMS (LAB)

You might also like