-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterrupt.asm
63 lines (49 loc) · 1.01 KB
/
interrupt.asm
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
org 0x1000
prhex = $c174
putchar = $c45e
fdc_rwfs_c19d = $c19d
PUBLIC _main
_main:
; hello
nop
nop
nop
ld a,$41
ld ($d050),a
; disable interrupts (just in case)
di
; set $11 as the MSB of the interrupt vector table base address
ld a,$11
ld i,a
; timer control word
ld l,$b7
ld c,$e3
out (c),l
; timer costant
ld l,$40
ld c,$e3
out (c),l
; set $00 as the LSB of the interrupt vector table base address
; (tells CTC to generate vectors at $1100)
ld l,$00
ld c,$e3
out (c),l
im 2 ; set interrupt mode 2
ei ; enable interrupts
halt:
nop
nop
jr halt
; interrupt vector for CTC timer 3 must be located at 1106
REPT $1106 - ASMPC - $1000
nop
ENDR
BYTE (timer_isr & $FF)
BYTE (timer_isr >> 8)
; ISR routine
timer_isr:
ld a,($d000)
inc a
ld ($d000),a
ei
reti