You are on page 1of 27

CPE 321

Computer System
Organization with
Assembly Language
Objectives :
To be able to understand the relationship
between hardware and software on how they
work together.

To be able to utilize debug/assembler and


linker in making assembly language program.

To be able generate assembly language


program.
Terminologies
Bit is a binary digit that can have a value of 0 or 1
Byte is defined as 8 bits
- basic unit of memory
Nibble a half of a byte, or 4 bits
Word is two bytes, or 16 bits
Doubleword a 4-byte (32-bit) data item
Quadword an 8-byte (64-bit) data item
Paragraph a 16-byte (128-bit) data item
Kilobyte is 210 bytes, which is 1024 bytes. The abbreviation
K is often used.
Ex. Some floppy disks hold 356K bytes of data
Megabyte, or meg is 220 bytes. It is exactly 1, 048, 576.
Terabyte is 240 bytes (over 1 trillion)
Internal Organizations of Computer
The internal working of every computer can
be broken into three parts:

1. CPU (central processing unit) - the brain of


the PC- its function is to fetch instruction from
memory and execute them
Resources:
Registers the CPU registers to store
information temporarily (may be a value or
address of the value)
Internal Organizations of Computer
CPU
Internal Organizations of Computer
Resources :
- It can be 8, 16, 32, 64-bit registers
depending on the CPU
- The bigger the register, the better the CPU
increased cost of CPU

ALU (arithmetic/logic unit) it is responsible for


performing arithmetic functions such as add,
subtract, multiply, and divide, and logic
functions such as AND, OR and NOT
Internal Organizations of Computer
Resources :
Program counter its function is to point top
the address of the next instruction to be
executed.
- is a register called IP, or the instruction
pointer

Instruction Decoder its function is to interpret


the instruction fetched into the CPU
Internal Organizations of Computer
How the CPU works
The CPU reads instructions (instruction fetch) from the
program storage (the flash), translates those into
executable steps and executes those.
Those instructions are written as 16 bit numbers to the
flash storage, and are read from there (first step). The
number read then translates (second step) e. g. to
transporting the content of the two registers R0 and R1
to the ALU (third step), to add those (fourth step) and
to write the result into the register R0 (fifth step).
Registers are simple 8 bit wide storages that can
directly be tied to the ALU to be read from and to be
written to.
Internal Organizations of Computer
CPU Operations
Internal Organizations of Computer
Internal Organizations of Computer
2. Memory

.Two types of memory:


RAM stands for random access memory
(sometimes called read/write memory)
- it is used by the computer for temporary
storage of programs that is running. The data
is lost when the computer is turned off.
- It is sometimes called volatile memory
Internal Organizations of Computer
Image of RAM
Internal Organizations of Computer

ROM stands for read only memory


- contains programs and information essential
to operation of the computer.
- The information in ROM is permanent,
cannot be changed by the user, and is not
lost when the power is turned off.
- It is called nonvolatile memory
Internal Organizations of Computer
Internal Organizations of Computer
Primary memory is a fast memory that operates at
electronic speeds
- RAM and ROM
Secondary memory is used when large amounts of
data and many programs have to be stored, particularly
for information that is accessed infrequently
- disks
Cache memory this is a small, fast memory that is
inserted between the larger, slower main memory and
the processor
- it holds the currently active segments of a program and
their data
Internal Organizations of Computer
Cache Memory - The basic purpose of cache
memory is to store program instructions that
are frequently re-referenced by software
during operation. Fast access to these
instructions increases the overall speed of the
software program. Also called the CPU
memory.
Internal Organizations of Computer
Cache memory levels - Cache memory is fast
and expensive. Traditionally, it is categorized
as "levels" that describe its closeness and
accessibility to the microprocessor:
Internal Organizations of Computer
Internal Organizations of Computer
3. I/O (input/output) devices its function is to
provide a means of communicating with the
CPU

Bus with wires attached to the system board


connects I/O and memory to CPU
- it transfers data between the processor,
memory, and external devices, in effect
managing traffic
Internal Organizations of Computer
Three types of buses:

Address bus is used to identify the devices


and memory connections to the CPU, the
more address bus available, the larger the
number of devices that can be addressed
- the number of address buses for a CPU
determines the number of locations with which
it can communicate
Internal Organizations of Computer
Address Bus - It is a group of wires or lines
that are used to transfer the addresses of
Memory or I/O devices. Unidirectional

In Intel 8085 microprocessor, Address bus was


of 16 bits. This means that Microprocessor 8085
can transfer maximum 16 but address which
means it can address 65,536 different memory
locations.
Internal Organizations of Computer
Data bus used to get from a devices or to
send data to it

- used to carry information in and out of a


CPU, the more data buses available, the better
the CPU

- more data buses means a more expensive


CPU and computer
Internal Organizations of Computer
Data Bus - As names tells that it is used to
transfer data within Microprocessor and
Memory I/O devices. It is bi-directional as
Microprocessor requires to send or receiver
data. The data bus also works as bus in 8 bits
long. The word length of a processor depends
on data bus, that's why Intel 8085 is called 8
bits Microprocessor because it has 8 bit data
bus.
Internal Organizations of Computer
Internal Organizations of Computer
Control bus used to provide read or write
signals to the device to indicate if the CPU is
asking for information or sending it
information

Address bus and data bus determine the


capability of a given CPU
Internal Organizations of Computer
The hardware of micro-controllers
What has the hardware to do with assembler?
- The concept behind assembler is to make
the hardware resources of the processor
accessible.

Accessible means directly accessible and not


via drivers or other interfaces, that an
operating system provides. That means, you
control the serial interface or the AD
converter, not some other layer between you
Thank You ! ! !

You might also like