complete masm installation guide
TRANSCRIPT
-
8/13/2019 Complete Masm Installation Guide
1/21
1. Download masm from http://www.masm32.com/
2. Unzip the package and run install.exe
http://www.masm32.com/http://www.masm32.com/ -
8/13/2019 Complete Masm Installation Guide
2/21
3. Set the path to the compiler. pen !"# computer$% rightclick and select !&roperties$. Select !'d(anced$ )*!+n(ironment (aria,les$)*$&ath$. -lick !+dit$ and add!c:masm32,in$ to the path
-
8/13/2019 Complete Masm Installation Guide
3/21
0. -heck the installation ,# opening the command promptwindowStart)*un)*cmd
-
8/13/2019 Complete Masm Installation Guide
4/21
and t#ping "4 at the command prompt
5. Download 16),it (ersion of the link.exe from the"icrosoft7s we,site
http://download.microsoft.com/download/(c15/Update/1/89;
-
8/13/2019 Complete Masm Installation Guide
5/21
6. Download -ode ?iew De,ugger
http://kipir(ine.com/asm/5th/c(/c(01patch.exe
Unzip all files to c:masm32,in
@. ow #ou can use almost an# text editor to create anassem,l# program. 9n this example% we will use "icrosoft7s+D9A. A#pe !edit example1.asm$ on the command promptand enter the text of the program.
Sa(e the file ,# !'lt)B$%$'ltCS$. +xit !'lt)B$%!'lt)$
-
8/13/2019 Complete Masm Installation Guide
6/21
;. ow lets start and configure the -ode ?iew de,ugger.A#pe !c( example1.exe7 at the command prompt.
+nter !'lt)8$ and make sure that #ou ha(e the followingwindows on the screen:
- -ode 1
- egisters
- "emor# 1
&ress !'lt)B5$ to arrange the windows on the screen.
-
8/13/2019 Complete Masm Installation Guide
7/21
ow lets set the options. !'lt)$ )* &references. Set theoptions as shown and click !ok$.
-
8/13/2019 Complete Masm Installation Guide
8/21
'gain% !'lt)$ )* !Source 1 window$
!'lt)$ ) *$"emor# 1 window$
-
8/13/2019 Complete Masm Installation Guide
9/21
Ahe configuration is now complete.
1F. 4ets look at the program.
-
8/13/2019 Complete Masm Installation Guide
10/21
-
8/13/2019 Complete Masm Installation Guide
11/21
-
8/13/2019 Complete Masm Installation Guide
12/21
11. ow lets step through the program and o,ser(eexecution of each instruction.
- &ress !B1F$.
- Ahe de,ugger will show execution of the first line of
the prolog.
- &ress !B1F$ until instruction !"? '%F$ ishighlighted. Ahis is the first instruction of #ourprogram.
-
8/13/2019 Complete Masm Installation Guide
13/21
,ser(e the (alue in the register +'. egister 'contains num,er F;DBG.
-
8/13/2019 Complete Masm Installation Guide
14/21
ow press !B1F$. Ahe de,ugger will execute thehighlighted instruction.
ote the change in the content of +' and the fact that theregister has ,een highlighted ,# the de,ugger% indicatingthe change.
Ahe highlighting the code window mo(ed to the nextinstruction.
ote that the line of the source code !"? '4% ?'1$
,ecame!"? '4% HFFF-I where FFF-G is the actual offset of ?'1in the data segment. >ou can check that this is true ,#checking the content of memor# location DS:FFF-G in thedata window.
-
8/13/2019 Complete Masm Installation Guide
15/21
ow execute this instruction ,# pressing !B1F$. -ontent ofthe register '4 changed% taking the (alue from the ?'1.
Ahe next instruction is !"? =% BBS+A ?'2$. ?'2follows ?'1 in memor# and has offset of FFFDG. Ahis isthe (alue that will ,e placed into the = upon execution ofthis instruction. &ress !B1F$ to execute.
-
8/13/2019 Complete Masm Installation Guide
16/21
Ahe following instruction !"? H=I% '4$ will cop# thecontent of '4 into the memor# location pointed ,# =within the data segment. 'fter the pre(ious instruction =contains the offset of the first ,#te of ?'2 or FFFDG. Ahatis where the data from '4 will appear. &ress !B1F$ to
execute.
ote the de,ugger also highlighted changes in the datawindow.
-
8/13/2019 Complete Masm Installation Guide
17/21
9nstruction !"? H=C1I% '4$ will cop# the content of theregister '4 into the memor# location with offset eJualwhate(er the num,er is in = plus 1. 9n our case=KFFFDG% then the offset is FFFDGCFFF1GKFFF+G. Ahat isthe second ,#te of the ?'2. &ress !B1F$ to execute. ote
the change in the memor# content.
-
8/13/2019 Complete Masm Installation Guide
18/21
9nstruction !"? +'% 123056@
-
8/13/2019 Complete Masm Installation Guide
19/21
Ahe instruction !"? ?'3% +'$ ,ecame!"? D8D &A HFFFBI% +'$.
?'3 has ,een replaced ,# the actual offset FFFBG of?'3 in the data memor#. Ahis instruction will take thecontent of the +' and place into the four consecuti(e,#tes of memor# a 32),it (aria,le starting with the offsetFFFBG. &ress !B1F$ to execute.
Ahat was the last instruction of the user program. Aheremaining instructions are generated ,# the .+9A directi(e
and ser(e to terminate the program. &ress !B1F$ until theprocess terminates.
-
8/13/2019 Complete Masm Installation Guide
20/21
Still not clear how to work with the -ode?iew de,uggerL
Gere is additional tutorials #ou can go through.
-ode?iew tutorial
http://www.nu(isionmiami.com/,ooks/asm/c(/index.htm
De,ugging
http://www.math.uaa.alaska.edu/MafkNm/cs221/handouts/de
,ugging.pdf
http://www.nuvisionmiami.com/books/asm/cv/index.htmhttp://www.math.uaa.alaska.edu/~afkjm/cs221/handouts/debugging.pdfhttp://www.math.uaa.alaska.edu/~afkjm/cs221/handouts/debugging.pdfhttp://www.nuvisionmiami.com/books/asm/cv/index.htmhttp://www.math.uaa.alaska.edu/~afkjm/cs221/handouts/debugging.pdfhttp://www.math.uaa.alaska.edu/~afkjm/cs221/handouts/debugging.pdf -
8/13/2019 Complete Masm Installation Guide
21/21