diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | lib/linker.c | 6 | ||||
-rw-r--r-- | lib/memoire.c | 13 | ||||
-rw-r--r-- | lib/simulator.c | 5 |
4 files changed, 16 insertions, 10 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index a50e586..ef6b180 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -8,6 +8,8 @@ libCompilo_la_SOURCES = assembler.c parser.c meta.c numbers.c hash.c exceptions. libSimul_la_SOURCES = alu.c simulator.c exceptions.c fpu.c interne.c memoire.c registre.c terminal.c libLinker_la_SOURCES = linker.c exceptions.c hash.c +libLinker_la_CFLAGS = -DDEBUG + libCompilo_la_LDFLAGS = -version-info $(ProjetArchi_VERSION_INFO) libSimul_la_LFDLAGS = -version-info $(ProjetArchi_VERSION_INFO) libLinker_la_LDFLAGS = -version-info $(ProjetArchi_VERSION_INFO) diff --git a/lib/linker.c b/lib/linker.c index 0460d41..8582142 100644 --- a/lib/linker.c +++ b/lib/linker.c @@ -236,7 +236,7 @@ static void dumprelog(FILE * f) break; } #ifdef DEBUG - fprintf(stderr, "Relogement effectué sur %i, de %i octets pour le symbole %s\n", + fprintf(stderr, "Relogement effectué sur %i (text), de %i octets pour le symbole %s\n", s->offset, decal, s->name); #endif objects[s->objindex]->text[s->offset] += decal; @@ -257,6 +257,10 @@ static void dumprelog(FILE * f) exception(1, _("Internal error")); break; } +#ifdef DEBUG + fprintf(stderr, "Relogement effectué sur %i (data), de %i octets pour le symbole %s\n", + s->offset, decal, s->name); +#endif objects[s->objindex]->data[s->offset] += decal; writeword(textsize + objects[s->objindex]->datastart + s->offset, f); break; diff --git a/lib/memoire.c b/lib/memoire.c index b181015..e38f0d7 100644 --- a/lib/memoire.c +++ b/lib/memoire.c @@ -75,13 +75,7 @@ static void litchaine(char *s, Uint32 * t) while (*t) { *(s++) = *(t++); } -} - -static void Affiche(Uint32 * t) -{ - while (*t) { - fprintf(stdout, "%c", (*t++)); - } + *s = 0; } static void AfficheBinaire(Uint32 valeur) @@ -106,7 +100,8 @@ void ST(Uint32 offset, Uint32 valeur) fprintf(stdout, "%c", valeur); break; case 0xffffff04: - Affiche(&memoire_principale[valeur]); + litchaine(temp, &memoire_principale[valeur]); + fprintf(stdout, "%s", temp); break; case 0xffffff06: fprintf(stdout, "%i", valeur); @@ -129,6 +124,8 @@ void ST(Uint32 offset, Uint32 valeur) oldOC = LireRegistrePC(); ChargeBinaire(temp); EcrireRegistrePC(oldOC); + HasToRun = 1; + break; default: if (offset < 0 || offset >= TAILLE_MEMOIRE) exception(1, _("Invalid Memory Adress")); diff --git a/lib/simulator.c b/lib/simulator.c index 4e77c6b..40c3431 100644 --- a/lib/simulator.c +++ b/lib/simulator.c @@ -402,7 +402,7 @@ void Debogueur(void) fprintf(stderr, "Opcode: %02X, extension: %02X, champ1: %02X, champ2: %02X, champ3: %02X\n", Opcode(instruction), Extension(instruction), Champ1(instruction), Champ2(instruction), Champ3(instruction)); - fprintf(stderr, "%08lX:%08lX > ", LireRegistrePC(), instruction); + fprintf(stderr, "%08lX:%08lX - %08lX - %08lX > ", LireRegistrePC(), instruction, LD(LireRegistrePC() + 1), LD(LireRegistrePC() + 2)); switch (fgetc(input)) { case 'G': @@ -457,10 +457,13 @@ void ChargeBinaire(char *filename) Uint32 entrypoint, nb, ns, nbss, nr, *relocation_table; int i; + sprintf(message, _("Opening file %s"), filename); + pushcontext(message); file = openfilereading(filename); if (readword(file) != 0x58454e4e) { /* verification de la signature */ exception(1, _("Invalid Signature")); } + popcontext(); sprintf(message, _("Loading file %s"), filename); pushcontext(message); |