Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Assembly Language
Muhammad Usman
Reference Books
• Assembly Language for Intel Based
Computers
– Kip R. Irvine
• Computer Organization and Architecture
– William Stalling
FUUAST, Islamabad 2
Marks Distribution
• Assignments &
Quizzes 20%
• Mid Term 30%
• Annual 50%
FUUAST, Islamabad 3
Introduction
• Computer
– 1613 “The Young Man Gleaning” by Richard
Braithwaite used term “computer” for
calculations and computations
– History of computer
– Initial computers
– Intermediate development
– Modern computing devices
FUUAST, Islamabad 4
Continue…
• Components
– Input unit
– Output unit
– Storage unit
• Memory and its types
– Processing unit
• CU (functioning)
• ALU (functioning)
• Architecture: RISC VS SISC
FUUAST, Islamabad 5
Continue…
• Ports
– Serial port (mouse, modem, USB)
– Parallel port (LPT1)
• Busses
– Data bus (bidirectional, connect various devices)
– Address bus (unidirectional between CPU and
RAM)
– Control bus (unidirectional, CPU sends control
signals to various devices)
FUUAST, Islamabad 6
Continue…
• Computer programs and software
• Programming languages
– Low level language
• Machine language
• Assembly language
– High level language
• Language translators
• Networking and internet
FUUAST, Islamabad 7
Continue…
• Multitasking vs
• Multiprocessing vs
• Multicore
FUUAST, Islamabad 8
Complier
• Converts source code to executable code
• Stages:
– Lexing: Breakup the text of program into
tokens like variables, keywords, functions
– Parsing: Parse tree is a data structure. Parse
tree is created
– Optimization: Unused variables are removed
– Translate the parse tree into machine code
FUUAST, Islamabad 9
Continue…
• A complier should:
– Determine the correctness of syntax
– Generate efficient object code
– Runtime organization
– Formatting output
FUUAST, Islamabad 10
Data Representation
• Low and high voltage levels
• Bits and Bytes
• ASCII
• Word size
• Bitmap representation
• Big Endian vs Little Endian
• Context:
– 16186219 (OS/Word Processor/Human ?)
FUUAST, Islamabad 11
Number System
• Decimal
– Base 10 implemented as 10 fingers
– Representation: 1710 = 101x1 + 100x7
• Binary
– Base 2 (binary representation)
– Representation: 1012 = 22x1 + 21x0 + 20x1
FUUAST, Islamabad 12
Continue…
• Octal
– Base 8
– Representation: 2768 = 82x2 + 81x7 + 80x6
• Hexadecimal
– Base 16
– Representation: AFC8 = 162xA + 161xF + 160xC
– A=10, F=15, C=13
FUUAST, Islamabad 13
Continue…
• Binary to Octal
– (110 111)2 = (67)8
– 3 bit groups and convert using table
• Binary to Hexa
– (1000 1101 0100)2 = (8D4)8
– 4 bit groups and convert using table
FUUAST, Islamabad 14
Simple Instruction Format
FUUAST, Islamabad 15
Instruction Execution Cycle
Fetch
Instruction
from Main
Memory
Execute Decode
Instruction Instruction
FUUAST, Islamabad 16
Machine Instructions
• Set of instructions executed directly by a
CPU
• Machine codes in binary
• Computer program written/converted into
machine code
• Each instruction perform a specific task
• CPU looks in main memory of machine
instructions
FUUAST, Islamabad 17
Elements: Machine Instructions
• Operation code
– ADD, SUB, LOAD, STOR
• Source operand reference
– One or more sources of input
• Result operand reference
– Result of the operation
• Next instruction reference
– Where to fetch the next instruction
FUUAST, Islamabad 18
Continue…
• ADD R, Y
– Load the contents of “Y” memory location into
“R” register
• X=X+Y
– (e.g. X is 601 and Y is 602 memory locations)
– Load a register with contents of 601
– Add the contents of 602 to register
– Store the contents of register to 601
FUUAST, Islamabad 19
Computer Organization
• Refers to the operational units and their
interconnections that realize the
architectural specifications
• Organizational attributes
– Hardware details transparent to programmer,
control signals, interfaces between computer
and peripherals, memory technology used
• Way of practical implementation
FUUAST, Islamabad 20