MicroprocessorLecture_2_eightbit_microprocessor.ppt

BijitKumarDas 4 views 23 slides Jun 25, 2024
Slide 1
Slide 1 of 23
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23

About This Presentation

8085 8 bit micrpprocessor


Slide Content

Rakesh Biswas, PhD
IIIT Guwahati

6/25/2024 2

–Since the 8085 is an 8-bit device it can have up to2
8
(256)combinations.
•However, the 8085 only uses 246 combinations that represent a
total of 74 instructions.
–Most of the instructions have more than one format.
–These instructions can be grouped into five different
groups:
•Data Transfer Operations
•Arithmetic Operations
•Logic Operations
•Branch Operations
•Machine Control Operations
6/25/2024 3

•Each instruction has two parts.
–The first part is the task or operation to be
performed.
•This part is called the “opcode” (operationcode).
–The second part is the data to be operated on
•Called the “operand”.
6/25/2024 4

–These operations simplyCOPYthe data from the
source to the destination.
–MOV, MVI, LDA, and STA
–They transfer:
•Data between registers.
•Data Byte to a register or memory location.
•Data between a memory location and a register.
•Data between an I\O Device and the accumulator.
–The data in the source isnotchanged.
6/25/2024 5

•The8085providesaninstructiontoplacethe16-
bitdataintotheregisterpairinonestep.
•LXIRp,<16-bitaddress>(LoadeXtendedImmediate)
–TheinstructionLXIB4000Hwillplacethe16-bit
number4000intotheregisterpairB,C.
•Theuppertwodigitsareplacedinthe1
stregisterofthepair
andthelowertwodigitsinthe2
nd.
40 00
LXIB 4000H B C
6/25/2024 6

•Mostoftheinstructionsofthe8085canusea
memorylocationinplaceofaregister.
–Thememorylocationwillbecomethe“memory”registerM.
•MOVMB
–copythedatafromregisterBintoamemorylocation.
–Whichmemorylocation?
•Thememorylocationisidentifiedbythecontentsof
theHLregisterpair.
–The16-bitcontentsoftheHLregisterpairaretreatedasa
16-bitaddressandusedtoidentifythememorylocation.
6/25/2024 7

–Addition (ADD, ADI):
–Any 8-bit number.
–The contents of a register.
–The contents of a memory location.
•Can be added to the contents of the accumulator and the result is stored
in the accumulator.
–Subtraction (SUB, SUI):
–Any 8-bit number
–The contents of a register
–The contents of a memory location
•Can be subtractedfromthe contents of the accumulator. The result is
stored in the accumulator.
6/25/2024 8

•These instructions perform an arithmetic operation using
the contents of a memory location while they are still in
memory.
–ADDM
•Add the contents of M to the Accumulator
–SUBM
•Sub the contents of M from the Accumulator
–INRM / DCR M
•Increment/decrement the contents of the memory location in place.
–All of these use the contents of the HL register pair to identify the
memory location being used.
6/25/2024 9

–Increment(INR) and Decrement (DCR):
•The 8-bit contents of any memory location or any
register can be directly incremented or decremented
by 1.
•No need to disturb the contents of the accumulator.
6/25/2024 10

•These instructions perform logic operations on the
contents of the accumulator.
–ANA, ANI, ORA, ORI, XRA and XRI
•Source: Accumulator and
–An 8-bit number
–The contents of a register
–The contents of a memory location
•Destination: Accumulator
ANA
ANI
R/M
#
ANDAccumulatorWithReg/Mem
ANDAccumulatorWithan8-bitnumber
ORAR/M ORAccumulatorWithReg/Mem
ORI# ORAccumulatorWithan8-bitnumber
XRAR/M XORAccumulatorWithReg/Mem
XRI # XORAccumulatorWithan8-bitnumber
6/25/2024 11

–Complement:
•1’s complement of the contents of theaccumulator.
CMA Nooperand
6/25/2024 12

