Assembly 01
Assembly 01
Lecture 1
Ahmed Sallam
Slides based on original lecture slides by Dr. Mahmoud Elgayyar
Syllabus
Course arrangment
General rules
Why Assembly?
Blast from the past
Layered Perspective of Computing
Data Representation
Base 2, 8, 10, 16 Number systems
Lab
Assitant Israa
Contact [email protected]
Textbook
Assembly Language for x86 Processors 6th ed.
(Kip Irvine)
Lecture Assignment
Submitted in groups (3-5 students)
Submitted to Israa
(Firm deadline)
Midterm exam
Bonus
Syllabus
Course arrangment
General rules
Slide rule
Abacus
Curta (1948)
Pascaline
Vacuum Tube
Half Adder
Memory ?!!
Punched Card
C++ language
cout<<(A*B+C)
Games, Graphics
Program execution:
Interpretation
Compilation (Translation)
Every CPU has a built-in interpreter for its own "instruction set"
(ISA, Instruction Set Architecture; the binary language it is
programmed in)
High Level
Level 4
Language
Instruction Set
Level 2 Architecture (ISA)
• C Compiler (translator)
Microsoft C
Compiler
• Produces assembly language (object file)
•Programmer
JEdit •Produces a Java Program
37 = 100101
25/09/2013 Assemly Language-Lecture 1 29
Binary Addition
Same as normal addition, from right to left
0 + 0 = 0
0 + 1 = 1, 1 + 0 = 1
1 + 1 = 1 with a carry of 1
carry: 1
0 0 0 0 0 1 0 0 (4)
+ 0 0 0 0 0 1 1 1 (7)
0 0 0 0 1 0 1 1 (11)
bit position: 7 6 5 4 3 2 1 0
and 8
E.g., 0100 = 4, 1001 = 8 + 1 = 9, 0110 = 4 + 2 + 1 = 7, 1010 = 8 + 2
= 10, 0110 = 4 + 2 = 6, 0001 = 1
Translate the decimal into hex: 1 6 10 7 9 4 = 16A794
word 16
doubleword 32
quadword 64
Byte = 8 Bits
Word = 2 Bytes
Doubleword = 2 Words = 4 Bytes
Quadword = 4 Words = 8 Bytes = 64 Bits = Max value for a 64 bit CPU
1 1 1 1 0 1 1 0
Negative
0 0 0 0 1 0 1 0 Positive
ANSI (0 – 255)
Unicode (0 – 65,535)
Null-terminated String
Array of characters followed by a null byte
NOT
AND
OR
Two-input multiplexer
S
X
mux Z
Y