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