9 8085 Instruction Set LEC 7

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 98

8085 Instruction Set

Lecture 7

8085 Instruction Set 1


8085 Instruction Set 2
8085 Instruction Set 3
8085 Instruction Set 4
8085 Instruction Set 5
8085 Instruction Set 6
8085 Instruction Set 7
8085 Instruction Set 8
8085 Instruction Set 9
8085 Instruction Set 10
8085 Instruction Set 11
8085 Instruction Set 12
8085 Instruction Set 13
8085 Instruction Set 14
8085 Instruction Set 15
8085 Instruction Set 16
8085 Instruction Set 17
8085 Instruction Set 18
8085 Instruction Set 19
8085 Instruction Set 20
8085 Instruction Set 21
8085 Instruction Set 22
8085 Instruction Set 23
8085 Instruction Set 24
8085 Instruction Set 25
8085 Instruction Set 26
8085 Instruction Set 27
8085 Instruction Set 28
8085 Instruction Set 29
8085 Instruction Set 30
8085 Instruction Set 31
8085 Instruction Set 32
8085 Instruction Set 33
8085 Instruction Set 34
8085 Instruction Set 35
8085 Instruction Set 36
8085 Instruction Set 37
8085 Instruction Set 38
8085 Instruction Set 39
8085 Instruction Set 40
8085 Instruction Set 41
8085 Instruction Set 42
8085 Instruction Set 43
 PSW (Program Status word)
 - Flag unaffected
 * affected
 0 reset
 1 set
 S  Sign (Bit 7)   
 Z  Zero (Bit 6)   
 AC Auxiliary Carry (Bit 4)
 P    Parity (Bit 2)       
 CY  Carry (Bit 0)  

8085 Instruction Set 44


8085 Instruction Set 45
8085 Instruction Set 46
8085 Instruction Set 47
8085 Instruction Set 48
8085 Instruction Set 49
8085 Instruction Set 50
8085 Instruction Set 51
8085 Instruction Set 52
8085 Instruction Set 53
8085 Instruction Set 54
8085 Instruction Set 55
8085 Instruction Set 56
8085 Instruction Set 57
8085 Instruction Set 58
8085 Instruction Set 59
8085 Instruction Set 60
8085 Instruction Set 61
8085 Instruction Set 62
8085 Instruction Set 63
8085 Instruction Set 64
8085 Instruction Set 65
8085 Instruction Set 66
8085 Instruction Set 67
8085 Instruction Set 68
8085 Instruction Set 69
8085 Instruction Set 70
8085 Instruction Set 71
8085 Instruction Set 72
8085 Instruction Set 73
8085 Instruction Set 74
8085 Instruction Set 75
8085 Instruction Set 76
Rx (Return Conditionally)

8085 Instruction Set 77


8085 Instruction Set 78
8085 Instruction Set 79
8085 Instruction Set 80
8085 Instruction Set 81
8085 Instruction Set 82
RIM
SIM and RIM instructions are typically used to either output
to or input from 8085 serial interface, or enable/disable/read
the interrupt masks for interrupts 7.5, 6.5, 5.5, but usually not
at the same time.

8085 Instruction Set 83


In 8085 Instruction set, RIM stands for “Read Interrupt Mask”. It
is a 1-Byte multi-purpose instruction.

It is used for the following purposes –


•To check whether RST7.5, RST6.5, and RST5.5 are masked or not.
•To check whether interrupts are enabled or not.
•To check whether RST7.5, RST6.5, or RST5.5 interrupts are pending or not.
•To read serial data through the SID pin.

8085 Instruction Set 84


8085 Instruction Set 85
Bit D7 (SID-Serial Input Data) This is the input pin of the serial data
interface which is connected to pin 5 of the 8085, and indicates the
high/low status of that pin.

Bits D6-D4 (I 7.5, I 6.5, I 5.5) These bits indicates that an interrupt is
pending for these three 8085 interrupts 7.5, 6.5, and 5.5. If interrupts 5.5
or 6.5 have been masked off by bits D0 or D1, bits D4 and D5 will not be
set. Bit D6, which corresponds to the 7.5 interrupt, will be set on to
indicate that an interrupt 7.5 was requested, even if it was masked off.

Bit D3 (IE-Interrupt Enable) This bit indicates whether interrupts are


enabled (1) using the EI (Enable Interrupts) instruction, or disabled (0)
using the DI (Disable Interrupts) instruction.

Bits D2-D0 (M 7.5, M6.5, M5.5) Mask status of interrupts 7.5, 6.5, and
5.5. Corresponds to bits D2-D0 of the SIM instruction. 1 if masked, 0 if
enabled.

8085 Instruction Set 86


SIM

Set Interrupt Mask (SIM) :


In 8085 Instruction set, SIM stands for “Set Interrupt Mask”. It is 1-Byte instruction
and it is a multi-purpose instruction.
The main uses of SIM instruction are –
Masking/unmasking of RST7.5, RST6.5, and RST5.5
Reset to 0 RST7.5 flip-flop.
Sends data on SOD pin.
8085 Instruction Set 88
D7-D6 - The left two bits are related to the serial interface. When D6 (SDE-Serial Data
Enable) is 1, then whatever is in D7 (SOD-Serial Data Output) is written to the serial data
output (pin 4 of the 8085). If D6=0, nothing is written. This allows a SIM instruction to
be executed altering interrupt masks without affecting serial data.

