You are on page 1of 19

8085Architecture& 8085 Architecture & ItsAssemblylanguageprogramming

DrASahu DeptofComputerScience& Engineering Engineering IITGuwahati

Outline
8085EraandFeatures 8085
Blockdiagram(DataPath) BusStructure RegisterStructure g

InstructionSetof8085 Sample program of 8085 Sampleprogramof8085 Simulator&Kitfor8085

8085Microprocessor 8085 Microprocessor


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

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

InterruptControl Bus8Bit ACC tmp R Flag IDecode I Decode & M/C Encodin g

SerialI/OControl

MUX IR W B D H SP PC
Inc/Dec.ter / Addlatch

Z C E L

ALU

TimingandControl

AddBuff

Data/AddBuff

The8085BusStructure
A15 A0 AddressBus(16bit)

Memory 8085 MPU

I/P O/P

D7 D0

DataBus(8bit) ControlBus(8bit)

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

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

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

ControlBus:
Consists of various lines carrying the control Consistsofvariouslinescarryingthecontrol 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)

B D H SP PC

C E L

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

Howinstructionexecuted How instruction executed


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

InstructionSetof8085 Instruction Set of 8085


ArithmeticOperations
add,sub,inr/dcr

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

Branchoperation ranch operation


Jump,call,return

Data transfer/Copy/Memory operation/IO Datatransfer/Copy/Memoryoperation/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) STA16bit//StoreAto0(16bit) STA 16 bit // Store A to 0(16bit) LDAXRp //loadAfrom0(Rp),Rp=RegPair STAXRp //StoreAto0(Rp) LXIRp 16bit//loadimmediatetoRp

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

ArithmeticOperation
ADDR //AddA=A+B.reg // ADI8bit//AddA=A+8bit ADD M ADDM// 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 INR M INRM//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

OtherOperations Other Operations


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 Memory is interfaced RAMMemoryisinterfaced Instructionsarestoredinmemory O OneI/Odisplayportisinterfacedtodisplay /O di l i i f d di l dataofACC

SimpleAssemblyProgram Simple Assembly Program


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

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

Flowcharttomultiplytwonumber Flowchart to multiply two number


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

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

Codetomultiplytwonumber Code to multiply two number


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

FactorialofaProgram Factorial of a Program


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

LAST: END:

SubRoutineforFACTORIAL Sub Routine for FACTORIAL


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

8085Simulator&Kit 8085 Simulator & Kit


8085Simulatorisavailable
Coursewebsite

8085KitisavailableinHWLab(CS422)
FirsttesttheprogramonSimulatorandthengo fortheHW SometimeKithaveDriver,IDEandAssembler

You might also like