]>
Commit | Line | Data |
---|---|---|
616eebe0 | 1 | SECTION "a",HOME |
20204e79 | 2 | |
616eebe0 | 3 | main: |
20204e79 | 4 | ld c, $51 ; Note that we are alive. |
616eebe0 JW |
5 | ld a, $FF |
6 | ld [c],a | |
62940da0 | 7 | |
9c834ff2 JW |
8 | ld sp, $DFF0 |
9 | ||
30ef1ae0 JW |
10 | ld hl, $DF81 |
11 | ld a, $80 | |
12 | ld [hl], a | |
9c834ff2 | 13 | |
30ef1ae0 JW |
14 | ld c, $07 |
15 | ld a, $04 ;start timer, 4.096KHz | |
16 | ld [c], a | |
5bac4cf0 JW |
17 | ;diqs: ei |
18 | ; ld a, $80 | |
19 | ; ld c, $51 | |
20 | ; ld [c], a | |
21 | ; jr diqs | |
22 | call irqhand | |
30ef1ae0 | 23 | ei |
5bac4cf0 | 24 | coqs: jr coqs |
20204e79 | 25 | |
5bac4cf0 JW |
26 | section "Diq", HOME[$38] |
27 | fuqed: | |
31833112 | 28 | di |
5bac4cf0 | 29 | jr fuqed |
20204e79 | 30 | |
5bac4cf0 | 31 | section "fuq",HOME[$100] |
31833112 JW |
32 | irqhand: |
33 | PUSH AF | |
34 | PUSH BC | |
35 | PUSH DE | |
36 | PUSH HL | |
9c834ff2 | 37 | |
31833112 JW |
38 | xor a |
39 | ld c, $0F ; ack the irq | |
40 | ld [c], a | |
9c834ff2 | 41 | |
30ef1ae0 JW |
42 | ld a, $41 ; print A |
43 | call putc | |
9c834ff2 | 44 | |
30ef1ae0 JW |
45 | ld hl, $DF81 |
46 | ld a, [hl] | |
f888201b | 47 | add 1 |
30ef1ae0 JW |
48 | ld c, $51 |
49 | ld [c], a | |
5bac4cf0 | 50 | ld [hl], a |
9c834ff2 JW |
51 | |
52 | ||
31833112 JW |
53 | POP HL |
54 | POP DE | |
55 | POP BC | |
56 | POP AF | |
57 | RETI | |
5bac4cf0 JW |
58 | db $18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE |
59 | db $18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE | |
60 | db $18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE | |
30ef1ae0 JW |
61 | |
62 | putc: | |
63 | ld b, 0 | |
64 | ld c, $50 | |
65 | push af | |
66 | .waitport: | |
67 | ld a,[c] | |
68 | cp b | |
69 | jr nz,.waitport | |
70 | pop af | |
71 | ld [c],a | |
72 | ret |