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
|
;
; Simple starfield effect
;
stars_update:
ld x, <stars
ld a, >stars
stars_update_loop:
ld y, [a : x]
inc x
bo
inc a
ld b, [a : x]
; is the end of list?
cmp b, 0xff
bz
ret
push a
push x
; erase old
ld x, 0
ld [b : y], x
ld x, [sp + 0]
; update address
inc x
bo
inc a
push x
ld x, [a : x]
stars_update_addr:
add y, 128
bo
inc b
cmp b, 0xfe
bnz
jmp stars_no_wrap
cmp y, 0x80
bc
ld b, 0xbf
stars_no_wrap:
dec x
bnz
jmp stars_update_addr
pop x
; draw new: color
inc x
bo
inc a
ld x, [a : x]
ld [b : y], x
pop x
pop a
; save new address
ld [a : x], b
dec x
bo
dec a
ld [a : x], y
; next star
add x, 4
bo
inc a
jmp stars_update_loop
|