Adobe Scan 28 Jun 2021

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

ay progíam9 fo7 moving a block OP data:

ASSumne cScode, 09 :oata


Oata Segment
Source EQu 500o H
Oest EQu 4000 H

COUnE EQu 06 H

Data FEnds
code Segment

Start
MDV AX, Dataa

MOV 09, Ax

MOV ES, Ax
SI, SoUrce
MOV
MOV DI, D e s t

MOV CL count
REP MOV SW

INT 03H
Code EndS
End STart

output: 5005 5006


500 500 5003 5004
5o00
D5 06 0+
03
ST 0a
t003
4p04 4t005 4006
4000 400 A00
DI O 5
0 03 04
by program for Teversing a
gilen
given String:
Assume CS.code, D9:Data
0ata Segment
Tect Idb, Hello welcom.e

Tect db, 13 dup (?)


count dW 13

Data Ends
Segment
code
start
AX, DHTA
MOV
Moy 09Ax
Mov ES AX

MOV CX,Count
Mov 9T 00H

MOV DL, 00H

ADD DI, count

DEC OI

AGain
Teact ST
/Mov AL,
[oT],AL
Tect
MDV

INC SI
OEC DI

|Loop AGain

InT 03H
Code Ends

End Stast
Exp. No.

Date
output:
stoíngHello welcome

ReveTsing
shing: emoclew ollch

CPTogsam for aranging the gfven Seguence in a3cending


DTder
ASSume cS:code DS: Oata
Data Segment
+tH, 44H, 66 H
ndb 11H, 99H ,aaH 88H 33H,
count DW 08H
Data ends
code Segment
Stast
MOV Ax Data

Moy DS, Ax
MOV CX , COUNt
DEC CXx
Nect SCan .
MOV BxCX
MOV ST, o0H
Nect Comp:
MOV ALn [ST
MOv DL,n [SIt

|Cmp AL, DL
TC N Sap
Exp. No.

Date

MOV n[sI+,AL
MOV n s r ] , OL

NO Swap:
INC $I

OEC BX

TN NEXE CoMp
Lvop Nect Scan

INT 03H
Code Ends
End Stavt.

66H
outpvt 38H,33H, ++H, 44H
1IH,99H ,aaH,
|Input seqyence 88H, 99H
44H,66H *+H
Dutput Seguence UH,2aH, 33H,
in desCendi
deSCendia
Sequence
the given
prograro fo grranging

0Tdle
Assume CS:Code , D9Data

Data Segment
aaH 88H 53H,FHH,44H ,66H
ndb lH, 29H,
COunt DW 08H
Data End S

Code Segrment
Start
MOV AX) Data
MmOU DS, AX
Exp. No. :3
Date
Mov cx,CounE
DEc CX

Nect Scan
mov Bx, cx

MoV SI, 00H


NeTt comp
mov AL n [sI
moV DLn s I t
CMP AL, DL
TNc No sdap
mDv n r t ] ,AL
moy n
sT] ,DL
NO SWaP:
ING SI
DEC BX
JNZ NECt cdmp
Nect Scan
| Lbop
INT 03H

Code Ends
End stast

output- 33H t + H ,
44H, 66H
,2aH,88H
11H,99H
Seqy ence
-

Input H
66H,44H 33
H, 2?H,
Dutput Sequence q9H,88H
, TH
eprogsarn for Stoíng comparision
ASSUme CS:CBe ,D5:Dqta
Data Segment
Tectl db HEllo'

Text adb HEllo

equal dB stoings ave equal $


dB Stoings are not egualf
egual
not egual
Count dd 05 H
Data Ends
code Seamen
Start
MOV Ax, Data
MOv 0S Ax
MOV ES AX

Mov c L CounE
Tect|
D y 31 , OFfSet
Tecta
MOu DI,0PP Seb
Tepe cmp 5B

Jz L NOt Equal
MOV Dx, OFfset

MoV AH,09H
INT 2H
Jmp ovER

MOV DX, OffS et EQUal


