diff options
-rw-r--r-- | include/simulator.h | 6 | ||||
-rw-r--r-- | lib/simulator.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/include/simulator.h b/include/simulator.h index 852fb7d..834a46c 100644 --- a/include/simulator.h +++ b/include/simulator.h @@ -1,5 +1,6 @@ #ifndef __SIMULATOR_H__ #define __SIMULATOR_H__ +#include "types.h" #define TAILLE_MEMOIRE 1024 /* Nombre maximum de mots que peut contenir la mémoire principale */ #define NB_REGISTRES_PHYSIQUES 64 /* Nombre réel de registres */ @@ -11,10 +12,9 @@ #define REG_STACKPTR 36 /* Numero du registre de Push-Pop */ #define ADD_SP (TAILLE_MEMOIRE-1) /* Emplacement de la pile */ -#include "types.h" -Uint32 memoire_principale[TAILLE_MEMOIRE]; -Uint32 registre[NB_REGISTRES_PHYSIQUES]; /* Registres classiques */ +extern Uint32 memoire_principale[TAILLE_MEMOIRE]; +extern Uint32 registre[NB_REGISTRES_PHYSIQUES]; /* Registres classiques */ Uint32 LireInstruction(void); void IncrementeCompteurOrdinal(void); Uint32 Adresse(Uint32 u, Uint32 instruction); diff --git a/lib/simulator.c b/lib/simulator.c index 4cc5d6f..92286c1 100644 --- a/lib/simulator.c +++ b/lib/simulator.c @@ -278,8 +278,12 @@ void DecodeExec(Uint32 instruction, Uint32 entrypoint) } if (test1) { Uint32 tmp; - + + tmp = LireInstruction(); + if (Opcode(instruction) & 1) { + tmp += LireRegistrePC(); + } EcrireRegistrePC(tmp); } break; |