CS II-Program 5
CS II-Program 5
Aim: Write a program that multiply two 1 byte hexadecimal number stored in consecutive
memory location starting from 2030H. Store the two byte result in consecutive memory location
starting from 2032 beginning with lower order byte.
Algorithm:
Flowchart:
Program:
Mnemonics
Address Label Opcode Operand Hexacode Comment
2000 START CXI H, 0000 21 Set initial product to 0
2001 00 _
2002 00 _
2003 CDA 2030H 3A set A=N1
2004 30 Lower address byte
2005 20 Upper address byte
2006 MOV E, A 5F Set E = N1
2007 CDA 2031H 3A Set A = N2
2008 31 Lower address byte
2009 20 Upper address byte
200A MVI D,00H 16 Set D=00
200B 00 _
200C LOOP DAD D 19 Product= Product + N1
200D DCR A 3D N2=N2 - 1
200E JNZ LOOP C2 Repeat if N2 ≠ 0
200F 0C Lower address byte
2010 20 Upper address byte
2011 SHLD 2032H 22 store value of HL to memory location
2012 32 Lower address byte
2013 20 Upper address byte
2014 STOP RST 1 CF Stop Program execution
Output: