-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrl.s
More file actions
78 lines (75 loc) · 1.3 KB
/
scrl.s
File metadata and controls
78 lines (75 loc) · 1.3 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
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
.include "atari.inc"
; Entry point for C function
.global _scrl
.import _dlist
.import _mapstrt
.import _scrlc
.import _scrlh
.import _swap
.import _decBarrels
bar: .word 0
_scrl: ; initialize the scroll vbi, called from C
lda #7; deferref vbank routine
sta _scrlh; handy to initialize scrlh also :-)
ldx #>scrli ; arguments for address of VBI
ldy #<scrli
jmp SETVBV ; OS register VBlank
scrli: ; VBI routine
pha
txa
pha
scrlit:
jsr _decBarrels
ldx _scrlh
dex
stx HSCROL
stx _scrlh
bpl out ; if positive, let the antic do the scrolling, otherwise update the map location
jsr _swap
; Reset the scroll counter
ldx #7
stx _scrlh
stx HSCROL
ldx #0
ldy _scrlc
iny
sty _scrlc
cpy #40
bcc loop2
stx _scrlc
ldy #0
resloop:
; Reset the background
lda _mapstrt,Y
sta _dlist+4,X
lda _mapstrt+1,Y
sta _dlist+5,X
iny
iny
inx
inx
inx
cpx #69
bcc resloop
jmp out
ldx #0
loop2:
ldx #30 ; skip scrolling the top of the screen.
loop2b: ; move screen pointers in DLIST
lda _dlist+4,X
clc
adc #2
sta _dlist+4,X
lda _dlist+5,X
adc #0
sta _dlist+5,X
inx
inx
inx
cpx #69
bcc loop2b
out:
pla
tax
pla
jmp XITVBV