-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimer.asm
116 lines (93 loc) · 1.62 KB
/
timer.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
115
116
; Mettre a jour le timer c'est a dire :
; Charger les milli secondes, decrementer
; Si milli seconde == 0, charger secondes et decrementer
; Si seconde = 0, mettre timeup a 0
UPDATE_TIMER:
push hl
push af
ld hl, timeup
ld a, l
and a
jp z, fin_timer
ld hl, microsec
ld a,(hl)
dec a
jp z, moins_une_milliseconde
ld (hl), a
jp fin_timer
moins_une_milliseconde:
ld hl, millisec
ld a, (hl)
dec a
jp z, moins_une_seconde ; Tiens on viens de finir une seconde
ld (hl), a
ld hl, microsec
ld (hl), 100
call PRINT_MILLISEC
call PRINT_SEC
call UNLOCK_KFLAG
jp fin_timer
moins_une_seconde:
ld hl, sec
ld a, (hl)
dec a
jp z, temps_ecoule
ld (hl), a
ld hl, millisec
ld (hl), 100
call PRINT_SEC
jp fin_timer
temps_ecoule:
ld hl, timeup
ld (hl), 0
fin_timer:
pop af
pop hl
ret
; Affichage des millisec
PRINT_MILLISEC:
ld hl, $0B00 ; Copie 0 dans CURROW et 11 dans CURCOL (optimisation de deeph)
ld (CURROW),hl
ld hl, (millisec)
ld h, 0
call _dispHL
ret
; Affichage des secondes
PRINT_SEC:
ld hl, $0600
ld (CURROW),hl
ld hl, (sec)
ld h, 0
call _dispHL
ret
; Deverouiller le flag qui empeche la pose involontaire de multiples tubes
UNLOCK_KFLAG:
ld hl, kflag
ld a, (hl)
or a
jp z, ne_rien_faire
dec a
ld (hl), a
ne_rien_faire:
call PRINT_SCORE
ret
; Afficher l'horloge (sprite)
PRINT_OCLOCK:
ld a, 8
ld e, a
ld a, 88
ld hl, oclock
call DRWSPR
ret
; Timeup est a 0 si le temps est ecoule
timeup:
.db 1
; Le nombre de secondes
sec:
.db 5
; Le nombre de millisecondes
millisec:
.db 100
; Le nombre de microsecondes (non affiche)
microsec:
.db 100