-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscore.asm
114 lines (102 loc) · 1.65 KB
/
score.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
;Airaki! - FSE 2014
;Released under the GPL V3, see LICENSE.TXT
;B=To add
inc_score:
push bc
ld a,(SCORE) ;DHL=(SCORE)
ld l,a
ld a,(SCORE+1)
ld h,a
ld a,(SCORE+2)
ld d,a
call inc_24bit
ld a,l ;(SCORE)=DHL
ld (SCORE),a
ld a,h
ld (SCORE+1),a
ld a,d
ld (SCORE+2),a
pop bc
ld a,(SCOREEN) ;DHL=(SCOREEN)
ld l,a
ld a,(SCOREEN+1)
ld h,a
ld a,(SCOREEN+2)
ld d,a
call inc_24bit
ld a,l ;(SCOREEN)=DHL
ld (SCOREEN),a
ld a,h
ld (SCOREEN+1),a
ld a,d
ld (SCOREEN+2),a
ret
inc_24bit:
ld a,b
call bin2bcd
ld e,a
ld a,l
add e
daa
ld l,a
jr nc,+
ld a,h
add 1
daa
ld h,a
jr nc,+
ld a,d
add 1
daa
cp $10 ;Cap to 99999
jr nz,++
ld l,$99
ld h,l
ld d,9
jr +
++:
ld d,a
+:
ret
drawscore:
ldh a,($FF)
push af
xor a
ldh ($FF),a
ld c,$D0
inc de
inc de
ld a,(de)
and $F
add c
call wait_write
ldi (hl),a
dec de
ld a,(de)
ld b,a
swap a
and $F
add c
call wait_write
ldi (hl),a
ld a,b
and $F
add c
call wait_write
ldi (hl),a
dec de
ld a,(de)
ld b,a
swap a
and $F
add c
call wait_write
ldi (hl),a
ld a,b
and $F
add c
call wait_write
ldi (hl),a
pop af
ldh ($FF),a
ret