Commit 10bf25f409118c741d2c385b8478cff3a0b63597
1 parent
9e20955c
Correction du modulo
Showing
2 changed files
with
14 additions
and
8 deletions
Show diff stats
principal.txt
@@ -137,17 +137,17 @@ afficherHorloge: | @@ -137,17 +137,17 @@ afficherHorloge: | ||
137 | temp <- t2 & 0b00011111 | 137 | temp <- t2 & 0b00011111 |
138 | d3 <- 0x00 | 138 | d3 <- 0x00 |
139 | si temp > 10 alors d3 <- afficheur@ROM[temp/10] | 139 | si temp > 10 alors d3 <- afficheur@ROM[temp/10] |
140 | - d2 <- afficheur@ROM[temp-(temp/10)*10] | 0b10000000 | 140 | + d2 <- afficheur@ROM[temp%10] | 0b10000000 |
141 | d1 <- afficheur@ROM[t1/10] | 141 | d1 <- afficheur@ROM[t1/10] |
142 | - d0 <- afficheur@ROM[t1-(t1/10)*10] | 142 | + d0 <- afficheur@ROM[t1%10] |
143 | ret | 143 | ret |
144 | 144 | ||
145 | afficherTemperature: | 145 | afficherTemperature: |
146 | ; Considère le registre compteur comme une température et l'affiche | 146 | ; Considère le registre compteur comme une température et l'affiche |
147 | d0 <- 0x63 | 147 | d0 <- 0x63 |
148 | - d1 <- afficheur@ROM[compteur-(compteur/10)*10] | 148 | + d1 <- afficheur@ROM[compteur%10] |
149 | temp <- compteur / 10 + 5 | 149 | temp <- compteur / 10 + 5 |
150 | - d2 <- afficheur@ROM[temp-(temp/10)*10] | 0b10000000 | 150 | + d2 <- afficheur@ROM[temp%10] | 0b10000000 |
151 | d3 <- 0x00 | 151 | d3 <- 0x00 |
152 | si temp > 10 alors d3 <- afficheur@ROM[temp/10] | 152 | si temp > 10 alors d3 <- afficheur@ROM[temp/10] |
153 | ret | 153 | ret |
@@ -155,7 +155,7 @@ afficherTemperature: | @@ -155,7 +155,7 @@ afficherTemperature: | ||
155 | afficherHeur: | 155 | afficherHeur: |
156 | ; Considère le registre compteur comme une heure et l'affiche | 156 | ; Considère le registre compteur comme une heure et l'affiche |
157 | d3 <- afficheur@ROM[compteur/10] | 157 | d3 <- afficheur@ROM[compteur/10] |
158 | - d2 <- afficheur@ROM[compteur-(compteur/10)*10] | 0b10000000 | 158 | + d2 <- afficheur@ROM[compteur%10] | 0b10000000 |
159 | d1 <- 0x00 | 159 | d1 <- 0x00 |
160 | d0 <- 0x00 | 160 | d0 <- 0x00 |
161 | ret | 161 | ret |
@@ -165,7 +165,7 @@ afficherMinu: | @@ -165,7 +165,7 @@ afficherMinu: | ||
165 | d3 <- 0x00 | 165 | d3 <- 0x00 |
166 | d2 <- 0b10000000 | 166 | d2 <- 0b10000000 |
167 | d1 <- afficheur@ROM[compteur/10] | 167 | d1 <- afficheur@ROM[compteur/10] |
168 | - d0 <- afficheur@ROM[compteur-(compteur/10)*10] | 168 | + d0 <- afficheur@ROM[compteur%10] |
169 | ret | 169 | ret |
170 | 170 | ||
171 | afficherJour: | 171 | afficherJour: |
@@ -221,7 +221,7 @@ agir1s: | @@ -221,7 +221,7 @@ agir1s: | ||
221 | inc d0 | 221 | inc d0 |
222 | ; Met à jour les registres de temps, active agir10s ou agirHeur si nécessaire | 222 | ; Met à jour les registres de temps, active agir10s ou agirHeur si nécessaire |
223 | inc t0 | 223 | inc t0 |
224 | - si t0-(t0/5)*5 != 0 saut ret ; Continue si on est sur un multiple de 10 secondes | 224 | + si t0%5 != 0 saut ret ; Continue si on est sur un multiple de 10 secondes |
225 | call agir10s | 225 | call agir10s |
226 | si t0 < 30 saut ret ; Continue si on est sur un multiple de 60 secondes | 226 | si t0 < 30 saut ret ; Continue si on est sur un multiple de 60 secondes |
227 | t0 <- 0 | 227 | t0 <- 0 |
@@ -320,7 +320,7 @@ etatParaJours: | @@ -320,7 +320,7 @@ etatParaJours: | ||
320 | compteur <- 12 | 320 | compteur <- 12 |
321 | etatParaJoursU: | 321 | etatParaJoursU: |
322 | d3 <- afficheur@ROM[compteur/10] | 322 | d3 <- afficheur@ROM[compteur/10] |
323 | - d2 <- afficheur@ROM[compteur-(compteur/10)*10] | 323 | + d2 <- afficheur@ROM[compteur%10] |
324 | d1 <- 0x00 | 324 | d1 <- 0x00 |
325 | temp <- (etat - 10) * 24 + compteur | 325 | temp <- (etat - 10) * 24 + compteur |
326 | ; Si la RAM n'est pas initialisée à cet endroit, on préfère afficher un tiret | 326 | ; Si la RAM n'est pas initialisée à cet endroit, on préfère afficher un tiret |
scripts/gram.txt
@@ -472,18 +472,21 @@ eti{NUM0}: | @@ -472,18 +472,21 @@ eti{NUM0}: | ||
472 | eti{NUM0}: | 472 | eti{NUM0}: |
473 | SUB R16,R17 | 473 | SUB R16,R17 |
474 | BRCC eti{NUM0} | 474 | BRCC eti{NUM0} |
475 | + ADD R16,R17 | ||
475 | 476 | ||
476 | [SymboleModulo] [Valeur]:val | 477 | [SymboleModulo] [Valeur]:val |
477 | LDI R17,{val} | 478 | LDI R17,{val} |
478 | eti{NUM0}: | 479 | eti{NUM0}: |
479 | SUB R16,R17 | 480 | SUB R16,R17 |
480 | BRCC eti{NUM0} | 481 | BRCC eti{NUM0} |
482 | + ADD R16,R17 | ||
481 | 483 | ||
482 | [SymboleModulo] [VariableIO]:var | 484 | [SymboleModulo] [VariableIO]:var |
483 | IN R17,{var} | 485 | IN R17,{var} |
484 | eti{NUM0}: | 486 | eti{NUM0}: |
485 | SUB R16,R17 | 487 | SUB R16,R17 |
486 | BRCC eti{NUM0} | 488 | BRCC eti{NUM0} |
489 | + ADD R16,R17 | ||
487 | 490 | ||
488 | [SymboleModulo] [Tableau]:var [Expression]:exp [blanc]* "]" | 491 | [SymboleModulo] [Tableau]:var [Expression]:exp [blanc]* "]" |
489 | PUSH R16 | 492 | PUSH R16 |
@@ -497,12 +500,14 @@ eti{NUM0}: | @@ -497,12 +500,14 @@ eti{NUM0}: | ||
497 | eti{NUM0}: | 500 | eti{NUM0}: |
498 | SUB R16,R17 | 501 | SUB R16,R17 |
499 | BRCC eti{NUM0} | 502 | BRCC eti{NUM0} |
503 | + ADD R16,R17 | ||
500 | 504 | ||
501 | [SymboleModulo] [Variable]:var | 505 | [SymboleModulo] [Variable]:var |
502 | LDS R17,{var} | 506 | LDS R17,{var} |
503 | eti{NUM0}: | 507 | eti{NUM0}: |
504 | SUB R16,R17 | 508 | SUB R16,R17 |
505 | BRCC eti{NUM0} | 509 | BRCC eti{NUM0} |
510 | + ADD R16,R17 | ||
506 | 511 | ||
507 | [SymboleModulo] [Expression100]:exp | 512 | [SymboleModulo] [Expression100]:exp |
508 | PUSH R16 | 513 | PUSH R16 |
@@ -511,6 +516,7 @@ eti{NUM0}: | @@ -511,6 +516,7 @@ eti{NUM0}: | ||
511 | eti{NUM0}: | 516 | eti{NUM0}: |
512 | SUB R16,R17 | 517 | SUB R16,R17 |
513 | BRCC eti{NUM0} | 518 | BRCC eti{NUM0} |
519 | + ADD R16,R17 | ||
514 | 520 | ||
515 | 521 | ||
516 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 522 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |