0% found this document useful (0 votes)
22 views

MPMC LAB RECORD

The document outlines an experiment introducing students to assembly language programming using the Microsoft Macro Assembler (MASM) and DOS Debugger. It details the steps involved in writing, assembling, linking, and executing assembly language programs, as well as the tools required for the process. Additionally, it provides examples of assembly code and debugging commands used during the programming process.

Uploaded by

srikalaarege04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

MPMC LAB RECORD

The document outlines an experiment introducing students to assembly language programming using the Microsoft Macro Assembler (MASM) and DOS Debugger. It details the steps involved in writing, assembling, linking, and executing assembly language programs, as well as the tools required for the process. Additionally, it provides examples of assembly code and debugging commands used during the programming process.

Uploaded by

srikalaarege04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

NRI

INSTITUTE OF TECHNOLOGY
Reg. No.:..20NA0Y Page No. : ...........

Experiment-I Date ailnl22


Tntroduc tion to MASM
ntoduction
The afm of thís experíment fs to fnttoduu the student
to assembly lanquaqe programing and the use ot
the tools that he oill need throughout the lab
experiment_. This tist experiment let the Student use
the Dos Debugger and the MicrDSott Macro Ass e mbler
(MASM). aitbn9 Assemblíng ínking Execute up can
be done using MASM softuoare
bieetiues
1 Inttoduction to MícYOSOft- Turbo Assenblev (TASM)
Q- Gheneral sttucture of an assernbls lanquage prDgoarn
3: use of the Dos
Dos -e
be bugge: progtam.
Ouervfeo
în qeneral paogrammfng ot mieroprocessor usually takes
Severa! ferations betore the víght Sequne of machíne
Code insttuchong is ori tten.The prouss howevev is
facilftated wing a specfal poqam called an "Assenbler":
the Assembley allous the usey to orí te alphanumeríc
ínstructíons . The AEGernbler1in turDqenerates the desire d
machine fnshuetons fom the assernbly lanquaqe
instuctions . Pssembty lanquoge proqamminq Cons is ts
of the folloing steps:
NRI
INSTITUTE OF TECHNOLOGY
Reg. No. Page No. : . . . . . . . . . .

STEP PRODU Ces


SOurce ftle
eaiting
ASsemblfng objett 4ile
Linking Executable.
Results.
Executtng
This sottuoe used to wríte aa program (8086, proccssor
etc). The proqrams ane oitten using assernbly
tanguage fo edi tor then comnptle it' The comptl
converts assembly lanquage staternents Toto nachfnel|
Lonquage. Statenents for eros. Then exeute the
Compf led pogam. Th ere are different sottoases
devolped by difterent companies for astembly
Longuage proqramming They are
1- MAS M(MOsot Macro Assermbler) -
MICYOSsott conpany.
QtASM (Turbo ssembler)
Bore kond Company
ASsennbiing tbe Pogram8
sed to
The assembley is used
to conuertthe assembly
Inshuctions to machine codeft fs us
Languagt
immedlately after loting the Rssembly (anguage
Progam. The assemblev s tarts by checking the
each
Syntax or Valí df bs ot the stuctue of
Snstu CHon n the Sous Hle "tt any e r s are
found . the a ssemblev displays a e poit on these
NRI
INSTITUTE OF TECHNOLOGY
Reg. No. :. Page No.:....Q.....

eiYors along oi th bret explanatfon of their nature


HouweveY iF the þroqram does contain any erors
the assemble procducAs an object tile that has the
Same name at the onginal tle but oith the bbË'
-ex tension:
LinkIng the pogO
an
The o ker is used Con vert the object Hle to
of
executable file. The exeutable file is the Hnal set
machine Code fnstu ctions thah Can di cty be exeuted
than the
by the mico pD essDY Tt is the díHesent
Obre ct Rle Sn the sense that ib fs gelf-contained
and elocatable n object fle may eprcsen t one
Segment of a long progra Thfs seqment Canno t
operatG by ftselt and. must be în tegrated oith
other obsecb t les epresening the est oF the
Progam, in ordey to povduce the fnal self-Con taÉ pl
executable ffle
Exeutng the pogam!
The exe utabie con ains the machi nc lanquage
T6 corn be lo aded Pn the RAM and exe cuted by the
mícroproussor Sírn ply by typfng tom the bos prormp
the name ot the fle follouwed by the carriage Retusn
poduus an output
key ten er key)" I the prpgamcontol
on the Scae en o Sequen, ot sfgnals to
should be
Contol apiec of hard o arC. the efect
notfced almos b- 1nmedlakely, Houwever, ff the
Program manipulates data In m enoy, nothi ng ooud
tle
Seem o have happend as aa tesult ofereuHng
NRI
INSTITUTE OF TECHNOLOGY
Reg. No. Page No. :...4.

Hou Te ENTER TNTO MASM ERITOR!


