Professional Documents
Culture Documents
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.
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
Result:7A(AllareinHex)
DAA operation for Decimal Adjust A+6=10H
DAAoperationforDecimalAdjustA+6=10H
JNZL//JumptoLifC!=0
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
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
8085KitisavailableinHWLab(CS422)
FirsttesttheprogramonSimulatorandthengo
fortheHW
SometimeKithaveDriver,IDEandAssembler