Statement:Multiply the 8-bit unsigned number in memory location 2200H by the 8-bit unsigned number in memory location 2201H. Store the 8 least significant bits of the result in memory location 2300H and the 8 most significant bits in memory location 2301H.
Sample problem:
(2200) = 1100 (0CH)
(2201) = 0101 (05H)
Multiplicand = 1100 (1210)
Multiplier = 0101 (510)
Result = 12 x 5 = (6010)
Source program
LXI H, 2200 : Initialize the memory pointer
MOV E, M : Get multiplicand
MVI D, 00H : Extend to 16-bits
INX H : Increment memory pointer
MOV A, M : Get multiplier
LXI H, 0000 : Product = 0
MVI B, 08H : Initialize counter with count 8
MULT: DAD H : Product = product x 2
RAL
JNC SKIP : Is carry from multiplier 1 ?
DAD D : Yes, Product =Product + Multiplicand
SKIP: DCR B : Is counter = zero
JNZ MULT : no, repeat
SHLD 2300H : Store the result
HLT : End of program
This comment has been removed by the author.
ReplyDeletei wrote the prog and it seems not to be giving the right result... got a question for the line:
ReplyDelete"DAD D : Yes, Product =Product + Multiplicand"
why do we need to add the product and the multiplicand if we already have RAL the product before hand ?
Ramesh Goankar solved problem.
ReplyDeleteIf multiplying by 1 then Product =Product + Multiplicand and then rotate
otherwise just rotate left content of HL pair by DAD H command
Top-Down PDA corresponding to a CFG
ReplyDeleteFeatures of 80386
Data Design
AMP Module
Virtual Mode 80386
Design: Linker
Distributed Operating System Design Issues
Features 80486
Time Shared Common bus Interconnection Structures
Quadruple representation
ReplyDeleteMapping Instruction
Design: Macro Assembler
Algorithm for Adding alpha-beta Cutoffs
Priority Interrupt
Representation of Simple Facts Logic
Macro Definition and Call
Life Cycle: Source Program
Linked List vs Array