Assembly Lab 1

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

Akhbar El-Yom Academy

Computer Science Department - Third Year


Course: Assembly Language
Lab (1)

Welcome to Assembly Language

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.

Why Learn Assembly Language?

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

Assembly with Visual Studio

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

How to start your first project?

1. Download the Irvine folder.


2. Put the folder in drive (C:\).
3. Open it and you will find a folder “Project_Template”.
4. Make a folder for your assembly projects.
5. Copy in it the Project_Template folder and rename it as you like (e.g. Lab2).
6. Open your Folder and you will find a file called “Project.sln”.
7. Open this file.

32-bit General-Purpose Registers

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:

 Carry CF – unsigned arithmetic out of range


 Overflow OF– signed arithmetic out of range
 Sign SF– result is negative
 Zero ZF– result is zero
 Auxiliary Carry AC– carry from bit 3 to bit 4
 Parity PF– sum of 1 bits is an even number

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy