SIM and RIM instructions

In the Intel 8085 microprocessor, the SIM (Set Interrupt Mask) and RIM (Read Interrupt Mask) instructions play an important role in controlling the interrupt system. Here is a detailed description of both instructions:

SIM — Set Interrupt Mask

Function:


The SIM instruction is used to control the interrupt system of the 8085 microprocessor. It can perform several interrupt-related functions, including masking and unmasking specific interrupts, setting the serial output data bit, and enabling or disabling the RST 7.5 interrupt flip-flop.

Instruction format and operation:


The SIM instruction is 8 bits long. When the SIM instruction is executed, the contents of the accumulator are used to control various aspects of the interrupt system.

Interrupt masking:


Bits 0-2 of the accumulator are used to mask or unmask the RST 5.5, RST 6.5 and RST 7.5 interrupts respectively. If a bit is set (1), the corresponding interrupt is masked (disabled); if it is reset (0), the interrupt is unmasked (enabled).

Serial output data:


Bit 3 of the accumulator is used to set the serial output data (SOD) bit. This bit can be used for serial communication.

RST 7.5 interrupt flip-flop control:


Bit 4 is used to clear the RST 7.5 interrupt flip-flop. If bit 4 is set to 1, the RST 7.5 interrupt flip-flop is reset, which effectively acknowledges the RST 7.5 interrupt.

INTR interrupt masking:


Bit 6 is used to mask the INTR interrupt. Setting bit 6 to 1 masks the INTR interrupt, and resetting it allows the INTR interrupt to be recognized.

Global interrupt enable/disable:


Bit 7 is used to set or reset the interrupt enable flag (IFF). Setting bit 7 to 1 enables all maskable interrupts, and clearing it disables them.

RIM — Read Interrupt Mask

Function:


The RIM instruction is used to read the state of the interrupt system. It allows the programmer to obtain information about the interrupt mask bits, the state of the RST 7.5 interrupt flip-flop, the serial input data bit and the state of a pending interrupt.

Instruction format and operation:


When the RIM instruction is executed, the 8085 microprocessor reads the relevant status information from the interrupt control logic and places it in the accumulator.

Pending interrupt status:


Bits 0-2 of the accumulator indicate whether the RST 5.5, RST 6.5 and RST 7.5 interrupts are pending. A set bit (1) indicates that the corresponding interrupt is pending.

State of the RST 7.5 interrupt flip-flop:


Bit 3 shows the state of the RST 7.5 interrupt flip-flop. If the bit is set (1), it means that the flip-flop is set.

Serial input data:


Bit 4 contains the serial input data (SID) bit.

Interrupt mask bits:


Bits 5 to 7 are the interrupt mask bits for RST 5.5, RST 6.5 and RST 7.5 respectively. A set bit (1) indicates that the corresponding interrupt is masked.