Ly crck Star t' on thc desktop
Lythen Select Run:
Ly then 1tt show Inba.Then type comrnand CCMD)
ohfch enttrs you Thto DOS pnompt
L5 path setting ichange path tom c dviue to o
dve using c:\>0 and press entey path
Chanqes to o driue.
Ls rype cd ASM.
b:\> MASM>
Type edit and press enter, Then you ente into
MASN text editDY
D: \>MASM> elit
y Then enter to FIe andsetect NeL. Aod oame
ft and then torite the ALP fo this edítoY .
Atter that sare Th as trle namets then extt
tom the editor and qo to prompt Thentype
MASMA 4lename "ASM:
0:\>MASM>M SM filenarme"ASM
Ly Then Línk this ile usthg
D;\>MASM>uNk ilename-oBT on
C,MASM>LI NKeilename "oBT íe inke the
Proqram in assenbly orth Dos -
to ereate. exe cutable ftp.
D:\>MASM >de bug ile narne-EXE.
Then 1t dísplay On the scocen.
NRI
INSTITUTE OF TECHNOLOGY
Reg. No. : Page No.: .....

After that type 'e' display's the Yeqts teort conten


nd stan ting Step of the prqram

Debug commands:Assemble

Assemby the instt uctions


Assermble ata particular addyesS
C
Compare Cormpat tuoo memoytanges

Dunp DÍsplay contents ot memony


G Go Exeute the proqra m
uTrenty in mermony
T Thace
Trate a sYngle instiucton
seqment code
emds dah
db
06H O4H, H, C3
o6H H,O4oH, dh a
sgmenl ta da
de:data codde, Molthylds: e assume
Addriorn
softoave SM MA )
computer Dpersonal
Lequemead. Soflaoare
cofa ering by
re. MASM
hong addrton,
sub ad like
opevations
Atmothe Muthityte perfom
Drean
BYTE
MATIc RTHI
XPERIMET-31
NRI No. Page :.RkAD4| No. Reg.
ECHNOLOGY INSTITUTE
OF
NRI
INSTITUTE OF TECHNOLOGY
Reg. No. : ...... Page No.:.. .......

O4H, 0GH s tart: mov A x, data


addihon : a db oH , ds, Ax
Motayte b db bQH, 04 H, 66 H
sI, offset a
O2 O 4 06 mov 5I, offset b
O2 04 oG
DOV Bx, offset c
Nanual ca leulatio mov CL,o3 H

O2 H 04H
BAck: mov AL, lsI|
+O 2H +o 4H + 0GH
DL,lDI]
O4 H ADC AL, DL
mov CBx], AL
SI
DI
13x

Dec
INZ BACK

Code cnds
end s tart
ubhaction:a db CoH, SOH, 4b NRI
N oTB YTE b db 30H, 0H, lbH Reg. No. :...........
INSTITUTE OF TECHNOLOGY
Page No. :......

30 3o M ULTI3yTe
O7GA :O00O
4030 20 lo
30 uBTRACTIONO:
assUme cs: co oe, ds:data
N anual ce lculaton datadbsegnent
GOH So H GoH, S0 H,40H
-30 H b db 30H, Q0H, lo H
30H 30H
data
Code
segment
start : mov AX, data
ds, Ax
}noV sI, offset a
DI, ofsei b
Bx, offset
CL, 03 H
BACk ! moV
AL,ls1]
DL, CDI]
AL,DL
[Bx], AL
SI
DT
Outtplicatio: Rea. No.: ....................)
NRI
INSTITUTE OF TECHNOLOGY
Page No. : :.(L.

0 G O2
BACK
O76A :000o O2 04
cod ends
Manual Caleulator star t
MwLTIBYTÉ VULTIPLIcATIDNi
O2 H O4 H O6H assume cs: code, ds:data
data
Gx G: 36
1613c db
sgmend O H,o4 H, 0GH
b db O2 H, o4H, oGH

data ends
cods sgoment
etart mov Ax, data
Movds, AX
mév sI, offse t a

DI, 01fset b
BX, Ofse t c
CL, 03H

BACk! DoV AL,[s I]


ov DL, [DJ]
DL
8XJ, AL
NRI
INSTITUTE OF TECHNOLOGY
Reg. No. Page No. :...

SI

DI

JNZ BACk
1NT O3H
Codi cnds
end tay t
MuriByre Divis} o
GSsume CS: code, ds: data
data sec

b db 62 , 04H, DG H

Star t: mov Ax, data


mov de, Ax
mov s I, 04set
mov D1, o4fset b
mev BX, offset c
CL 03H
CLC
BA Ck ! AL,[sI]
ov
by
ftware
anel
fubkacon and addition
o avsthmatie multibyle ta auRe
£SULT'
tavt s nd e
eds Code
03H
BAck
|3X
SI
DlV
..9. No. Page No. Reg.
NRI *****e
OLOGY INSTITUTE
OF
NRI
INSTITUTE OF TECHNOLOGY
Reg. No. 2kA.4 iI Page No.:...20)

Facborial I
yxPERIMeNT- 5 Dateotaly
Sx 4 X 3 Xx

CL
Ax facACTORIAL A Gen
4 S

O 3
aoo pefoa factoria l a gion muma
MAS softioare.
6 2
eraRATUs eQUIREMENTS:
Personal compute
)OAM softare.
assuMe cs! code
Ade
AL,LL() AL: AL cL code ceguent
etayt OOV c , os
XOR Ax,AX
moV Al,o
.mUL CL

TNT
cod euds
end start
Resu
factorial of a given nummber ii Llnhid by uag
mAsm softoare.

You might also like