Exp. No. 3
Date
MoV AH, 09H

OVER mov AH,4cH

INT 21H
code Ends
End Start

output
Tect Hello
Tert Hell0
ae eqal
stsings
P0sam6 and the
the

Result
Thus the
ASS em bly lang
move block, Revetse
sts ina

as
executed by
6Uch
operations comparísion
Sin
SoTting and stsing in 8
io 086.
8086.
SOPtuware h a n e

si MAS YOLol
for the conversion of pmcked to
| a proqram BcD unpocked BcD
:data
Assume cS:code , DS

Data segment
NUm D6 45H
Data Ends
code Segment

Start
MOV AX, Data

MoV D9, Ax
AL , Num
MOV
AH AL
MOV
mov cL 04 H
SHR AH,CL

Ax, DFOFH
AND
INT 03H
code Ends
Start
End
Tnput
Ax 45H

output
AH 04 H
AL 05 H
b Totam for
pgsam fof the conersioD Of packed Bcp to AScll

ASsUme
cS code, DS :data
Data Segment

Num DB 45H
Data Ends
code segment

Start
Mov AX D a t a

0S, Ax
MOV
Mov Ax Num
Mov
AH, AL
MOV
Mov cL,04H
SHR AH, cL
AND Ax, OFOFH

OR Ax, 3030H

INT D3H
code Ends
End Start

Input
Ax 45H

Output
Ax -3435H
am for the Multiplicabion of two 8-bit number5:
ay
GOde Segment

ASSUMe CSCode

Start
Mov AL 34H

BL,5H
Mov
L
MUL
INT 03H
code End s

End start

Tnput
AL 34H
BL 25H

output
AX-0484H 16-bit numbers
numbers:
of tw0
multiptcaäon
for
by progsan
ASSUme CScode

code Segment
Start
MbV Ax, 0315H

MOV B, 135H
MuL Bx
INT 03H
Code Ends
End stark
Inpt
Ax-D345H

Bx - 1835H

output:
Ax- Fl39H

Dx b03EH

numbers:
8-bit nUmbers:
Of
of two 8-bit
tuod
for the dtvision
division

pregram
ASSUme C9:code

code Segment

Start
MoV AL 8H

mov BL b4 H
DIV BL

INT
03H

Code Ends
Start
End
Inpu
AL 28H

BL 04 H
0utput
AL OA H (Q

AH DOH (R)

Roll No an Rnge No 30
two 16-bit numbess
DivisioD of
dpivision
ASSUme CS,code

code Segment

Start
Ax 3200
H
MDV
MoV Bx l600H

DIV Bx

InNT 03H

code End9

End Start

Lnput
A x - 3 a 0 0 H

1600 H
Bx
-

oulpot
Ax-0002H (a)

Dx 0000H (R). l6-bit


number by an 8-bit
a
the dvisín of
e program
for
number
ASsume c5: code
Code Segment
Start
Mov AX, la00H
MOV BL, 30H
DIV BL
INT 05 H

Roll No. l å
Page No.
Exp. No.
Date

code Ends
End Stast

Input
Ax 10OH
BL 30H

Oukput
A 60 Q)
AH 0OHCR)

8-bitt numbers
8-bit numbers
Result division OP tuwo
tuso
Thus the Multiptcation and
numbers are executed byusing
two 16-bit
Ind
nASM S0ftware.
1e/o3/14
Subtsaction
for multibyle
d pmgram
cscode
ASSUmne

code Segment
Start
a00oH
ST
MoVv ,
MOV DI, 3000H

MOV CX, Dly

uP
MOV AL, [s]
SOB Or, AL
INC 3I
INC OI

Loo UP
MoV AL, DOH

