Skip to content

Commit 92249f9

Browse files
Can't actually do that Mateo
1 parent 6cfca28 commit 92249f9

File tree

1 file changed

+142
-0
lines changed

1 file changed

+142
-0
lines changed

src/ce/interrupts.src

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
.def _int_Initialize
2+
.def _int_Handler
3+
.def _int_SetVector
4+
.def _int_Reset
5+
.assume adl=1
6+
7+
;-------------------------------------------------------------------------------
8+
; Interrupts equates
9+
mpIntStatus equ 0F00000h
10+
mpIntMask equ 0F00004h
11+
mpIntAck equ 0F00008h
12+
mpIntLachEnable equ 0F0000Ch
13+
mpIntXor equ 0F00010h
14+
mpIntStatusMasked equ 0F00014h
15+
16+
intOnKey equ 1
17+
intTimer1 equ 2
18+
intTimer2 equ 4
19+
intTimer3 equ 8
20+
intOsTimer equ 10h
21+
intKbd equ 400h
22+
intLcd equ 800h
23+
intRtc equ 1000h
24+
25+
;-------------------------------------------------------------------------------
26+
_int_Initialize:
27+
di
28+
ld de,lconf
29+
ld hl,mpIntMask
30+
ld bc,16
31+
ldir
32+
ld hl,cconf
33+
ld de,mpIntMask
34+
ld bc,16
35+
ldir
36+
ld hl,0D18879h
37+
ld de,0C90611h
38+
ld (hl),de
39+
dec hl
40+
ld (hl),0EDh
41+
push hl
42+
inc d
43+
call 0D18878h
44+
ld hl, 0E10010h | ((_int_Handler >> 8) & 000FF00h)
45+
ld de, 0C3h | ((_int_Handler << 8) & 0FFFF00h)
46+
ld (hl),h
47+
inc hl
48+
ld (hl),de
49+
ld hl,0E30800h
50+
ld bc,0401h
51+
ld a,0E1h
52+
call 00210E0h ; _Memset
53+
ld hl,0E308h
54+
ld i,hl
55+
im 2
56+
ld d,3
57+
ret
58+
59+
_int_Handler:
60+
ex af,af'
61+
exx
62+
ld hl,(mpIntStatusMasked)
63+
add hl,hl
64+
inc hl
65+
add hl,hl
66+
xor a,a
67+
isr_loop:
68+
inc a
69+
add hl,hl
70+
jr nc,isr_loop
71+
identified:
72+
dec a
73+
add a,a
74+
add a,a
75+
ld (isr_dispatch_smc+1),a
76+
exx
77+
ex af, af'
78+
isr_dispatch_smc:
79+
jr $+2
80+
iv_list:
81+
jp unhandledInt
82+
jp unhandledInt
83+
jp unhandledInt
84+
jp unhandledInt
85+
jp unhandledInt
86+
jp unhandledInt
87+
jp unhandledInt
88+
jp unhandledInt
89+
jp unhandledInt
90+
jp unhandledInt
91+
jp unhandledInt
92+
jp unhandledInt
93+
jp unhandledInt
94+
jp unhandledInt
95+
jp unhandledInt
96+
jp unhandledInt
97+
jp unhandledInt
98+
jp unhandledInt
99+
jp unhandledInt
100+
jp unhandledInt
101+
jp unhandledInt
102+
jp unhandledInt
103+
unhandledInt:
104+
ei
105+
ret
106+
107+
;-------------------------------------------------------------------------------
108+
_int_SetVector:
109+
ld iy,0
110+
add iy,sp
111+
ld a,21
112+
ld l,(iy+3)
113+
sub a,l
114+
ld l,a
115+
ld h,4
116+
mlt hl
117+
ld de,iv_list+1
118+
add hl,de
119+
ld de,(iy+6)
120+
ld (hl),de
121+
ret
122+
123+
;-------------------------------------------------------------------------------
124+
_int_Reset:
125+
di
126+
ld hl, lconf
127+
ld de, mpIntMask
128+
ld bc, 16
129+
ldir
130+
im 1
131+
ret
132+
segment bss
133+
lconf: ds 16
134+
segment data
135+
cconf: ; Mask
136+
db 000h,000h,000h,000h
137+
; ACK
138+
db 0FFh,0FFh,0FFh,0FFh
139+
; Latch
140+
db 000h,000h,000h,000h
141+
; Invert
142+
db 000h,000h,000h,000h

0 commit comments

Comments
 (0)