Assembly Lab 1
Assembly Lab 1
Assembly Lab 1
Assembly Language for x86 Processors focuses on programming microprocessors compatible with the
Intel IA-32 and AMD x86 processors running under Microsoft Windows. The x86 processor types first
appeared in the Intel 80386 processor, and continued with processors such as the Intel Pentium, Intel
Pentium 4, Intel Pentium Core Duo, and the Advanced Micro Devices (AMD) Athlon. Microsoft Macro
Assembler 8.0, 9.0, or 10.0 can be used in this course. This assembler is commonly known by its
nickname: MASM. There are other good assemblers for Intel-based computers, including TASM (Turbo
Assembler), NASM (Netwide Assembler), and the GNU assembler. Of these, TASM has the most similar
syntax to MASM. The NASM assembler is next closest in similarity to MASM. Finally, the GNU
assembler has a completely different syntax.
If you’re still not convinced that you should learn assembly language, consider the following points:
• If you study computer engineering, you may likely be asked to write embedded programs. They are short
programs stored in a small amount of memory in single-purpose devices such as telephones, automobile
fuel and ignition systems, air-conditioning control systems, security systems, data acquisition instruments,
video cards, sound cards, hard drives, modems, and printers. Assembly language is an ideal tool for
writing embedded programs because of its economical use of memory.
• Real-time applications dealing with simulation and hardware monitoring require precise timing and
responses. High-level languages do not give programmers exact control over machine code generated by
compilers. Assembly language permits you to precisely specify a program’s executable code.
• Computer game consoles require their software to be highly optimized for small code size and fast
execution. Game programmers are experts at writing code that takes full advantage of hardware features in
a target system. They use assembly language as their tool of choice because it permits direct access to
computer hardware, and code can be hand optimized for speed.
• Assembly language helps you to gain an overall understanding of the interaction between computer
hardware, operating systems, and application programs. Using assembly language, you can apply and test
theoretical information you are given in computer architecture and operating systems courses.
• Some high-level languages abstract their data representation to the point that it becomes awkward to
perform low-level tasks such as bit manipulation. In such an environment, programmers will often call
subroutines written in assembly language to accomplish their goal.
The programming languages
Machine Language: is a set of binary codes (0’s and 1’s) that represent instructions of a specific
machine.
Assembly Language: is a machine‐level programming language that uses Mnemonics (symbols) instead
of numeric codes to simplify programming.
High-level language: it has a lot of features and capabilities that simplify programming too much.
Assembler: converts assembly programs to code that is near to machine language code.
Compiler: converts high‐level programs to assembly code.
Translating Languages
Please visit:
Getting Started with MASM and Visual Studio
http://kipirvine.com/asm/gettingStartedVS2015/index.htm
“Assembly Language for x86 Processors” Book
https://www.dropbox.com/s/g6jjweq1onkxp7l/assembly_language_for_x86_processors.pdf?dl=0
Irvine Library
https://www.dropbox.com/s/sa1zff5v2629qr9/Irvine.zip?dl=0
Program Template
INCLUDE Irvine32.inc
.DATA
; Declare variables here
.CODE
main PROC
; Write your code here
Exit ; Terminate the execution of the program
main ENDP ; Marks the end of a procedure
END main ; Marks the end of the program
Registers are high-speed storage locations directly inside the CPU, designed to be accessed at much higher
speed than conventional memory. The general-purpose registers are primarily used for arithmetic, data
movement, and logical operations.
Status Flags
The Status flags reflect the outcomes of arithmetic and logical operations performed by the CPU. They are
the Overflow, Sign, Zero, Auxiliary Carry, Parity, and Carry flags. Their abbreviations are shown
immediately after their names: