You are on page 1of 19

8085Architecture&

8085
Architecture &
ItsAssemblylanguageprogramming
DrASahu
DeptofComputerScience&
Engineering
Engineering
IITGuwahati

Outline
8085EraandFeatures
8085
Blockdiagram(DataPath)
BusStructure
RegisterStructure
g

InstructionSetof8085
Sampleprogramof8085
Sample program of 8085
Simulator&Kitfor8085

8085 Microprocessor
8085Microprocessor

8BitCPU
36Mhz
Simplerdesign:SingleCycleCPU
p
g
g y
ISA=Prex86design(SemiCISC)
40 Pin Dual line Package
40PinDuallinePackage
16bitaddress
6registers:B,C,D,E,H,L
Accumulator8bit

8085MicroprocessorArchitecture
ReSeT6.5
INTR INTA RST5.5 RST7.5 TRAP

SID

InterruptControl

SOD

SerialI/OControl

Bus8Bit
ACC

MUX

tmp R

IR
Flag

ALU

TimingandControl

IIDecode
Decode
&
M/C
Encodin
g

L
SP
PC

Inc/Dec.ter
/
Addlatch

AddBuff

Data/AddBuff

The8085BusStructure
A15

AddressBus(16bit)

A0

Memory

I/P

8085
MPU

D7
D0

O/P

DataBus(8bit)
ControlBus(8bit)

8085BusStructure
AddressBus:
Address Bus : Consistsof16addresslines:A
Consists of 16 address lines: A0 A15
Addresslocations:0000(hex) FFFF(hex)
Canaccess64K(=2
( 16 ))bytesofmemory,
y
y, eachbytehas8bits
y

Canaccess64K 8bitsofmemory
UsememorytomapI/O, Sameinstructionstousefor
accessingI/Odevicesandmemory
/

DataBus:Consistsof8datalines:D0 D7
Operatesinbidirectionalmode
O
t i bidi ti
l
d
ThedatabitsaresentfromtheMPUtoI/O&viceversa
Datarange:00(hex)
Data range: 00 (hex) FF(hex)
FF (hex)

ControlBus:
Consists
Consistsofvariouslinescarryingthecontrol
of various lines carrying the control
signalssuchasread/writeenable,flagbits

8085Registers
Registers:
Sixgeneralpurpose8bitregisters:B,C,D,E,H,L
Combinedasregisterpairstoperform16bit
operations:BC,DE,HL
Registersareprogrammable(load,move,etc.)

StackPointer(SP)
( )
Accumulator&FlagRegister
(Zero,Sign,Carry,Parity,AuxCarry)
(Zero Sign Carry Parity AuxCarry)

L
SP
PC

ProgramCounter(PC)
Containsthememoryaddress(16bits)ofthe
C
i h
dd
(16 bi ) f h
instructionthatwillbeexecutedinthenextstep.

How instruction executed


Howinstructionexecuted
Allinstructions(ofaprogram)arestoredin
memory.
memory
Torunaprogram,theindividualinstructions
must be read from the memory in sequence
mustbereadfromthememoryinsequence,
andexecuted.
Program
Programcounterputsthe16
counter puts the 16bit
bitmemoryaddressofthe
memory address of the
instructionontheaddressbus
ControlunitsendstheMemoryReadEnablesignaltoaccess
the memory
thememory
The8bitinstructionstoredinmemoryisplacedonthedata
busandtransferredtotheinstructiondecoder
Instructionisdecodedandexecuted

Instruction Set of 8085


InstructionSetof8085
ArithmeticOperations
add,sub,inr/dcr

Logicaloperation
and,or,xor,rotate,compare,complement

Branchoperation
ranch operation
Jump,call,return

Datatransfer/Copy/Memoryoperation/IO
Data transfer/Copy/Memory operation/IO
MOV,MVI,LD,ST,OUT

Copy/Mem/IOoperation

MVIR,8bit//loadimmediatedata
MOVR1,R2
,
//ExampleMOVB,A
//
p
,
MOVRM//CopytoRfrom0(HLReg)Mem
MOVMR//CopyfromRto0(HLReg)Mem

LDA16bit//loadAfrom0(16bit)
STA 16 bit //StoreAto0(16bit)
STA16bit
// Store A to 0(16bit)
LDAXRp
//loadAfrom0(Rp),Rp=RegPair
STAXRp
//StoreAto0(Rp)
LXIRp 16bit//loadimmediatetoRp

IN8bit//
IN 8bit
// AcceptdatatoAfromport0(8bit)
A
td t t Af
t 0(8bit)
OUT8bit//SenddataofAtoport0(8bit)

