An interrupt is a signal to the processor, generated by hardware or software indicating an immediate attention needed by an event. In this article, we will learn about software interrupts.
There is eight software interrupts in 8085 Microprocessor starting from RST 0 to RST 7. They allow the microprocessor to transfer program control from the main program to the subroutine program. After completing the subroutine program, the program control returns back to the main program.
The vector addresses of software interrupts are given in the table below.
|RST 0||C7 H||0000 H|
|RST 1||CF H||0008 H|
|RST 2||D7 H||0010 H|
|RST 3||DF H||0018 H|
|RST 4||E7 H||0020 H|
|RST 5||EF H||0028 H|
|RST 6||F7 H||0030 H|
|RST 7||FF H||0038 H|
To find the opcode of RST 1, you need to add 8 to the opcode for RST 0. Similarly, To find the opcode of RST 2, you need to add 8 to the opcode for RST 1. In the similar fashion, you can find rest of the opcodes. For example
opcode of RST 1 = (opcode of RST 0 + 8 ) = (C7 H + 8) = CF H
opcode of RST 2 = (opcode of RST 1 + 8 ) = (CF H + 8) =D7 H
opcode of RST 3 = (opcode of RST 2 + 8 ) = (D7 H + 8) =DF H
To find the vectored address of RST n, you need to multiply n by 8. The corresponding product is in decimal form. By converting it into hexadecimal, you get the vectored address of the corresponding RST n. For example
Here, n = 0
Now, n x 8 = 0 x 8 = 0 = 0000 H
Here, n = 1
Now, n x 8 = 1 x 8 = 8 = 0008 H
Here, n = 2
Now, n x 8 = 2 x 8 = 16 = 0010 H
Working of software interrupt
The software interrupt instructions are included at the appropriate (or required) place in the main program. When the processor encounters the software instruction, it pushes the content of PC (Program Counter) to stack. Then loads the Vector address in PC and starts executing the Interrupt Service Routine (ISR) stored in this vector address. At the end of ISR, a return instruction – RET will be placed. When the RET instruction is executed, the processor POP the content of stack to PC. Hence the processor control returns to the main program after servicing the interrupt. Execution of ISR is referred to as servicing of the interrupt.
- To store software interrupts, you need to store the corresponding opcode. For example: To store RST 4, you need to store E7 H.
- RST instructions are 1 Byte instructions.
- RST instructions are similar to CALL because it pushes the next line address to stack. Then ISR ( interrupt service routine) number to Program counter.
- All software interrupts of 8085 microprocessors are vectored interrupts.
- The software interrupts cannot be masked and they cannot be disabled.