Bit D5 is not used.

Bit D4 (R 7.5-Reset RST 7.5) This bit allows the SIM instruction to reset the interrupt
pending flag indicated by bit D6 in the RIM instruction layout. The 7.5 interrupt can
indicate that it is pending via the RIM instruction even though it is masked off. This bit
allows that pending request to be reset.

Bit D3 (MSE-Mask Set Enable) is like SDE -- it indicates whether the lower three bits
(D2-D0) are ignored or not. This allows the serial data output to occur without affecting
the interrupt masks. If a SIM is executed with this bit low, the condition of the mask bits
will not change. If a SIM is executed with this bit set high, the mask bits will be set
according to the lower three bits of the accumulator.

Bits D2-D0 (RST 7.5 Mask, RST .5 Mask, RST 5.5 Mask) These are the interrupt masks
for the 8085 interrupts 7.5, 6.5, and 5.5. If the corresponding bit is 0, the interrupt is
enabled. If the bit is 1, the interrupt is masked (ignored).

8085 Instruction Set 89


Summary – Data transfer
 MOV           Move
 MVI           Move Immediate
 LDA           Load Accumulator Directly from Memory
 STA           Store Accumulator Directly in Memory
 LHLD          Load H & L Registers Directly from
Memory
 SHLD          Store H & L Registers Directly in
Memory

8085 Instruction Set 90


Summary Data transfer
 An 'X' in the name of a data transfer instruction implies that it
deals with a register pair (16-bits);

 LXI           Load Register Pair with Immediate data


 LDAX       Load Accumulator from Address in Register Pair
 STAX          Store Accumulator in Address in Register Pair
 XCHG          Exchange H & L with D & E
 XTHL          Exchange Top of Stack with H & L

8085 Instruction Set 91


Summary - Arithmetic Group
 Add, Subtract, Increment / Decrement data in registers or memory.
 
 ADD    Add to Accumulator
 ADI      Add Immediate Data to Accumulator
 ADC    Add to Accumulator Using Carry Flag
 ACI      Add Immediate data to Accumulator Using Carry
 SUB    Subtract from Accumulator
 SUI     Subtract Immediate Data from Accumulator
 SBB    Subtract from Accumulator Using Borrow (Carry) Flag
 SBI     Subtract Immediate from Accumulator
Using Borrow (Carry) Flag
 INR    Increment Specified Byte by One
 DCR    Decrement Specified Byte by One
 INX      Increment Register Pair by One
 DCX    Decrement Register Pair by One
 DAD    Double Register Add; Add Content of Register Pair to H & L
Register Pair
8085 Instruction Set 92
Summary Logical Group
 This group performs logical (Boolean) operations on data in
registers and memory and on condition flags.
  These instructions enable you to set specific bits in the
accumulator ON or OFF.
 
 ANA          Logical AND with Accumulator
 ANI           Logical AND with Accumulator Using Immediate
Data
 ORA          Logical OR with Accumulator
 OR            Logical OR with Accumulator Using Immediate
Data
 XRA          Exclusive Logical OR with Accumulator
 XRI           Exclusive OR Using Immediate Data

8085 Instruction Set 93


 The Compare instructions compare the content of an 8-bit value with the contents of the
accumulator;
             
 CMP         Compare
 CPI           Compare Using Immediate Data

 
 The rotate instructions shift the contents of the accumulator one bit position to the left or
right:
 
 RLC           Rotate Accumulator Left
 RRC          Rotate Accumulator Right
 RAL           Rotate Left Through Carry
 RAR          Rotate Right Through Carry

 
 Complement and carry flag instructions:

 
 CMA          Complement Accumulator
 CMC          Complement Carry Flag
 STC           Set Carry Flag

8085 Instruction Set 94


Summary - Branch Group
 Unconditional branching
 JMP           Jump

 CALL          Call

 RET           Return

 Conditions
 NZ           Not Zero (Z = 0)

 Z             Zero (Z = 1)

 NC           No Carry (C = 0)

 C             Carry (C = 1)

 PO           Parity Odd (P = 0)

 PE           Parity Even (P        = 1)

 P             Plus (S = 0)

 M            Minus (S = 1)

 Conditional branching

8085 Instruction Set 95


Summary - Stack

 PUSH       Push Two bytes of Data onto the Stack


 POP         Pop Two Bytes of Data off the Stack
 XTHL       Exchange Top of Stack with H & L
 SPHL       Move content of H & L to Stack Pointer

8085 Instruction Set 96


I/0 instructions

 IN            Initiate Input Operation


 OUT           Initiate Output Operation

8085 Instruction Set 97


Summary -Machine Control instructions

 EI            Enable Interrupt System


 DI            Disable Interrupt System
 HLT         Halt
 NOP        No Operation

8085 Instruction Set 98

You might also like