0% found this document useful (0 votes)
30 views18 pages

MP Experiment

The document outlines an assembly language program aimed at performing arithmetic operations, specifically addition and multiplication, on 16-bit numbers. It includes code snippets, algorithms, and explanations of how to load data, perform operations, and store results in memory. The document serves as a guide for understanding assembly programming concepts and operations within a specific architecture.
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)
30 views18 pages

MP Experiment

The document outlines an assembly language program aimed at performing arithmetic operations, specifically addition and multiplication, on 16-bit numbers. It includes code snippets, algorithms, and explanations of how to load data, perform operations, and store results in memory. The document serves as a guide for understanding assembly programming concepts and operations within a specific architecture.
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/ 18

Page No.

:
K.G.C.E.
Karjat - Raigad Expe rimeot Nbod Date :
EKGCEKGCEKGCEKGCKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGÇEKGCEKGCEKGGEKGGEND

Aim' To ante assembly anguage pragpam


in foRG omlatar CFM 2oR6)
CALP)
l6-bit numbext
add

nanme Altya Maheoba Kooande

Branda
Batehe

Roll No

Remares San
Page No.:
K.G.C.E.
START Karjat - Raigad
Expeimnent NhA Date :
ICEKGCEKGÇEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGGE

Tpihalie Dato Segtnent

iernl languaae ansganm CAL


Number into Ax Aion To tudte an
Loo d first ematsc FMV Rog6) to

add mulAb,die ot 246-ksit numherte


Lood second Number to x

Pey horn. Additin CAxAX+8 obËe cthvRiundesshnd l6- bit additien aing 0X6

languaye
Store relult in me mony "lemm he we

, To tarmilize in bichA uith seatin in


Termirste Prognn
aiiemhyhogramning
END
EMyROSS <emito

- level
Assemaytänguage
fianmming anguase Haai soectte to
Cactput archierhie ¨YHamehc oparnhin
te addihon
Sace numbet Consirti
ming the. actumalata
additma yegiste in arhihechaze.
l6-it additm'
Conmmanly wed
the ADp iashaucha pandox m additim
Page No.:
K.G.C.E.
Karjat - Raigad |Date :
(GCEKGCEKGCEKGCEKGCKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGOEKOOE

|Tnstchlk seld

MOv' Trantp dota bmn


o another
ADQ: Pen foxm addihea openahion betueen

TNT 21H Termioatea the frogam CInkcptzr)

Algarithm
Shen-Stat the miogama
tep2ntkaLzethe data 9emant

Vaiahle

TNT 20H
Ste Texminate thepmagm ing
End the pngnam
. Mov mave Daha) incbLct
Synas
-ynoy dethinatimSoauTCe
AOpAdotln) insuHen
-Ano destnctine
K.G.C.E.
Page No.:
Karjat - Raigad
Date:
CEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKSoE
nuchion Symbalic
repaesentatn

Memny
data
sement to rgia 2

memsy
data eenent Sobtin regithx 2

hemoy data
Legment

)Mul regl mem for byte


nn Azs raetter
CAx(O(A)* -Ax Conten't i multbpled
DK rgtert foroner bl.

For ls-bttebik The quoticnt 0s


ustenttCAL)+CAo)ral)stered in AL reaitk
Remand es ()Ax) MoD & AH_ shrd n
K.G.C.E. Page No.:
Karjat - Raigad Date :
EKGCEKGOEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCE

Pancehn Declare the clata segnont sita tn la-bit


Qumbes
" lond te data seamenk adtar into Ds acalskr
More the Hrt nunber iato Ax &tae Seoand
Porrm addikon ctare hereslt ia memaa
Vaable'reule.
"Termimate he pngra m ing mteKug 2H

taten hat &the Aane arthemohie


IkicceirkAlytipankatnling the FMW
AJKAicathon

The, opeataraexeed Qerr detaned


far
utat eltc
aembly Qanspatn, the outattelotat obervl

operatar
" Aesume, the uo umbexs Num i 1234h 4660 in Deaa)
Num2 00c8h (200 in dec
"Rerultt

ogeaaton Result
1234htooCAh (2h Ax

Ishsarhon123uh- 00Cch116ch Ax
K.G.C.E. Page No.:
Karjat - Raigad
Date:
CEKGCEKGCEKGCEKGCKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGOE

opencta Renlt Reqitteao) Usad


3]MHliaton \234ht 00C8h Dx:. AX
OEA Coh
" lotwer wood' Ax

