Uploaded by Muhammad abid Mughal

00-SettingUpLab

advertisement
Assembly Language for x86 Processors
7th Edition
Setting Up Lab Environment
Setup an Assembly Project on Visual Studio 2019
• The Microsoft Visual Studio comes with the builtin Macro Assembler
• and provides many debugging capabilities (Register &
Memory View, Breakpoints and Step over).
• However there is no explicit assembly project template to
choose from.
1. Installing Visual Studio
2019
• Download ans install visual studio 2019
community edition
• https://visualstudio.microsoft.com/vs/older-downloads/
2. Creating a C++ project as a base project
• Launch Visual Studio 2019
2. Creating a C++ project as a base project
2. Creating a C++ project as a base project
3. Setup the Build Customization as Assembly
Language
3. Setup the Build Customization as Assembly
Language
4. Creating an Assembly Source File
4. Creating an Assembly Source File
4. Creating an Assembly Source File
;copy this code into MASMTemplate.asm
.386
.model flat, stdcall
.stack 4096
ExitProcess PROTO, dwExitCode:DWORD
.data
;variables goes here
.code
main proc
;code goes here
INVOKE ExitProcess, eax
main ENDP
END main ;specify the program's entry point
5. Save as a Project Template
5. Save as a Project Template
5. Save as a Project Template
Create a New Project
New Project Based on Assembly Lang
Template
New Project Based on Assembly Lang
Template
Debugging
• To set a breakpoint, just clicking the grey area in
front of the line of the source code. When running,
the program will pause before the execution of the
breakpoint line.
• To look at registers, select Debug > Windows >
Registers
Debugging
• To look at variables, select Debug > Windows >
Watch. Then type the variable name.
• Or select Debug > Windows > Memory >
Memory1. Then type “& varname” at the address
box.
• Also, we can debug step-by-step using “Step Into”
and “Step Over”.
• Close the console when debugging stops: Tools >
Options > Debugging > Automatically close the
console when debugging stops
Download