8085 Part IV
8085 Part IV
• XTHL
Exchange the content of H-L pair with top of the Stack
H A2 57 L H 67 38 L
8097 38 8097 8097 57 8097
SP SP
67 8098 A2 8098
Subroutines
Subroutines
o A subroutine is a group of
instructions that will be
used repeatedly in different
locations of the program.
oHowever, it is customary to
place subroutines separately from
the main program.
Subroutines
RET
Conditional CALL
Instruction
• CP <16-Bit Address> call when s = 0
• CM <16-Bit Address> call when s = 1
Priority Decreasing
The 8085 Non-Vectored Interrupt
Process
1. The interrupt process should be enabled using the ‘EI’ instruction.
2. The 8085 checks for an interrupt during the execution of every instruction.
3. If INTR is high, μp completes current instruction, disables the interrupt
and sends INTA (Interrupt acknowledge) signal to the device that
4. interrupted
INTA allows the I/O device to send a RST instruction through data
Upon receiving the RST instruction, μp saves the memory location of
bus. 5.
the next instruction on the stack and the program is transferred to ‘ISR’
location (ISR Call) specified by the RST instruction
6. Microprocessor Performs the ISR.
7. ISR must include the ‘EI’ instruction to enable the further interrupt
within the program.
8. RET instruction at the end of the ISR allows the μp to retrieve the
return address from the stack and the program is transferred back to
where the program was interrupted.
RST (Restart) Instructions
RST0 C7 0000H
RST5.5 Mask
Serial Data Out
RST6.5 Mask
RST7.5 Mask } 0-
Available
1 - Masked
M 7.5
RST 6.5
M 6.5
RST 5.5
M 5.5
INTR
Interrupt
Enable
Flip Flop
Modify the Interrupt Masks Using the SIM Instruction
Content of accumulator is = 0 0 0 0 1 0 1 0 = 0A H
RST5.5 Mask
Serial Data In RST6.5 Mask
RST7.5 Mask
} 0-
Available
1 - Masked
RST5.5 Interrupt
Pending RST6.5
Interrupt Enable
Interrupt Pending
Value of the Interrupt
RST7.5 Interrupt Enable Flip Flop
Pending
The 8085 Non-Maskable
• Interrupts
TRAP is the only non-maskable interrupt.
– It does not need to be enabled because it cannot
be disabled.
• It has the highest priority amongst interrupts.
• The ISR address for TRAP is 0024H
• It is edge and level sensitive.
– It needs to be high and stay high to be recognized.
– Once it is recognized, it won’t be recognized again until
it goes low, then high again.