Block Diagram of A Computer

You might also like

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

Digital Computer

Multipurpose , programmable machine that reads binary instruction from


memory, accepts binary data as input and process the instructions according to those
instructions and provide the result.

Block Diagram of a computer

ALU

Input Control Unit Output

Memory
Block diagram of a Microcomputer
Input Output

Processing
m Bus
System Bus
Element

ROM RAM
Programming Languages
• Machine Language
• Assembly Language
• High Level Programming Languages
Single Board Microcomputer - µprocessor Kits
- µprocessor
- RAM 256 Bytes to 2K bytes
- 2Kbytes ROM
- Hex Keyboard

Single chip computer – Microcontroller


Contains µprocessor , RAM, ROM in a single chip
8085 Microprocessor
• 8 Bit Microcprocessor
• 8 Data Lines
• 16 Address Lines
• Clock generator output is divided by 2
• =3 MHz
• Address and data lines are multiplexed
8085 Architecture
Control Singals

• Address Latch Enable


• Read / Write
• Reset in / Reset out
• Hold
• Hold Acknowledge
Status Lines
IO/ S1 S0 States

0 0 1 Memory write

0 1 0 Memory read

1 0 1 I/O write

1 1 0 I/O read

0 1 1 Opcode fetch

Difference between opcode fetch and memory Read

For every reading of data from the memory, for an instruction , the reading of
first byte of the instruction is treated as opcode fetch. It takes 4 T States. Where
1 T = one clock pulse.
Reading of the subsequent bytes from the memory is called memory read. It
takes 3 T states.
For eg., If an instruction requires 3 bytes to complete an operation then to read
the first byte from the memory is called opcode fetch.
Flags

S – Sign Flag (Result of the D7 th bit)


Z – Zero Flag(when the Result is zero)
AC – Auxilary Carry Flag (Carry from D3 bit)
P – Parity Flag(maintains Odd number of ones )
CY – Carry Flag(Carry from D7th bit)
Pin Diagram - 8085
Instructions Set of 8085
• Addressing mode specifies the way in which the datum
is present. The datum may be present as part of the
instruction / in the internal registers or in the memory.
• For eg.,
– MVI A,07H
– XOR A
– MOV A,M
• Instructions are either classified based on the
operation it performs, or the number of bytes it
occupies in the memory.
Instructions – Grouping
• Data Transfer Instructions
• Arithmetic / Logical Instructions
• Machine Control Instructions
• Branch Instructions
Data Transfer Instructions (does not affect any flags)
MOV r1(destination),r2(source) r1 and r2 may be any one of the
general purpose reg. / M register
r1 = r2
MVI r, #8 bit value r may be any one of the general purpose reg. / M register
r = #immediate value
LXI rp, #16 bit value rp may be BC,DE,HL,SP
Data Transfer Instructions
Address Data
• Eg., 4100H 0EH
• MVI C,55H C=55 4101H 55H
• LXI H,3341H H = 33H 4102H 21H
L = 41H 4103H 41H
4104 33H

Little Endian - The least significant byte of the data is placed at the lowest address.

LDA #16 Bit Address, STA #16bit Address

LDA 4500H Address Data


4500H AEH
A=?
A = AEH
MVI A,26H
STA 4800H
4800H = ?
Data Transfer Instructions
LHLD #16 Bit Address, SHLD #16bit Address
Address Data
4400H 10H
LHLD 4400H LXI H,4504H 4401H 51H
L = 10H L = 04H
H=51H H=45H
SHLD 4800
Address Data
4800H 04H
4801H 45H

LDAX rp, STAX rp rp should be BC and DE only

LXI B,4644H Address Data


MVI A,65H 4644H 65H
STAX B

XCHG HLDE only


Arithmetic Instructions(Affects the flags)
Increment and Decrement Instructions
• INR r r = r +1
(Affects all the flags except Carry Flag)
• DCR r r = r-1
• INX rp rp = rp + 1
(Affects No flags)
• DCX rp rp = rp - 1
Add r – r may be any one of the general purpose register (A,B,C,D,E,H,L or M)
• A=A+r
ADI #8 bit value – Add Immediate
A = A + # 8bit Value
ADC r – Add with carry. r may be any one of the general purpose register (A,B,C,D,E,H,L or M)
• A=A+r+1
ACI #8 bit value – Add Immediate with carry
DAD rp Add 16 value rp may be HL,BC or DE
A = A + # 8bit Value + CF HL = HL + rp (Affects CF only)

Sub r – r may be any one of the general purpose register (A,B,C,D,E,H,L or M)


• A=A-r
SUI #8 bit value – Subtract Immediate
A = A - # 8bit Value
SBB r – Subtract with carry. r may be any one of the general purpose register (A,B,C,D,E,H,L or M)
• A=A-r-1
SBI #8 bit value – Subtract Immediate with carry
A = A - # 8bit Value + CF
Arithmetic …

DAA – Decimal Adjust Accumulator After Addition


MVI B, 05H
MVI C,06H A=? A = 0BH
ADD C

MVI B, 05H
MVI C,06H
ADD C
DAA A = 11H

Logical Group ( Affects all the flags)


CMP r compare with r
ANA r AND with r If A < r then CF = 1
ANI # 8 bit value AND with immediate value If A == r then ZF = 1
XRA r XOR with r CPI # data compare with imm. value
XRI #8 bit value XOR with immediate value
ORA r OR with r
ORI # immediate value OR with immediate value
CMA complement accumulator
STC – Set Carry
CMC – Complement Carry
Logical Instr.. Rotate Instructions
RLC – Rotate Acc left by one bit

RRC – Rotate Acc right by one bit


Rotate Instructions ….

RAL – Rotate Acc left by one bit through carry

RAR – Rotate Acc Right by one bit through carry


Branching Operations
Transfers the control of microprocessor from
one location to another location. Conditional
transfer or unconditional transfer
• JMP-Jump within a program.
• CALL-Jump from main program to sub-routine.
• RET-Jump from sub-routine to main program.
• RST-Jump from main program to instruction
sub routine.
Conditional Jump Instructions
ALP - 8085
• Write an ALP to check (8020H) is greater than
81H. If so decrement (8020H) by 1 else
increment the location content by one.
• Write an ALP to add two 16bit data stored in the
location 2200H & 2201H and 2300H & 2301 and
store the result in the consecutive location.
• Write an ALP to multiply two hexadecimal
numbers.
ALP - 8085
• Write an ALP to add two BCD number stored
in the location 2200H & 2201H and store the
result in the consecutive location.

• Write an ALP to add two BCD number of size 4digit


number stored in the location 4200H & 4201H and 4300H
& 4301 and store the result in the consecutive location.

You might also like