summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/simulator.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/simulator.c b/lib/simulator.c
index 148aca0..dd213fe 100644
--- a/lib/simulator.c
+++ b/lib/simulator.c
@@ -22,7 +22,7 @@
*/
-int HasToRun = 1;
+int HasToRun = 1, Reset;
Uint32 LireInstruction(void)
{
@@ -333,11 +333,12 @@ void DecodeExec(Uint32 instruction, Uint32 entrypoint)
break;
case 127: /* HALT-RESET */
- if (ValeurBit(Extension(instruction), 0))
+ if (ValeurBit(Extension(instruction), 0)) {
HasToRun = 0; /* Halt */
- else
+ } else {
+ Reset = 1; /* Reset */
ResetRegistres();
- Traitement(entrypoint); /* Reset *//* ************FIXMI************** */
+ }
break;
default:
exception(1, _("DecodeExec: Invalid Opcode"));
@@ -348,12 +349,15 @@ void Traitement(Uint32 entrypoint)
{ /* ******************** FIXMI ************************* */
Uint32 instruction;
- EcrireRegistrePC(entrypoint);
- HasToRun = 1;
while (HasToRun) {
- instruction = LireInstruction();
- IncrementeCompteurOrdinal();
- DecodeExec(instruction, entrypoint);
+ EcrireRegistrePC(entrypoint);
+ HasToRun = 1;
+ Reset = 0;
+ while ((HasToRun) && (!Reset)) {
+ instruction = LireInstruction();
+ IncrementeCompteurOrdinal();
+ DecodeExec(instruction, entrypoint);
+ }
}
}