Interrupt handlers





The file 68K\INT68K.FTH contains generic ARM interrupt handlers in the v6.2 style.

The file 68K\TRAPS.FTH may be compiled after this file. TRAPS.FTH provides diagnostic information and other code such as divide by zero handling.




Interrupt management

code SETI       \ x -- ; set interrupt level x

Global set interrupts to level n, where x=$0n00.

: ei            \ -- ; Enable interrupts

Global enable interrupts to level 0.

: di            \ -- ; Disable interrupts

Global disable interrupts to level 7.

code SAVE-INT   \ -- x ; save interrupt status

Geturn interrupt status and then disable interrupts. Use [I and I] for new code.

code RESTORE-INT        \ x -- ; restore interrupt

Restore state returned by SAVE-INT. Use [I and I] for new code.

code [I         \ R: -- x ; save SR on return stack and disable interrupts

Preserve I/F status on return stack, disable interrupts. The state is restored by I].

code I]         \ R: -- x ; restore SR from return stack

Restore interrupt status saved by [I from the return stack.




Interrupt service routines

Each predefined ISR has four components:

  • A DEFERred word into which you ASSIGN the required action.
  • A code fragment which references the DEFERred word and RETI.
  • An assembler entry point.
  • A vector assignment
    code RETI       \ --

    Return from high level interrupt.

    defer BUSERR-ISR        \ --

    The deferred word for a bus errot

    l: buserr-int

    The code fragment which references BUSERR-ISR.

    proc buserr-int0

    The assembly level entry point for the bus error handler.

    The predefined DEFERred words are:

    
    BUSERR-ISR ADDRERR-ISR ILLOP-ISR DIVZERO-ISR
    CHKINST-ISR TRAPVINST-ISR PRIVVIOL-ISR TRACE-ISR
    OPCODE1010-ISR OPCODE1111-ISR PHANTOM-ISR
    AVECn-ISR where n=1..7

    All these words have their associated other three components.