You are on page 1of 3

Aman Arora

06496502714

EXPERIMENT 5

AIM

Write a program to find ones complement of a given number. Let the number be 55H stored at memory location
2501H and the result is stored at 2502H.

PROGRAM

Memory Location Machine Code Mnemonics Operands Comments

2000H 21, 01, 25 LXI H, 2501H Load address of first


number into register
2003H 7E MOV A, M Move content of
memory to AC.
2004H 2F CMA Complement from
content to AC.
2005H 23 INX H Increment the
memory location.
2006H 77 MOV M, A Move content of AC
to memory.
2007H 76 HLT Stop
Aman Arora
06496502714

STEPS

1. RESET
2. DELGO
3. REL EXMEM (2 times)
4. 2501 MEMC NEXT 55
5. 2502 MEMC NEXT 00
6. FILL
7. REPEAT Steps 1-3
8. 2000 MEMC NEXT 21
9. 2001 MEMC NEXT 01
10. 2002 MEMC NEXT 25
11. 2003 MEMC NEXT 7E
12. 2004 MEMC NEXT 2F
13. 2005 MEMC NEXT 23
14. 2006 MEMC NEXT 77
15. 2007 MEMC NEXT 76
16. FILL
17. DELGO 2000 FILL E (will be displayed)
18. REPEAT Steps 1-3
19. 2502 MEMC NEXT AA (Result displayed)

RESULT

2502H AA
START

INITIALIZE HL PAIR

GET THE NUMBER IN THE ACCUMULATOR

COMPLEMENT THE CONTENTS OF THE


ACCUMULATOR

INCREMENT THE HL PAIR

STORE THE CONTENTS OF THE


ACCUMULATOR

STOP

You might also like