diff options
author | Pixel <> | 2001-04-16 20:40:13 +0000 |
---|---|---|
committer | Pixel <> | 2001-04-16 20:40:13 +0000 |
commit | 85155ff54ba94f8ac40e267f83435284e88b866c (patch) | |
tree | 26e8ba119f6e5af7cbdf40cf8382becbc1affefd /lib/simulator.c | |
parent | 4b6921b966481ff28c919ca0e0fb345e601a9a74 (diff) |
Prout
Diffstat (limited to 'lib/simulator.c')
-rw-r--r-- | lib/simulator.c | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/lib/simulator.c b/lib/simulator.c index 247a8c4..d542a07 100644 --- a/lib/simulator.c +++ b/lib/simulator.c @@ -14,19 +14,12 @@ #include "fpu.h" #include "exceptions.h" #include "linker.h" +#include "terminal.h" -/* - initialisation de la MP avec un malloc - fermeture du prog et free - catch du ctrl-c - */ - - -int HasToRun = 1, HasToReset; +int HasToRun = 1, HasToReset = 0, debug = 0; Uint32 base_addr = 0; - Uint32 LireInstruction(void) { return (LD(LireRegistrePC())); @@ -373,22 +366,45 @@ void AfficheReg(void) // affiche reg for (i = 0; i <= 3; i++) { for (j = 1; j <= 8; j++) { - printf(" R%02d ", (i * 8 + j)); + fprintf(stderr, " R%02d ", (i * 8 + j)); } - printf("\n"); + fprintf(stderr, "\n"); for (j = 1; j <= 8; j++) { - printf("%08lX ", (registre[i * 8 + j - 1])); + fprintf(stderr, "%08lX ", (registre[i * 8 + j - 1])); } - printf("\n"); + fprintf(stderr, "\n"); } - printf("Rg: %08lX | Rd: %08lX | Flag: %08lX | PC: %08lX\n", LireRegistreRG(), LireRegistreRD(), + fprintf(stderr, "Rg: %08lX | Rd: %08lX | Flag: %08lX | PC: %08lX\n\n", LireRegistreRG(), LireRegistreRD(), LireRegistreFLAG(), registre[REG_PC]); - printf("\n"); } void Debogueur(void) { - AfficheReg(); + int out = 0; + + while (!out) { + AfficheReg(); + printf("%08lX:%08lX > ", LireRegistrePC(), LD(LireRegistrePC())); + + switch (fgetc(input)) { + case 'G': + case 'g': + fprintf(stderr, "Go\n") + debug = 0; + out = 1; + break; + case 'p': + case 'P': + fprintf(stderr, "Proceed\n"); + out = 1; + break; + case 'R': + case 'r': + break; + default: + fprintf(stderr, _("Help:\nG: go\nP: Proceed\nR: display registers\n\n"); + } + } } void ChargeBinaire(char *filename) |