Skip to content

Interrupts

FanisD edited this page Jun 26, 2022 · 2 revisions

Enabling interrupts

Using EI and SIM, you can enable and unmask the interrupts you need in your program. More info

Before an interrupt is fired, all interrupts are disabled. This means that during an interrupt, there can't be another one. You have to manually re-enable them using EI

RSTxx

All interrupts have a define in their appropriate memory location for your convenience.

RST45 EQU 0024H
RST55 EQU 002CH
RST65 EQU 0034H
RST75 EQU 003CH

In order to use them, you must first Enable interrupts

Then, if you, for example, want to use RST5.5:

ORG RST55
    JMP MY_LABEL

ORG CODE

; Program code

MY_LABEL:
    ; interrupt handler
    RET ; Don't forget to RET!

INTR

INTR interrupt does not have a predefined memory location.

So, INTR code must go inside a subroutine named INTR_ROUTINE

For example:

ORG CODE

EI

; Program code

INTR_ROUTINE:
    ; INTR handler
    RET ; Don't forget to RET!
Clone this wiki locally