You are on page 1of 16

Microcomputer System

Lecture#3
Clock
Clock cycle = Clock period = 1 / Clock rate

Cycle 1 Cycle 2 Cycle 3

Clock period: The time interval between two clock pulse

Clock Pulse: An electrical signal that rise from a low


voltage to a high voltage & down again to a low voltage.

Clock Rate: The number of clock pulse per second


measured in megahertz (MHz)
Reading From Memory
Multiple clock cycles are required
Memory responds much more slowly than the CPU
Address is placed on address bus
Read Line (RD) goes low, indicating that processor
wants to read
CPU waits (one or more cycles) for memory to respond
Read Line (RD) goes high, indicating that data is on the
data bus
Cycle 1 Cycle 2 Cycle 3 Cycle 4

CLK

Address
ADDR

RD

Data
DATA
Machine languages
In the earliest days of computers, the only programming
languages available were machine languages. Each
computer had its own machine language, which was
made of streams of 0s and 1s.
The only language understood by a computer is machine
language. (i.e. it’s native to processor)
Impossible for humans to read. Consists of only 0’s and
1’s.
0001001111110000
Reading Machine Language
First nine bits specifies the operation, last 6 (or 7) bits
specifies the arguments:

100000010 01 00101 Load Memory 5 > R1


100000010 10 00101 Load Memory 5 > R2
1010000100 00 01 10 R1 + R2 > R0
100000100 00 00110 Store R0 > Memory 6
1111111111111111

It is very tedious to program in machine language.


Assembly Language
One step up from machine language, To program in
assembly you need to understand concepts behind
machine language and execution-fetch cycle of CPU.
Assembly is a mnemonic form of machine language.
Assembly consists of both binary and simple words.
Machine code composed only of 0’s and 1’s

For example:
Instead of load instruction we might say 0004; thus
load 001000110001 is equal to 0004001000110001
Add might equal to 2005
Advantages Of Assembly Language
Faster as compared to programs written using high-level
languages
Efficient memory usage

Disadvantages of assembly language


Need to know detail hardware implementation
 Not portable
Slow to development and difficult to debug
Assembly Language Model


add r1,r2
PC sub r2,r3
ALU Memory
cmp r3,r4 Registers
sub r4,1

Instruction Format
General Format of Instructions

Label: Opcode Operands ; Comment

 Label: It is optional. It provides a symbolic address that


can be used in branch instructions
 Opcode: It specifies the type of instructions
 Operands: Instructions of 8086 family can have one, two,
or zero operand
 Comments: Only for programmers’ reference
7-
11
Label Instruction Comment
ORG 0 /Pseudo-instruction
LDA A /Machine instruction, symbol reference
ADD B /Machine instruction, symbol reference
STA C /Machine instruction, symbol reference
HLT /Machine instruction
A, DEC 83 /Pseudo-instruction with label field
B, DEC -23 /Pseudo-instruction with label field
C, DEC 0 /Pseudo-instruction with label field
END /Pseudo-instruction
Machine Code Format

Opcode ModeOperand1 Operand2

MOV AL, BL 1000100011000011


Register
MOV
mode
Assembly Language Instructions
Built from two pieces

Add R1, R3,

Opcode Operands
What to do with the Where to get data and
data put the results
(ALU operation)
High-level languages
A high-level language is an advanced computer
programming language that isn't limited by the
computer, designed for a specific job, and is
easier to understand. Today, there are dozens of
high-level languages
Examples:
BASIC, C, FORTRAN JAVA and  PASCAL
Advantages of High-Level Languages
Program development is faster
Program maintenance is easier

You might also like