Duarte COE014 Midterm

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

COE014

Duarte, John Paul D. Microprocessor Systems


BSEE – 31A

1. Write a program to add data at 3005H & 3006H memory location and store the result at 3007H
memory location.

(3005H) = 14H
(3006H) = 89H

Result (3007H) = 14H + 89H = 9DH

DATA OR
ADDRESS LABELS MNEME OPERANDS COMMENT
CODE
HL points
BF00 21 05 30 START LXI H 3005H
3005H
Getting first
BF03 7E MOV A, M
operand
HL points
BF04 23 INX H
3006H
Add second
BF05 86 ADD M
operand
HL points
BF06 23 INX H
3007H
Store result at
BF07 77 MOV M, A
3007H
BF08 76 STOP HLT END
COE014
2. Write a program to exchange the data at 5000M& 6000M memory location.

DATA OR
ADDRESS LABELS MNEME OPERANDS COMMENT
CODE
Getting the
contents
BF00 3A 00 50 START LDA 5000M
at 5000M location
into accumulator
Save the contents
BF03 47 MOV B, A
into B register
Getting the
contents
BF04 3A 00 60 LDA 6000M
at 6000M location
into accumulator
Store the contents
BF07 32 00 50 STA 5000M of accumulator
at address 5000M
Get the saved
BF0A 78 MOV A, B contents back into
A register
Store the contents
BF0B 32 00 60 STA 6000M Of accumulator at
address6000M
STOP END
COE014
3. Write a program to add data at 2501H & 2502H memory location and store the result at 2503H
memory location.

(2501 H) = 99H
(2502 H) = 39H

Result (2503H) = 99H + 39H = D2H

DATA OR
ADDRESS LABELS MNEME OPERANDS COMMENT
CODE
HL points
BF00 21 01 25 START LXI H 2501H
2501H
Getting first
BF03 7E MOV A, M
operand
HL points
BF04 23 INX H
2502H
Add second
BF05 86 ADD M
operand
HL points
BF06 23 INX H
2503H
Store result at
BF07 77 MOV M, A
2503H
BF08 76 STOP HLT END

You might also like