"Quetienta oo23h. Pe maitder = 0X


"Remainder Oocck

lCandualaal

Underand
languge
oemmy
Leame
JU
dit: CAEMU8086\MySource\MPO1,asm
(GCE
edit bookmarks assembler help

NEW OPEN SAVE ASSEMBLE RUN

1.MODEL SMALL
13 . DAIA
num1 DW 1234H
nun2 DW 5678H
6 result DW ?
38 CODE
9 MAIN PROC
1 MOU A%, eDATA
MOU DS, AX
MOr A%, nun1
MOU B%, num2
ADD A%, B%
9 MOr result, AX
21 MOU AH, 4CH
22 INT 21H
23
24 MA IN ENDP
END MAIN

emulator. MPO1.exe_ 9 oriainal source code

debug view virtual devices virtual drive help .MODEL, SMALL

OAD 0 .DAIA
04 nun1 DW 1234H
reload step back single step run steo delay ms: 0
95 num2 DW S678H
96 result DW ?
ters
0710:9904 0711:000E
HL 88 .CODE
4C AC 62104: AC 172 & ADD (BX SI), AL 09 MAIN pROC
92185: 68 194 h MOU AX, 90710h 11 MOU AX eDATA
x 56 78 87106 : 99 998 NULL MOU DS. AX
12 MOU DS. AX
B210: B0 B0g NULL
x00 25 07108 : B0 Y ADD AX BXB0082hJ 14 MOU AX,
15 M0U BX.
num1
nu 2
x 00 00 A21A0 : A9 ABR NULL MOU [O0004h], AX
8719B: 98 998 NULL MOU AH, 04Ch 12 AÐD AX, BX
0711 9719C: 88 B99 NULL INI 821h
9710D: 99 B9 NULL NOP
0013 R210E: a8 B88 NULL NOP 19 MOr result, A8
9719F : 88 B00 NULL NOP
0710 92119: B8 184 1 NOP HOU AH 4CH
97111: 19 016 º NOP INI
87112: 97 98? BEEP NOP
97113: 8E 42 A NOP MAIN ENDP
9900
97114: D8 216 25 END MAIN
S B7115: A1 NOP
9909 aaa NULL NOP
9090 an ag gAA NULL NOP
97118: 8B 139 i NOP
Ds 9719 07119: 1E 030 A NOP
0711A: 02 992 O NOP
ES 07 90 0711 B: 08 999 NULL NOP
8711C: 83 903 NOP
9711D: C3 195 NOP
9711E: A3 163 ú NOP
9711F: 04 884

sCIeen tource tesel yars debug stacl lags


CAUsers Ayush\Downloads\64_MPO1SUB.asm X
t bookmarks assembler help

VEW OPEN SAVE ASSEMBLE RUN

.MODEL SMALL

. DATA
num1 DW -100OH
num2 DW -2000H
result DW 9

CODE
MAIN PROC
MOU AX, eDATA
MOV DS,AX
MOU A%, nun1
MOU B%, num2
ADD A%, BX
MOV result , A%
MOr AH, 4CH
INI 21H
MAIN ENDP
END MAIN

ator: 64_MPO1SUB.exe X Ooignal source code

IUg view virtual devices virtual drive help U1 .M0DEL SMALL


02
.DAIA
step delay ms: 0
nunl -1000H
reload step back single step run
nunz -2800H
resu DW ?

H 9719: 9094 F400:92 04 B8 .cODE


92194: 00 000 NULL BÊOS DI A09 MA IN PROC
4C 00 Hl10 MoU AX, eDATA
97105 : DØ 298 INT 821h
B2196 : 00 900 NULL 11 MOU DS,AX
13 MOr AX, nun
90 25 87108 aaa NULL ADD [B% 14 MOr BX, nun2
09 00 R2188: g8 gBg NULL ADD ADD AX, BX
0719B: 90 980 NULL ADD BX
F490 9710C: 90 Dg0 NULL ADD (BX 18 MOU result, AX
0210D: 98 aga NULL ADD CB%
02 04 0?10E: 90 Bgg NULL ADD CB% no AH, 4CH
8710F: 00 989 NULL ADD [BX
0710 97110: B8 1841 ADD
87111: 10 016 ADD [BX MAIN ENDP
FFFA 97112 : 0? 99? BEEP ADD 23 END MAIN

9000 97113: 8E 142 Ä ADD


07114: D8 216 ADD
9000 a2115: A1 1b ADD
97116: 00 090 ULI,
0000 97117: a0 990 NULL
07118: 8B 139 i ADD BX 4
0719 ADD [B% +
07119aa ADD (BX + AL
97 00 9711B: 90 Ø09 NULL ADD CB% AL
0711C: 03 003 ADD (BX
9711D: C3 195 ADD (B% + SIJ, AL
9711E: A3 163 ADD [B% sIJ, AL
0711F: 94 994

$CIeen $Ource (eset vars debug stack flags


JU
- CAUsers\Ayush\ Downloads\64_MPO1MULasm X

* bookmarks assembler help (GCE

VEW OPEN SAVE ASSEMBLE RUN

.MODEL SMALL

.DATAnum1 DW 1234H
num2 DW 1234H
esult Low DW ?
resultHigh DW ?
.CODE
MAIN PROC
MOU AX, eDAIA
MOU DS, AX
MOr A%, num1
MUL num2
MOU resultLow, AX
MOU resultHigh, D%
MOU AH, 4CH
INT 21H
MAIN ENDP
END MA IN

or: 64_MP01MULexe oriainal source code


g view virtual devices vitual drive help B1 M0DEL, S MA LL
.DATA
step back single step step delay ms: 0 nun1 DW 1234H
reload run
nun2 DW 1234H
resultLow DW ?
8710:0004 F400:0200 resultHigh DW ?
L
97144: 90 144 É BI OS DI .CODE
90 INI 320h 16 MA IN PROC
97105 : 5A 890 Z
00 071A6 : 4B 975 K IRET 11 HOr AX, eDAIA
g7197: 01 901 O ADD [BX 12 MOr DS. AX
27 0?198 : 0g B98 NULL ADD
ADD
B
R
S
MOU AX, num1
B2199: 90 998 NULL
48 971a0 : 9A A99 NULL ADD R
ADD MUI, nun2
8219B: 90 B90 NULL
400 9719C: 90 B09 NULL ADD B
G710D: 90 990 NULL ADD [BX MOU esultLow, AX
200 ADD B 19 MOæ resultHigh, D8
9719E: 90 990 NULL
0719F : 80 BØ8 NULL ADD (BX
710 07118: B8 184 3 ADD MOU AH 4GH
87111: 10 916 º ADD BX 22 INT 214
FFA
07112: 87 987 BEEP ADD 82 23 MAIN ENDP
87113: 8E 142 A ADD B 94 END
0000
87114: D8 216 ADD
D000 87115: A1 161 i ADD
97116: 08 B90 NULL ADD B)
D006 97112: 0g 990 NULL ADD
97118: P? 24? ADD
9719 07119: 26 M38 & ADD B
0711A: 92 B92 O ADD
07 90 ADD
9711B: 99 999 NULL
0711C: A3 L63 ú ADD
0711 D: 94 004 ADD
AL
6?11E: 00 998 NULL
0711F: 89 137

SCIeen sOurce reset auxvas debug slack lags


e CAUsersAyush\Downloads\64_MPO1DIV.asm
dt bookmarks assembler help

NEW OPEN SAVE ASSEMBLE RUN

.MODEL SMALL
. DAIA
num1 DW 1234H
num2 DW 1234H
result DW ?
.CODE
8
9 MAIN PROC
MOU A, eDATA
MOU DS, A8
MOU A%. nun1
DIr nun2
MOU result, AX
MOU AH, 4CH
INI 21H
1 MAIN ENDP
2 END MAIN

lator: 64_MPO1DIV.exe original source code

ug view virtual devices virtual drive help .MODEL SMALL


ID DATA
4 nun1 DW 1234H
reload step back single step un step delay ms: 0 95 nun2 DW 1234H
G6 result DW ?
9710:9904 F499: 9290
H L -CODE

4C01 92184: 91 061 BIOS DI N PROC


97195: 80 990 NULL eDAIA
0099 97196: 90 99 NULL IRET 11 MOä DS. AX
87197: 08 80 NULL ADD (BX SI
00 23 97198: 90 99g NULL ADD [BR MOU AX. nuni
97109: 00 A9A NULL ADI
0990 921AA: G8 G9g NULL ADD 1 DIU num2
0710B: AA AAA NUILL ADD 1
F490 0718C: 09 B00 NULL MOU result, AX
9?19D : 00 agg NULL
02 90 0710E: A0 BA0 NULL 19 MOr AH, 4CH
9219F: 00 0B NULL 29 INI 21H
0710 87119: B8 184 MAIN ENDP
87111: 10 Ø16 END MAIN
FFFA 0?112: 0? a07 BEEP ADD (BX
9000 B7113 : 8E 142 ADD (B%
B7114: D8 216 ADD (B% 26
ADD CBX
Haa NULL ADD (BX AL
a2112: Ag ARg NULL ADD (B% AL
97118: P2 242 ADD CBX AL
0710 07119: 36 954 6 ADD [BX S I . AL
9711A: 92 092 O ADD (BX SI. AL
97 90 ø711B: 80 009 NULL ADD [BX SI ], AL
9711C: A3 163 ú ADD [BX SI). AL
9711 D: 04 994 ADD [BX SIJ, AL
0711E: 99 900 NULL ADD (BX SI1, AL
9711P: B4 189 1

SC1een SOce teset Vars debug stack llags


K.G.C.E. Page No.:
Karjat - Raigad Expeiment No.2 Date :
EKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCE,

Aimwite a ayembly language opm


Senrca the aogeat dd tain an

Kla.me Aditya Mohendoa kamnde

BathA2

Rall No

IRemah
Flowchort

START
set stitegisker
anay pointoy
AL Brst byte
mpat ALt BL
(taking) egister
J
set cl cu Byte Yes
Count

No

more B1 toL
Incement Array

Gethe seecondany
byte
No
ot Aray in Bl-nytor
Decrement the
Byte count Iyes
|store AlLin
memy

STOf
K.G..E. Page No.:

Karjat - Raigad Expessimont No2 Date :


K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K G C E K S

wecEKGCEKGCEKGCEKGCEKGCEK

Aim alemhly lhngaage pazg


o Seoth the laraeA data ia

Ohjectve' To undexttand how aec


handled in adlemhly anguage
To implement Comparinn and canddm um
ntKohim

X86emulao like FMURO3)

hen aSema onanoe to fad


Hae
idekethugh all
elen mentt
with emosay mamum
tond
vegitten the ioa Masimum.Thi,
CanaAeA Lnhl all e lenmanta
Ohected.
oben Analyok Toh Aad largea ualue in
K.G.C.E. Page No.:
Karjat - Raigad Date :

KGCEKGCEKGCEKGCEKGCKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKOCEKGCEKGCEKGUEND

Stares the frt anau demeat in the AL railto


tnita maximum
Then, ompart each o the emnainias CN-0
elemente uitta Al one by
T! a it replace the.
Cnrent

Aler al Compamk Al ontaing the layeat

Algonthm
load he atng £ddril! o oan n ST - reqi
2Lodhe dddti

qet the Aa kute dag honay in Al-i


|Decarmel thehue Caunitr)
aTncrment the a y painto T- raitter)

Compaot langest(AL Rnest hyte (BL) of aay


. chech azay flag if caay Aay it reset-the
Ao ste 12atherwice qo to next gtep
Moxc lto Al
Decrement bule Caunt (le regit)
TA zem iciet then go
to net step
h u Stop the Iásst ata in memm painkd by l
Page No.:
K.G.C.E.
Karjat - Raigad Date :
CCEKGCEKGCEKGOcEKGCEKGCKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCE

Rey inttaictn"ed

mores date
Compooe
TNC inoement
TGE- Jump to label if ocator or eqad
Dos intearuptto tominattae pangiar
Suynta MoAestaatkn
Operand4 opazand2

iv) TUea tex


able
VNTH

mboro Faplanatn

unHI' the ontento


(it dsplacenat)

Me, A data act umalato i


ghen ininthuchn
oy subbachm
CAU)<data& eFelZso the rÀult
cAult
iiwed to
THCAL) : data&
K.G.C.E.
Karjat - Raigad Page No.:
esKGCEKGCEKGCEKGCEKGCE
|Date :
KGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGGEKOO

) NC reai Mem The conkent othe


Yeonitee s incocmented
by
ump ove od
lable

Procedaxt
Detnean ootam wtote volafA
Stor tae reH

lLondtheAtlement ot the ary into A


L seLonp de ompa monag. element
aing
looping
he lange to tare
Naledo
LARGESL
Rit he prDgram ing PNT 2H
Result
elemenk
laxget elemenk bam the a
stored in memMng Vanable LARGT
Reut el02
K.G.C.E.
Page No.:
Karjat - Raigad
|Date :
AcKGCEKGOCEKGCEKGCEKGCEI KGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGCEKGÇEKGCEKGCEKGGE

Cancuatom' Thii eignn Sucterhas


Sucteublly od
he larget elenent tn
a gien
Astembly languaqe. P} cdementtelke
etetire
manipulatin a pracealag
eel Qragramming
rs vMyUsnDownioaass\04_Mrvc.asm

bookmarks assembler help

OPEN SAVE
NEW ASSEMBLE RUN

MODEL SMALL

.DATA
.n DB DB ?23. 102, 45. 56, 6. 78, 89,
LARGESI 12, 90, 63
CODE

MA IN PROC
MOU AX, eDATA
MOU DS, AX
MOU SI, 0
MOU AL, nun [SI]
MOU C%, 9
INC SI

FIND_LARGESI:
9 MOU BL, num [SIJ
CMP AL, BL
JGE SKIP_UPDATE
MOr AL, BL
SKIP_UPDATE:
I NC SI
29
31 L0OP FIND_LARGEST
32 MOr LARGEST, AL
34 MOU AH, 4CH
36 INI 21H
MAIN ENDP
39 END MA IN
40

nylator. 64 MP02 exe ornginal source code


ebug view virtual devices virtual drive help .HODEL SMALL

AD
ID . DAIA
reload step back Single step run step delay ms: 0 84 nun DB 12, 23, 102. 45., 56.
LARGESI DB
0710: 0904 F499:02 94 .CODE
HL 08 MAIN PROC
AC 66 02191: 38 956 8 BIOS DI 99 MOU AX. eDATA
87105: 43 067 C | INI B21h 10 MO DS. A%
00 3F 97106: 4E 978 N IRET
87187: 59 989 Y ADD:X S I . AL 12 MOr_ SI, 8
a7108: 50 99 Z ADD BX S I . AL 1T0r AL, nun [SI 1
07109 : 3P A63 ? ADD BX SI).
00 00 a2100 : 66 192 f ADD [BX 15 MO C%. 9
9710B: B0 90 NULL ADD BX SI
F400 0710C: 00 909 NULL ADD [ BX INC SI
9710D: 09 990 NULL ADD [BX
02 04 9710E: 00 ØØ0 NULL 19 FIND_LARGES I :
0710F: 00 990 NULL 20 MOU BL, nun(SI J
0710 8n18: B8 184 a ADD BX
ADD [BX 22 CHP AL, BL
FFFA a : a2 ag2 BEEP ADD [BX 23

0000 92113: 9E 1a2 ADD ( BX JGE SKIP_UP DAIE


87114: D8 216 ADD (BX
000A 97115: BE 194 ADD (BX MOU AL, BL
92116: 80 09 NULL ADD (B%
0000 07112: 90 g0 NULL ADD [BX SKIP_UPDAIE:
07118: 8A 138 & ADD [BX I NG SI
$ 0710 97119: 94 994 " ADD [ BX S AL
9711A: B9 185 | ADD BX AL LOOP FIND_LARGESI
07 00 ADD ( BX SI]. AL 32
9711 B: 99 999 TAB SI), AL MOU LARGES I, AL
8711C: 99 999 NULL ADD ( BX
8711 D: 46 979 P ADD (BX SIJ, AL
0211E: 8A 1 38 ADD CB% + SIJ, AL 35 MoU AH, 4CH
8711F: 1C 928 36 INI 21
38 MAIN ENDP
SCleen $Ource (eset a VALS debug stack llags

You might also like