Experiment - 2: Memory Location Machine Code Mnemonics Operands Comments

You might also like

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

Aman Arora

06496502714

EXPERIMENT 2

AIM

Write a program to add two 8-bit numbers, the first number 06 is in memory location 5800, the second number 04 is in
memory location 5801, and the result is to be stored in memory location 5802.

PROGRAM

Memory Location Machine Code Mnemonics Operands Comments

2000H 3E, 06 MVI A 06H Store the machine


code 3E at location
2000H and operand
06H at 2001H
2002H 06, 04 MVI B 04H Store the machine
code 06 at location
2002H and its
operand 04H at
2003H
2004H 80 ADD B Add the second
number to the first
number and store the
result in accumulator
2005H 22, 02, 58 STA 5802H Store the machine
code 32 at locaton
2005H and Low
order bit (02) and
Higher order bit (58)
at 2006H and 2007H
respectively
2008H 76 HLT Stop (End of
Program). Result
stored at 5802H
Aman Arora
06496502714

STEPS

1. RESET
2. DELGO
3. REL EXMEM (2 times)
4. 5800 MEMC NEXT 06
5. 5801 MEMC NEXT 04
6. 5802 MEMC NEXT 00
7. FILL
8. REPEAT Steps 1-3
9. 2000 MEMC NEXT 3E
10. 2001 MEMC NEXT 06
11. 2002 MEMC NEXT 06
12. 2003 MEMC NEXT 04
13. 2004 MEMC NEXT 80
14. 2005 MEMC NEXT 32
15. 2006 MEMC NEXT 02
16. 2007 MEMC NEXT 58
17. 2008 MEMC NEXT 76
18. FILL
19. DELGO 2000 FILL E (will be displayed)
20. REPEAT Steps 1-3
21. 5802 MEMC NEXT 0A (Result displayed)

RESULT

5802H 0A
START

INITIALIZE THE REGISTER A WITH VALUE 06

INITIALIZE THE REGISTER B WITH VALUE 04

ADD BOTH THE NUMBERS AND STORE THE


RESULT IN ACCUMULATOR

STORE THE RESULT GIVEN BY


ACCUMULATOR IN MEMORY

STOP

You might also like