•Compare
•Compare the contents of a register or memory location with the
contents of the accumulator.
–CMP R/M Compare the contents of the register
or memory location to the contents of
the accumulator.
–CPI # Compare the 8-bit number to the
contents of the accumulator.
•The compare instruction sets the flags (Z, Cy, and S).
•The compare is done using an internal subtraction that does not
change the contents of the accumulator.
A –(R / M / #)
6/25/2024 13

•Twotypes:
–Unconditionalbranch.
•Go to a new location no matterwhat.
–Conditionalbranch.
•Go to a new location if the condition istrue.
6/25/2024 14

–JMP Address
•Jump to the address specified (Goto).
–CALLAddress
•Jump to the address specified but treat it as asubroutine.
–RET
•Return from asubroutine.
–The addresses supplied to all branch operations must be
16-bits.
6/25/2024 15

–Go to new location if a specified condition ismet.
•JZAddress (Jump onZero)
–Go to address specified if the Zero flag isset.
•JNZAddress (Jump on NOTZero)
–Go to address specified if the Zero flag is notset.
•JCAddress (Jump onCarry)
–Go to the address specified if the Carry flag isset.
•JNCAddress (Jump on NoCarry)
–Go to the address specified if the Carry flag is notset.
•JPAddress (Jump onPlus)
–Go to the address specified if the Sign flag is notset
•JMAddress (Jump onMinus)
–Go to the address specified if the Sign flag isset.
6/25/2024 16

–HLT
•Stop executing the program.
–NOP
•No operation
•Exactly as it says, do nothing.
•Usually used for delay or to replace instructions
during debugging.
6/25/2024 17

•Therearedifferentwaysforspecifyingthe
operand:
–Theremaynotbeanoperand(impliedoperand)
•CMA
–Theoperandmaybean8-bitnumber(immediatedata)
•ADI4FH
–Theoperandmaybeaninternalregister(register)
•SUBB
–Theoperandmaybea16-bitaddress(memoryaddress)
•LDA4000H
6/25/2024 18

•Dependingontheoperandtype,theinstruction
mayhavedifferentsizes.Itwilloccupyadifferent
numberofmemorybytes.
–Typically,allinstructionsoccupyonebyteonly.
–Theexceptionisanyinstructionthatcontains
immediatedataoramemoryaddress.
•Instructionsthatincludeimmediatedatausetwobytes.
–Onefortheopcodeandtheotherforthe8-bitdata.
•Instructionsthatincludeamemoryaddressoccupythreebytes.
–Onefortheopcode,andtheothertwoforthe16-bitaddress.
6/25/2024 19

•Operation: Load an 8-bit number into the
accumulator.
–MVIA, 32
•Operation: MVIA
•Operand: The number 32
•Binary Code:
001111103E1
stbyte.
0011001032 2
nd
byte.
6/25/2024 20

•Operation: go to address2085.
–Instruction: JMP2085
•Opcode:JMP
•Operand:2085
•Binarycode:
11000011C31
st
byte.
1000 0101852
nd byte
0010 0000203
rd byte
6/25/2024 21

•Themicroprocessorhasdifferentwaysof
specifyingthedatafortheinstruction.Theseare
called“addressingmodes”.
•The8085hasfouraddressingmodes:
–Implied
–Immediate
–Register
–Direct
–Indirect
CMA
MVI B, 45
ADD B
LDA 4000
LDAX B
•Load the accumulator with the contents of the memory location
whose address is stored in the register pair BC.
6/25/2024 22

ProblemStatement:Amicrocomputerisdesignedtocontrol
variousapplicationsandlightsinyourhouse.Thesystemhas
anoutputportwiththeaddress01H,andvariousunitsare
connectedtothebitsD
7toD
0.Onacoolmorningyouwantto
turnontheradio,thecoffeepot,andspaceheater.Write
appropriateinstructionsforthemicrocomputer.AssumeR/W
memoryinyoursystembeginsat2000H.
6/25/2024 23
Tags