-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdespatch.a
More file actions
41 lines (33 loc) · 1.4 KB
/
despatch.a
File metadata and controls
41 lines (33 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
; despatch.a - interrupt despatcher for 6809
include "via6522.i"
include "globals.i"
include "panic.i"
ORG $0000 ; This is a relocatable module.
EXEC init_despatcher
; 6522 VIA interrupt despatcher.
intdespatch: ; 6809 IRQ entry point.
begin
ldx #g_unknownvec ; Default to "unknown" vector.
lda ifr ; Read interrupt flag register.
sbpl out ; Branch if no interrupts pending.
anda ier ; Mask with interrupt enable register.
ora #$80 ; Set last bit to ensure default vec.
loop: leax -2,x ; Loop through vectors
asra ; testing each interrupt bit, LSB first.
sbcc loop ; Loop unless the bit was set.
out: jmp [,x] ; Jump to the selected interrupt vector.
end
default_isr:
begin
PANIC "Unhandled interrupt"
end
; Initialisation routine to set up the interrupt despatcher.
init_despatcher:
begin
; ToDo: set up default ISRs for each vector.
leax default_isr,pcr ; Copy the current IRQ vector
stx g_unknownvec ; to the "unknown" vector.
leax intdespatch,pcr ; Put the address of the despatcher
stx g_irqvec ; into the IRQ vector.
rts ; Done, return to the loader.
end