RcL AL,DlH
Mov [DTJ,AL

INT 03H
code Eds

End star
a00 3
Input a0ol
000
50
30 40
3003
3000 300 300
60
30
20
Output:
300 300 3003
3000
EO Fo
Eo

Result: and multbyb


Telated dpesationh
ThuS to pesfom the horting
MASM
executedby Using
avithmetic Dpesation are

SDftware.
QUitpies
press
enter to exit f
exit and
THPe
to Prompt window

pTOgramm S :
two
8-bit
8-bit numbers;
Addition of
a
Segment
CDde
A SSUme cSGOde

Start
MDV AL,4-AH
MOV GL,66 H

ADD AL, BL
INT 03H
CODE ENOS

END START
output
AL - 4AH

BL 6BH

-
B5 H
Result
two 6-bit numbers:
b Addition Of
code Segment

ASSUme CS.code

stavt T56A H
Ax,
MOV
MOV Bx 6 8 3 F H

ADD AX) 8X

INT 03H
cDDE ENDS

END START

Output
T5BA H
|AX -
B x - 693FH

hum berS
ReSUt EOFAH
8-bit num bers
two
OF
CySubtraction

Code Segment
ASSUme cS.Cude

Start
Mov AL, 5F H
MOV BL, aD H
S U B AL, B L

INT 03H

c O D E E N D S

EnD START

ovtput

Al = 5FH

= QDH

BL
ReSult= 32H

6-bit n
n u
ummb
beer
sss:
:-

6-bit
tuwo
subtiaction
oF

D)
code segment

ASSUme c9 :Code

start
MOV Ax,5F03 H
H
Bx, D0)
Mov
Sub Ax BX

INT 03H
coDE ENDS

END START

Output
Ax = 5F03 H
BX 001 H
Result 3a0H
Date

Logical operatioro;-
Prvgram fos AND opesation-
code Seament
AS9ume C9 :cvde

staot
MOV Ax Ol3H

Mov
13X 0545 H
AND AX Bx

INT 03H
|code Ends

End S t a r t

Dutput
Ax =Dl3 H
Bx =0345 H
ReSult =bldH

OR 0pesation :-
progam for

code Segment
|A9SUme c9:cde

Staut
Mov Ax lBEH
MOV BX 342A H
OR AXBX
INT D3H
CDde ends
End stant
ovtpvE-

Ax =1BEH

5x378AH
R e s v l t = 3 7 B E H

NoT Opeidtion;-
Pmgram for

code Segment

ASGUme C
C93.
c cood
dee

strt
MOV A X 0 4 5 6 H

NOT AX

I N T 03H

coDE ENDS

ENO START

0utput
AX 0 4 5 6 H

Rebult FBAH
0Pesatton:
NAND
Programtor
4
code Segment
ASSUMe CS:Code

otart
MOV Ax, 2aBAH
0DY BX IA3DH
AND AX BX
/nlbTAX

T N TD 3 H

c o D EENOS

END START

oulput.

B A
H
=

AX
BA IA3DH
FEOC7

9Ult
eptgraro for NOR
NoR
operation
Re

C o d e S e g m e n t

ABSUme CS
c S ,c
cood
dee

Staut

1 6E
H
ov Ax
mOY 6343AH

OR Ax BX

nlOT AX

I N T D3H

CODE ENDS

END START

output

Ax = l2BE H

Bx=34aAH

ReSult C841H
for XOR opesation
P g s a m

Code segment

CScode

A S S U m e

start
t03A H
AX,

Mov
MOV BXaABSH
BX
AX,
X DR
LNT 03H

cDOE ENO S

END START

output
=
103A H
AX
BX AB3 H

ResUt 3A89H

X NOR operation:-
8 program for
code Segment
c9.code
A39Ume

Start
Mov Ax, 23BAH
moV BX IA3DH
XDR AX BX
NOT Ax
INT 03H
cODE EN DS

START
END

output
a3BA H
AX
B X =A 3 D H

= C6 +8H
Result

Result for the cdditton of


Thus the arithmetic opeTaton
l6-bit numbers
the
the tddition o two
numbeS,
two 8-bit SubTacion of
numbers , the
the Subtsaction of 8-bit
Apgical Operations oyUstng
two 6-bit numbess and

MASM in 8086.

05/02/ 13

You might also like