Running 2 Youtube Channel : The Masti Adda (Fun based ) : The Knowledge Adda (Knowledge based) : Subscribe for Knowledge with Fun....

Write an assembly language program to subtract two given number 05 H and 04H using register A and B

Written by @


Apparatus Used: Microprocessor Kit, Keyboard
Assumption: We have to write a program of subtract to using given content of register A and B. By default output will be store in A (accumulator).
Algorithm:
  • Load 05 H into Register A
  • Load 04 H into Register B
  • Subtract the content of Register A and B
Program:
Memory Address
Op-code
Operand
Comments
2000
MVI
A,05 H
Store 05 H into Accumulator
2002
MVI
B,04 H
Store 04 H into Register B
2004
SUB
B
Subtract content of A and B
2005
RST
5
Set break-point to execution
2006
END

End the program
Used Instruction:
MVI: This instruction is used to store the 8 bit data in specified register.
SUB: This instruction is used for subtract the content of specified register from accumulator and store output in accumulator.
RST 5: This instruction is used to set break-point in the program to execution.
END: This instruction is used to end the program.
Result:
Input A=05 H, B=04 H
Output 05-04=01 H             
Procedure to look output
  • After END press ENTER
  • You will get First Screen then Press G and provide Initial address(In above program it is 2000)
  • Press SHIFT+4
  • Press RA
  • You will get output in accumulator.

No comments:

Post a Comment