Upuc Assignment 1
Upuc Assignment 1
Upuc Assignment 1
1
PROGRAM: Addion of tuo 8-6t numbegs.
Memory location Label Mnemonics Opcode
2000 MVI A, 05H 3E Commem
2001 05
2003 04
2004 ADD 8 80
RESULT: 09H
Sign. of Instructor
14
PROGRAM No. 2
PROGRAM : Addition 0+ tuo 16 bt numbesy
Memory location Label
Mnemonics 0PCOde. Comments
2000 LKI H,2050H 21
2001 50
2002 20
2003 LXIB, O102H
2004 02
2005 01
2003 MOV M, A
200C MOV A, B
200D ADCD
200E INXH 23
200F MOV M,A
20 10 HLT 76
15
PROGRAM No. 3
PROGRAM: Subtroction 0f two 8 6its Umbeus Comments
Mnemonics optode
Memory location Label
2000 MVI C, 00H
2001 21
(XI H,3000H
2002 00
2003 30
2004
2005
MOV A,M
23
INX H
2006 46
SUB M Jump On No
2007 D2
JNC L1 Cay
2008
2009 20
200A
INR Ci
2008
INX H 23
200C Li:
200 D MOV M,A
INX H; 23
200 E
200F
MOV M,C
2010 HLT
16
PROGRAM No, 4
PROGRAM Multiplication Ot 2- 8 bit numbey.
Memorylocation Label Mnemonics Comments
17
PROGRAM No. 5
Commnents
PROGRAM : numbe
de t0o & btMnemonics
Label
Memory location
WIH, 2050 H A=0B(divide,
2000
MOV A M
2003 B04Cdite
INX H
2004 MOV &,M C=00 (oNy
flo
2005 MVI C,0OH
2006 A Co mpar
li: CMP B' with B
2008
Jt L2 11-4 = 04
2009
SUB B
200 C INR C
200D
JMP.. L1 2ols2Q
200E
L2 INY H.
2011
MOV M,. C (20|52 R
20|2. INX H.
2013 MOV M,A
2014
HLT
2015
LDA 3O00H
MOV B,A
LDA 3001H
RLC
RLC
RLC
RLC
ORA, B
STA 3002 H
HLT
RESULT:
Sign. of Instructor
19
PROGRAM No. 7
ten byteg from One locaton to anothe
Comments
PROGRAM : CopyLabel Mnemonics
Memory location LxI B, 2000H
LxI D, 3000 H
MVI L, OAH
Bock : LD AX B
STAX D
INX B
INX D
DCR L
JNZ BocK
HLT
RESULT: 2900
2001 2602 2003 2go4
9 Sign. of Instructor
Cort
Jo02
20
21
tructor Sign.
of
RESULT:
HLT
3002H STA
MOv!A,B
3001H STA
HA,MOV
3000H STA
LA,MOV
L2
JNZ,
DCRC L1:
INR,B
L1JNC
DE
HL+ HL DADD 12
03H C,HVI
f92GH 0, XI
0000H H,LXI
omments Label location Memory
urnten bit wth& Mnemonics
numbe Multiplcaton
bt4 16 0f PROGRAM
PROGRAM
8No.
PROGRAM No. 9
PROGRAM : Sep axode out nibble of 8 L9t numb
Comments
Memory location Label Mnemonics
HLDA FOSOH
MOV B, A
iANT OF H
STA FO52 H
MOV A, B
ANI FOH
RLC
RLC
RLC
STA FO51H
HLT
RESULT:
Sign. of Instructor
22
PROGRAM No. 10
PROGRAM : Additi on of 28bit num besu n BCD USing DAA.
Memory location Label Mnemonics Comments
XIH, 8000H
MOV A, M
INX H
ADD M
DAR
JNC L1
INR C
L1:INX H
MOV M,A
INX H
MOV M,C
HLT
23
PROGRAM No. 11
PROGRAM: XOR DATA Wth out usin XKH nstsucfong.
Memory location Label
Mnemonics
Commer
LXI H, 3000H
MOV B,M 8ç +¢'a
INX H
MOV C, M
CALL XOR GATE
INXH
MOV M,A
HLT
XURGATE MOV A,B !
CMA
ANA C
MOV. D, A
MOV'A,C
CHA
ANA 8
MOV E,A
MOv A,D
ADD E
RET
RESULT:
of
24
PROGRAM No, 12
PROGRAM: SubRoutlne houing multplitoion of 2 86l4 B numbeNs
Label
Memory location Mnemonics Comments
XI H,3000H
MOV B,M
INX H
CALL LL
INX H
MOV M, A
INX H
MOV M, ET
HLT.
Li: MVI-A,ODH
l3: ADD B
JNC L2
INR C
L2: DCR M
JNZ L3
RET,
RESULT:
Sign. of Instructor
25
PROGRAM No. 13
Sign. ofInstruc
PROGRAM No. 14
PROGRAM Avanging n Alcend?ng Ovde
Memory location Label Mnenrbnics Comments
MVI B, 05 H
L3: LXIH,4000H
MVI C, 09 H
12: MOV E,M
I NK H
MOV A, M
CMP E
JNC L1
MOV M,E
DCX H
MOV M,A
INX H
L1: DCR C
JNZ L2
DCR B
JNX L3
HLT
RESULT:
Sign. of Instructor
27