-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinterrupts.asm
executable file
·83 lines (69 loc) · 1.44 KB
/
interrupts.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Handles all IRQ related routines
//.pc = $9000 "IRQ routines"
.pc = movementEnd+1 "IRQ Routines"
SetRasterIRQ:
{
sei // turn off interrupts
lda #$7f
ldx #$01
sta $dc0d // Turn off CIA 1 interrupts
sta $dd0d // Turn off CIA 2 interrupts
stx $d01a // Turn on raster interrupts
lda #$1b
ldx #$08
ldy #$14
sta $d011 // Clear high bit of $d012, set text mode
stx $d016 // single-colour
sty $d018 // screen at $0400, charset at $2000
lda #<irq1 // low part of address of interrupt handler code
ldx #>irq1 // high part of address of interrupt handler code
ldy #$00 // line to trigger interrupt
sta $0314 // store in interrupt vector
stx $0315
sty $d012
lda $dc0d // ACK CIA 1 interrupts
lda $dd0d // ACK CIA 2 interrupts
asl $d019 // ACK VIC interrupts
cli
rts
irq1: lda #00
sta $d020
sta $d021
// bitmap mode
lda #$20
sta bmpage
lda #$18
sta VMCSB
lda SCROLY
ora #32
sta SCROLY
lda #<irq2
ldx #>irq2
sta $0314
stx $0315
// Create raster interrupt at line 209, allows just 5 rows of text :3
ldy #209
sty $d012
asl $d019
jmp $ea31
// jmp $ea81
irq2:
lda #$00
sta $d020
sta $d021
lda #$1b
ldx #$08
ldy #$14
sta $d011 // Clear high bit of $d012, set text mode
stx $d016 // single-colour
sty $d018 // screen at $0400, charset at $2000
lda #<irq1
ldx #>irq1
sta $0314
stx $0315
ldy #$00
sty $d012
asl $d019
jmp $ea31
}
interruptsEnd: nop