Week 1 - Assembly Language and Computer Programming + Number System

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 36

Assembly Language and

Computer Programming
Sara Muneeb
sara.muneeb@cuilahore.edu.pk
Why Assembly Language?
• Hardware manipulation
• Access to specialized
processor instructions
• To address critical
performance issues
• Device drivers
• Low-level embedded
systems
• Real-time systems
Course Material
• Text Book
– Assembly Language Programming and
Organization of the IBM PC”, Ytha Yu and Charles
Marut, McGraw Hill
– Bilal Hashmi VU Notes (CS401)
• Lab Assignments
• Class Assignment
Structure
• Structure is the way in which components
relate to each other
• Difference in Peripherals & Communication
Lines

5
Structure - Top Level

Peripherals Computer

Central Main
Processing Memory
Unit

Computer
Systems
Interconnection

Input
Output
Communication
lines

6
Structure – Top Level Contd..
• Four main structural components:

– CPU: controls the operation of the computer and performs


its data processing functions; often referred as processor.
– Main Memory: stores data
– I/O: moves data between the computer and its external
environment.
– System Interconnections: Mechanism for communication
among CPU, memory, and I/O.

7
Structure - The CPU

CPU

Computer Arithmetic
Registers and
I/O Logic Unit
System CPU
Bus
Internal CPU
Memory Interconnection

Control
Unit

8
Structure – The CPU
1. Control Unit: controls the operation of CPU and hence the
computer.
2. Arithmetic and logic unit: performs the computer’s data
processing functions.
3. Registers: provides storage internal to CPU.
4. CPU interconnection: Mechanism that provides for
communication among the control unit, ALU, and registers.

9
Structure - The Control Unit

Control Unit

CPU
Sequencing
ALU Logic
Control
Internal
Unit
Bus
Control Unit
Registers Registers and
Decoders

Control
Memory

10
Function
• Function is the operation of individual
components as part of the structure.
• Main functions performed by a computer system are:
1. Process Data
2. Store Data
3. Move Data
4. Control the above three functions

11
Functional View of Computer

12
Possible Operations

Data storage device (read/write) 13


Data movement device
Possible Operations Contd..

Processing on data stored in storage or in external environment


14
Programming Languages

• High-Level Languages (HLL)


• Assembly Language
• Machine Language

15
Essential Tools
• Assembler is a program that converts source-code
programs into a machine language (object file).
• Linker joins together two or more object files and produces
a single executable file.
• Debugger loads an executable program, displays the source
code, and lets the programmer step through the program
one instruction at a time, and display and modify memory.
• Emulator allows you to load and run assembly language
programs, examine and change contents of registers.
Example: EMU8086

16
Data Representation
Types Number System
• Positional Number System
– A computer can understand positional number system where there
are only a few symbols called digits and these symbols represent
different values depending on the position they occupy in the number.
• Non Positional Number System
– Symbols such as I,II,III,IV ETC.
– Each symbol represent same value regardless of its position.

18
Positional Number System
• Decimal Number System
• Binary Number System
• Hexa-decimal Number System
• Octal Number System
Converting Hexadecimal to Decimal
• Multiply each digit of the hexadecimal number from right to
left with its corresponding power of 16 or weighted value.
• Convert the Hexadecimal number 82ADh to decimal number.

20
Converting Binary to Decimal
• Multiply each digit of the binary number from right to left
with its corresponding power of 2 or weighted value.
• Convert the Binary number 11101 to decimal number.

21
Converting a Decimal Number to a Number
of Another Base
Converting a Number of Some Base to a
Number of Another Base
Formating of Fractional Numbers in Binary
Number System
Formating of Fractional Numbers in Binary
Number System
Formating of Fractional Numbers in Octal
Number System
Formating of Fractional Numbers in Octal
Number System
Binary Arithmetic Operations
• Like decimal numbers, two numbers can be added by adding
each pair of digits together with carry propagation and
subtracted by borrowing bits.

11001 11001
+ 10011 - 10011
101100 00110

Binary Addition Binary Subtraction

35
Hexadecimal Arithmetic Operations
• Like decimal numbers, two numbers can be added by adding
each pair of digits together with carry propagation.

5B39 D26F
+ 7AF4 - BA94
D62D 17DB

Hexadecimal Addition Hexadecimal Subtraction

36

You might also like