-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbg2.asm
85 lines (60 loc) · 952 Bytes
/
bg2.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
84
85
.include "header.inc"
.include "snesregs.inc"
.include "misc_macros.inc"
.include "zeropage.inc"
.include "bg2.inc"
.bank 0 slot 1
.ramsection "bg2_vars" SLOT RAM_SLOT
bg2_off: db
bg2_count: db
bg2_scrolling: db
.ends
.16BIT
.define SCROLL_TICK_MASK $07
.section "bg2_code" FREE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Animate the scrolling background
;
bg2_doScrolling:
pushall
A8
XY8
lda bg2_scrolling
and #$ff
beq @nomove
; Animate scrolling background
lda bg2_count
ina
sta bg2_count
and #SCROLL_TICK_MASK
cmp #SCROLL_TICK_MASK
bne @nomove
lda bg2_off
ina
sta bg2_off
sta BG2HOFS
sta BG2VOFS
@nomove:
popall
rts
bg2_fill:
pushall
Fill_VRAM BG2_TILE_MAP_OFFSET ((2<<BGMAPENT_PALSHIFT)|0) 32*32
popall
rts
bg2_enableScrolling:
pushall
A8
lda #1
sta bg2_scrolling
popall
rts
bg2_disableScrolling:
pushall
A8
lda #0
sta bg2_scrolling
popall
rts
.ends