diff options
author | Pixel <> | 2001-05-05 13:20:29 +0000 |
---|---|---|
committer | Pixel <> | 2001-05-05 13:20:29 +0000 |
commit | d3d5c69620a13a40aab0b55bc466621f09f89553 (patch) | |
tree | 7d4723feb62685ebf51709944127c95eee1381da /lib | |
parent | 64c9d850de6ee2a5adca9b12195cb698715d16ab (diff) |
Pouet
Diffstat (limited to 'lib')
-rw-r--r-- | lib/linker.c | 12 | ||||
-rw-r--r-- | lib/memoire.c | 6 | ||||
-rw-r--r-- | lib/simulator.c | 54 |
3 files changed, 45 insertions, 27 deletions
diff --git a/lib/linker.c b/lib/linker.c index b85cbb2..f1f371d 100644 --- a/lib/linker.c +++ b/lib/linker.c @@ -146,19 +146,23 @@ void addfile(char *nom) readword(f); /* Taille de la table des symboles */ nbsymbols = readword(f); + objects[objindex]->textstart = textsize; + objects[objindex]->datastart = datasize; + objects[objindex]->bssstart = bsssize; + pushcontext(_("Reading symbols")); for (i = 0; i < nbsymbols; i++) { type = readword(f); offset = readword(f); snom = readstring(f); +#if 1 + if (!(type & 1)) + fprintf(stderr, "Adding symbol %s at offset %X\n", snom, offset); +#endif addsymbol(snom, offset, type); } popcontext(); - objects[objindex]->textstart = textsize; - objects[objindex]->datastart = datasize; - objects[objindex]->bssstart = bsssize; - objects[objindex]->text = (Uint32 *) Emalloc(objects[objindex]->s_text * sizeof(Uint32)); objects[objindex]->data = (Uint32 *) Emalloc(objects[objindex]->s_data * sizeof(Uint32)); diff --git a/lib/memoire.c b/lib/memoire.c index 067f8f8..e9fc240 100644 --- a/lib/memoire.c +++ b/lib/memoire.c @@ -37,6 +37,7 @@ void FlushMemoire(void) Uint32 LD(Uint32 offset) { Uint32 i; + char buf[256]; switch (offset) { case 0xffffff00: @@ -50,7 +51,10 @@ Uint32 LD(Uint32 offset) clearterm(); break; case 0xffffff05: - fscanf(input, "%i", &i); + fgets(buf, 256, input); + if (sscanf(buf, "%i", &i) != 1) { + i = 0; + } break; default: if (offset >= TAILLE_MEMOIRE) { diff --git a/lib/simulator.c b/lib/simulator.c index c7c709c..8db38ef 100644 --- a/lib/simulator.c +++ b/lib/simulator.c @@ -14,7 +14,7 @@ #include "linker.h" #include "terminal.h" -int HasToRun = 1, HasToReset = 0, debug = 0; +int HasToRun = 1, HasToReset = 0, debug = 0, trace = 0; Uint32 base_addr = 0; @@ -424,28 +424,38 @@ void Debogueur(void) Champ1(instruction), Champ2(instruction), Champ3(instruction)); fprintf(stderr, "%08lX:%08lX - %08lX - %08lX > ", LireRegistrePC(), instruction, LD(LireRegistrePC() + 1), LD(LireRegistrePC() + 2)); - - switch (fgetc(input)) { - case 'G': - case 'g': - fprintf(stderr, "Go\n\n"); - debug = 0; - out = 1; - break; - case 'p': - case 'P': - fprintf(stderr, "Proceed\n\n"); + + if (!trace) { + switch (fgetc(input)) { + case 'G': + case 'g': + fprintf(stderr, "Go\n\n"); + debug = 0; + out = 1; + break; + case 'p': + case 'P': + fprintf(stderr, "Proceed\n\n"); + out = 1; + break; + case 'R': + case 'r': + break; + case 'T': + case 't': + trace = 1; + out = 1; + break; + case 'Q': + case 'q': + clearterm(); + exception(1, _("Shutdown requested")); + default: + fprintf(stderr, _("Help:\nG: go\nP: Proceed\nR: display registers\nT: trace\nQ: quit\n")); + } + } else { + fprintf(stderr, "Tracing...\n\n"); out = 1; - break; - case 'R': - case 'r': - break; - case 'Q': - case 'q': - clearterm(); - exception(1, _("Shutdown requested")); - default: - fprintf(stderr, _("Help:\nG: go\nP: Proceed\nR: display registers\nQ: quit\n")); } } } |