Anda di halaman 1dari 7

3/22/2010

TEDY TRI SAPUTRO EXPERIMENT USING Z80 MICROPROCESSOR

kliktedy.wordpress.com | Tedy Dalam Tulisan


2Experiment using Z80 microprocessor

About Author

Tedy Tri Saputro is college student of Polytechnic Institute of Nuclear Technology – Yogyakarta,
Indonesia at Nuclear Physics Engineering with concentration Electronics and Instrumentation. If you any
question or suggestion, please read the contact person :

Tedy Tri Saputro adalah Mahasiswa Sekolah Tinggi Teknologi Nuklir – Yogyakarta, Indonesia pada
jurusan Teknofisika Nuklir dengan program studi Elektronika – Instrumentasi. Jika anda memiliki saran
dan pertanyaan, silahkan baca pada contact person

Contact Person :

Tedy Tri Saputro

Email : detik19@gmail.com

Blog http://kliktedy.wordpress.com

Tedy Tri Saputro


3Experiment using Z80 microprocessor

EXPERIMENT 2
BASIC APPLICATION OF ARITHMETIC AND LOGIC OPERATION INSTRUCTION

1. EXPERIMENT 1

The following program can be used to add the contents of register D and register E together. The result
will be stored in the pair register HL

D+E=HL

No Address Hex Assembly


1 0 ORG 1800H
2 1800 7B LD A,E;
3 1801 82 ADD A,D;
4 1802 6F LD L,A;
5 1803 3E 00 LD A,0;
6 1805 CE 00 ADC A,0;
7 1807 67 LD H,A;
8 1808 76 HALT;
Data:

D=5AH E=A6H

Data:

D=46H E=77H

Tedy Tri Saputro


4Experiment using Z80 microprocessor

2. EXPERIMENT 2

The following program can be used to add the 16-bit data in memory addresses 1A00H-1A01H to the 16
bit data value in the register pair DE. The Result will be stored in register pair HL

0001 0000 ORG 1800H

0002 1800 3A 00 1A LD A,(1A00H)

0003 1803 83 ADD A,E

0004 1804 6F LD L,A

0005 1805 3A 01 1A LD A,(1A01H)

0006 1808 8A ADC A,D

0007 1809 67 LD H,A

0008 180A 76 HALT

Number of errors = 0

3. EXPERIMENT 3

The above program revised for a substraction operation

0001 0000 ORG 1800H

0002 1800 3A 00 1A LD A,(1A00H)

0003 1803 93 SUB E

0004 1804 6F LD L,A

0005 1805 3A 01 1A LD A,(1A01H)

0006 1808 9A SBC A,D

0007 1809 67 LD H,A

Tedy Tri Saputro


5Experiment using Z80 microprocessor

0008 180A 76 HALT

Number of errors = 0

[1A01H-1A00H]-DE=HL

1234-1122=?

4. EXPERIMENT 4

The following program can be used to add the 32-bit data in memory addresses 1A00H-1A03H to the 32-
bit data in memory addresses 1A04H-1A07. The Result will be stored in memory addresses 1A08H-
1A0BH

Preset memory contents (1A03H – 1A00H) =12 34 56 78

(1A07H – 1A04H) = 12 34 56 78

0001 0000 ORG 1800H

0002 1800 06 04 LD B,4

0003 1802 DD 21 00 1A LD IX,1A00H

0004 1806 A7 AND A

0005 1807 DD 7E 00 LOOP: LD A,(IX+0)

0006 180A DD 8E 04 ADC A,(IX+4)

0007 180D DD 77 08 LD (IX+8),A

0008 1810 DD 23 INC IX

0009 1812 05 DEC B

0010 1813 C2 07 18 JP NZ,LOOP

0011 1816 76 HALT

Number of errors = 0

Process of simulation

Tedy Tri Saputro


6Experiment using Z80 microprocessor

5. EXPERIMENT 5

If the instruction DAA is inserted immediately after ADC or BDC instruction then the programs becomes
a program for decimal addition or substraction

0001 0000 ORG 1800H

0002 1800 06 04 LD B,4

0003 1802 DD 21 00 1A LD IX,1A00H

0004 1806 A7 AND A

0005 1807 DD 7E 00 LOOP: LD A,(IX+0)

0006 180A DD 8E 04 ADC A,(IX+4)

0007 180D 27 DAA

0008 180E DD 77 08 LD (IX+8),A

0009 1811 DD 23 INC IX

0010 1813 05 DEC B

Tedy Tri Saputro


7Experiment using Z80 microprocessor

0011 1814 C2 07 18 JP NZ,LOOP

0012 1817 76 HALT

Number of errors = 0

Process of simulation

Result

Tedy Tri Saputro

Anda mungkin juga menyukai