Sei sulla pagina 1di 35

Computer Organization

with Assembly
Language
Computer Science CS203/CS 312
Computer Engineering CpE310
Book:
IBM PC Assembly Language and Programming by
Peter Abel

Topics:
Basic Features of PC Hardware
Instruction Addressing and
Execution
Examining Computer Memory
and Executing Instructions
Requirements for Coding in
Assembly Language

Assembling, Linking, Executing


Programs
Symbolic Instructions and
Addressing
Program Logic and Control
Introduction to Video and
Keyboard Processing
Video Systems
Processing String Data
Processing ASCII and BCD data

Grading System
60% for Class Works
(Assignment, Quizzes, Class
Participation,
Laboratory
40%
100%

works)
for Periodical Exams

INTRODUCTION TO
ASSEMBLY LANGUAGE

What is Assembly
language?
- is alow-level
programming languagefor
computers, microprocessors,
microcontrollers, and other
programmable devices.
- it implements a symbolic
representation of the machine
codesand other constants
needed to program a given
CPUarchitecture.

Why do we need to study


Assembly language?
3 reasons:
- Fast
- Very fast
- Very very fast

In order to write high-level


languages, such a C/C++ and
Pascal.
Programs written in high-level
languages will usually not run
as fast as assembly language
programs.
To debug a higher-level
language.
Compiler writers must know
how to write assembly language
in order to have the compiler do
code generation.

Assembly language
programmer can earn more
than programmers who can not
write assembly language (in
those applications where
assembly language is required).
It requires less memory
consumptions.
Resident programs and
interrupt service routines are
almost always develop in
assembly language.

Writing assembly
language is fun and a
requirement for you
to graduate.

DISADVANTAGE:
It takes too much effort
to write applications in
assembly language.

Advantages:
Shows how programs interface with
the operating system, the
processor , and the BIOS.
Shows how data is represented and
stored in memory and on external
devices.
Clarifies how the processor accesses
and executes instructions and how
instructions access and process data.
Clarifies how a program accesses
external devices.

Requirements of learning
assembly language
IBM based personal computer
Operating system
Assembler translator program
Brain

Not required in
assembly language
Prior knowledge of any
programming language.
Prior knowledge of electronics
or circuitry.

Basic Features of PC
Hardware
Chapter 1
IBM PC Assembly Language and
Programming

Number systems

Decimal (10)
Octal (8)
Hexadecimal (16)
Binary (2)

Decimal (10)
Number system with a base
of 10.
Ex.

25610

Octal
Number system with a base of
8.

Ex.

2568

Hexadecimal
Number system with a base of
16.

Ex.

25616

Binary
Number system with a base of
2.

Ex.

2562

Bit
The fundamental building block
of computer storage
Maybe off (0) or on (1)
It doesnt provide much
information.

bytes
A group of nine related bits in
which the 9th bit represents
parity bit is called byte.

0
Data bits

parity

Related bytes

Data item or field

Group of bytes that defines a


particular value

1. Word = 2 bytes = 16 bits


2. Double word = 4 bytes
3. Quadword = 8 bytes
4. Paragraph = 16 bytes
5. Kbytes = 1,024 bytes
6. Megabyte = 1,048,576 bytes

Binary numbers
Each bit position represents
ascending powers of 2 from
right to left.
example:
41H = A = 0100 0001

Negative numbers
Sign bit is the leftmost bit
1 = negative
0 = positive

To express the binary number


to its opposite sign, apply the
2s complement.

PC component
Microprocessor
The brain of PC
Performs all executing of
instructions and processing of
data
Vary in speed, memory size,
registers, data bus

System board (mother board)


The main component of PC
Contains the processor, main
memory, expansion slots, etc

I/O Devices

Intel processors
8088
16-bit registers
8-bit data bus

8086
16-bit data bus (faster than 8088)

80286
16MB internal memory
Enables OS perform multitasking

80386
32-bit registers and data bus
4 billion bytes of memory
Supports virtual mode
(swapping)

80486
32-bit registers and data bus
Introduced High-speed cache

Pentium
32-bit registers
64-bit data bus
Separate caches for data and for
memory
Superscalar version of 80486
(executes more than 1 instruction
per clock cycle)

Pentium II and III


Have a dual independent bus
design that provides separate
paths to the system and memory
Processor is connected to a built-in
storage cache by a 64-bit wide
bus.

Pentium IV
It uses QDR (Quad Data Rate)
technique.
L2 to L1 memory data cache
is 256-wide.

Multi-core
Contains 2 or more
independent cores.