ArithmeticOperation
ADDR
//
//AddA=A+B.reg
ADI8bit//AddA=A+8bit
ADDM
ADD M
// Add A=A + 0(HL)
//AddA=A+0(HL)
SUBR
//SubA=AB.reg
SUI8bit//SubA=A 8bit
SUBM//SubA=A 0(HL)

INRR//R=R+1
INRM
INR
M
//0(HL)=0(HL)+1
//
0(H ) 0(H )
DCRR//R=R1
DCRM//0(HL)=0(HL)1
INXRp
//Rp=Rp+1
DCXRp
//Rp=Rp1

Other Operations
OtherOperations
Logicoperations

ANARANI8bitANAM
ANA
R
ANI 8bit ANA M
ORA,ORI,XRA,XRI
CMPR//comparewithRwithACC
//
p
CPI8bit//compare8bitwithACC

Branchoperations
JMP16bit,CALL16bit
JZ16bit,JNZ16bit,JC16bit,JNC16bit
RET

MachineControloperations
HLT,NOP,POP,PUSH
HLT NOP POP PUSH

Assumption
RAM
RAMMemoryisinterfaced
Memory is interfaced
Instructionsarestoredinmemory
OneI/Odisplayportisinterfacedtodisplay
O
/O di l
i i
f d di l
dataofACC

Simple Assembly Program


SimpleAssemblyProgram
MVIA,24H//loadReg ACCwith24H
MVIB,56H//loadReg Bwith56H
ADDB//ACC=ACC+B
OUT01H//DisplayACCcontentsonport01H
HALT//Endtheprogram
//
p g

Result:7A(AllareinHex)
DAA operation for Decimal Adjust A+6=10H
DAAoperationforDecimalAdjustA+6=10H

Flowchart to multiply two number


Flowcharttomultiplytwonumber
Start
LDA2000//Loadmultiplicant
LDA
2000 // Load multiplicant toaccumulator
to accumulator
MOVB,A//Movemultiplicant fromA(acc)toBregister
LDA2001//Loadmultipliertoaccumulator
MOVC,A//MovemultiplierfromAtoC
MOVC,A//MovemultiplierfromAtoC
MVI A 00 // Load immediate value 00 to ACC
MVIA,00//Loadimmediatevalue00toACC
ADDB//AddB(multiplier)withA
DCRC//DecrementC,itactasacounter

JNZL//JumptoLifC!=0
STA2010//Storeresultintomemory
HLT//End

Code to multiply two number


Codetomultiplytwonumber
LDA2000//Loadmultiplicant toaccumulator
MOV B A
MOVB,A//Movemultiplicant
// M
l i li
f
fromA(acc)toBregister
A( ) B
i
LDA2001//Loadmultipliertoaccumulator
MOV C A // Move multiplier from A to C
MOVC,A//MovemultiplierfromAtoC
MVIA,00//Loadimmediatevalue00toa
L:ADDB//AddB(multiplier)withA
//
(
p )
DCRC//DecrementC,itactasacounter
JNZL//JumptoLifCreaches0
STA2010//Storeresultintomemory
HLT//End

Factorial of a Program
FactorialofaProgram

LAST:
END:

LXISP,27FFH;Initializestackpointer
LDA2200H;Getthenumber
CPI 02H ; Check if number is greater than 1
CPI02H;Checkifnumberisgreaterthan1
JCLAST
MVID,00H;Loadnumberasaresult
MOV E A
MOVE,A
DCRA
MOVC,A;Loadcounteronelessthannumber
CALLFACTO;CallsubroutineFACTO
;
XCHG;GettheresultinHL//HLwithDE
SHLD2201H;Storeresultinthememory//storeHLat0(16bit)
JMPEND
LXIH,000lH;Storeresult=01
SHLD2201H
HLT

Sub Routine for FACTORIAL


SubRoutineforFACTORIAL
FACTO:
BACK:

LXIH,0000H
,
MOVB,C;Loadcounter
DADD//doubleadd;HL=HL+DE
DCRB
JNZBACK;Multiplybysuccessiveaddition
XCHG;StoreresultinDE//HLwithDE
DCRC;Decrementcounter
CNZ FACTO C ll b
CNZFACTO;CallsubroutineFACTO
i FACTO
RET;Returntomainprogram

8085 Simulator & Kit


8085Simulator&Kit
8085Simulatorisavailable
Coursewebsite

8085KitisavailableinHWLab(CS422)
FirsttesttheprogramonSimulatorandthengo
fortheHW
SometimeKithaveDriver,IDEandAssembler

You might also like