From 10bf25f409118c741d2c385b8478cff3a0b63597 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Fri, 19 May 2017 20:58:17 +0200 Subject: [PATCH] Correction du modulo --- principal.txt | 16 ++++++++-------- scripts/gram.txt | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/principal.txt b/principal.txt index c8c4769..ac718fb 100644 --- a/principal.txt +++ b/principal.txt @@ -137,17 +137,17 @@ afficherHorloge: temp <- t2 & 0b00011111 d3 <- 0x00 si temp > 10 alors d3 <- afficheur@ROM[temp/10] - d2 <- afficheur@ROM[temp-(temp/10)*10] | 0b10000000 + d2 <- afficheur@ROM[temp%10] | 0b10000000 d1 <- afficheur@ROM[t1/10] - d0 <- afficheur@ROM[t1-(t1/10)*10] + d0 <- afficheur@ROM[t1%10] ret afficherTemperature: ; Considère le registre compteur comme une température et l'affiche d0 <- 0x63 - d1 <- afficheur@ROM[compteur-(compteur/10)*10] + d1 <- afficheur@ROM[compteur%10] temp <- compteur / 10 + 5 - d2 <- afficheur@ROM[temp-(temp/10)*10] | 0b10000000 + d2 <- afficheur@ROM[temp%10] | 0b10000000 d3 <- 0x00 si temp > 10 alors d3 <- afficheur@ROM[temp/10] ret @@ -155,7 +155,7 @@ afficherTemperature: afficherHeur: ; Considère le registre compteur comme une heure et l'affiche d3 <- afficheur@ROM[compteur/10] - d2 <- afficheur@ROM[compteur-(compteur/10)*10] | 0b10000000 + d2 <- afficheur@ROM[compteur%10] | 0b10000000 d1 <- 0x00 d0 <- 0x00 ret @@ -165,7 +165,7 @@ afficherMinu: d3 <- 0x00 d2 <- 0b10000000 d1 <- afficheur@ROM[compteur/10] - d0 <- afficheur@ROM[compteur-(compteur/10)*10] + d0 <- afficheur@ROM[compteur%10] ret afficherJour: @@ -221,7 +221,7 @@ agir1s: inc d0 ; Met à jour les registres de temps, active agir10s ou agirHeur si nécessaire inc t0 - si t0-(t0/5)*5 != 0 saut ret ; Continue si on est sur un multiple de 10 secondes + si t0%5 != 0 saut ret ; Continue si on est sur un multiple de 10 secondes call agir10s si t0 < 30 saut ret ; Continue si on est sur un multiple de 60 secondes t0 <- 0 @@ -320,7 +320,7 @@ etatParaJours: compteur <- 12 etatParaJoursU: d3 <- afficheur@ROM[compteur/10] - d2 <- afficheur@ROM[compteur-(compteur/10)*10] + d2 <- afficheur@ROM[compteur%10] d1 <- 0x00 temp <- (etat - 10) * 24 + compteur ; Si la RAM n'est pas initialisée à cet endroit, on préfère afficher un tiret diff --git a/scripts/gram.txt b/scripts/gram.txt index b948f87..110f1f0 100644 --- a/scripts/gram.txt +++ b/scripts/gram.txt @@ -472,18 +472,21 @@ eti{NUM0}: eti{NUM0}: SUB R16,R17 BRCC eti{NUM0} + ADD R16,R17 [SymboleModulo] [Valeur]:val LDI R17,{val} eti{NUM0}: SUB R16,R17 BRCC eti{NUM0} + ADD R16,R17 [SymboleModulo] [VariableIO]:var IN R17,{var} eti{NUM0}: SUB R16,R17 BRCC eti{NUM0} + ADD R16,R17 [SymboleModulo] [Tableau]:var [Expression]:exp [blanc]* "]" PUSH R16 @@ -497,12 +500,14 @@ eti{NUM0}: eti{NUM0}: SUB R16,R17 BRCC eti{NUM0} + ADD R16,R17 [SymboleModulo] [Variable]:var LDS R17,{var} eti{NUM0}: SUB R16,R17 BRCC eti{NUM0} + ADD R16,R17 [SymboleModulo] [Expression100]:exp PUSH R16 @@ -511,6 +516,7 @@ eti{NUM0}: eti{NUM0}: SUB R16,R17 BRCC eti{NUM0} + ADD R16,R17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -- libgit2 0.21.2