summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <>2001-04-17 03:20:16 +0000
committerPixel <>2001-04-17 03:20:16 +0000
commita856126fe7e965bc80d17690732ee58343a655d3 (patch)
tree5464a45d4ef03e2efdcc7788de31226832a0a45c
parentf12eda64018215310e5d563ebaf9fe4d46db24ff (diff)
Pouearf
-rw-r--r--include/simulator.h4
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/linker.c6
-rw-r--r--lib/memoire.c13
-rw-r--r--lib/simulator.c5
-rw-r--r--po/ProjetArchi.pot43
-rw-r--r--po/cat-id-tbl.c55
-rw-r--r--samples/Makefile.samples3
-rw-r--r--samples/testtout.s7
-rw-r--r--src/compilo.c3
-rw-r--r--src/simul.c8
11 files changed, 83 insertions, 66 deletions
diff --git a/include/simulator.h b/include/simulator.h
index a6350e7..51b965d 100644
--- a/include/simulator.h
+++ b/include/simulator.h
@@ -2,7 +2,7 @@
#define __SIMULATOR_H__
#include "types.h"
-#define TAILLE_MEMOIRE 1024 /* Nombre maximum de mots que peut contenir la mémoire principale */
+#define TAILLE_MEMOIRE 10240 /* Nombre maximum de mots que peut contenir la mémoire principale */
#define NB_REGISTRES_PHYSIQUES 64 /* Nombre réel de registres */
#define NB_REGISTRES_UTILISABLES 32 /* Nombre de registres que le processeur a à sa disposition */
#define REG_RG 32 /* Numero du registre Rg */
@@ -14,7 +14,7 @@
extern Uint32 registre[NB_REGISTRES_PHYSIQUES]; /* Registres classiques */
-extern int debug;
+extern int debug, HasToRun;
void Initialisation(void);
void Flush(void);
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);
diff --git a/po/ProjetArchi.pot b/po/ProjetArchi.pot
index 0eb9f60..79dfdac 100644
--- a/po/ProjetArchi.pot
+++ b/po/ProjetArchi.pot
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2001-04-17 04:11+0200\n"
+"POT-Creation-Date: 2001-04-17 05:14+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -296,7 +296,7 @@ msgstr ""
msgid "Error writing output file"
msgstr ""
-#: lib/assembler.c:2189 lib/linker.c:278
+#: lib/assembler.c:2189 lib/linker.c:282
msgid "Writing output file"
msgstr ""
@@ -449,7 +449,7 @@ msgstr ""
msgid "FPU not implemented"
msgstr ""
-#: lib/memoire.c:57 lib/memoire.c:134
+#: lib/memoire.c:57 lib/memoire.c:131
msgid "Invalid Memory Adress"
msgstr ""
@@ -488,36 +488,36 @@ msgstr ""
msgid "Symbol %s not found"
msgstr ""
-#: lib/linker.c:235 lib/linker.c:257 lib/linker.c:264
+#: lib/linker.c:235 lib/linker.c:257 lib/linker.c:268
msgid "Internal error"
msgstr ""
-#: lib/linker.c:282
+#: lib/linker.c:286
msgid "No startpoint defined."
msgstr ""
-#: lib/linker.c:285
+#: lib/linker.c:289
msgid "Writing headers"
msgstr ""
-#: lib/linker.c:294
+#: lib/linker.c:298
msgid "Writing relocating informations"
msgstr ""
-#: lib/linker.c:297
+#: lib/linker.c:301
msgid "Writing text segments"
msgstr ""
-#: lib/linker.c:302
+#: lib/linker.c:306
msgid "Writing data segments"
msgstr ""
-#: lib/linker.c:309
+#: lib/linker.c:313
#, c-format
msgid "Statistics: %i words of text, %i words of data and reserving %i words\n"
msgstr ""
-#: lib/linker.c:311
+#: lib/linker.c:315
#, c-format
msgid "Output file size: %i words containing %i relocating offsets.\n"
msgstr ""
@@ -552,17 +552,22 @@ msgid ""
"Q: quit\n"
msgstr ""
+#: lib/simulator.c:460
+#, c-format
+msgid "Opening file %s"
+msgstr ""
+
#. verification de la signature
-#: lib/simulator.c:462
+#: lib/simulator.c:464
msgid "Invalid Signature"
msgstr ""
-#: lib/simulator.c:465
+#: lib/simulator.c:468
#, c-format
msgid "Loading file %s"
msgstr ""
-#: lib/simulator.c:499
+#: lib/simulator.c:502
#, c-format
msgid "Executing file %s"
msgstr ""
@@ -617,21 +622,21 @@ msgstr ""
msgid "Signal received: segfault"
msgstr ""
-#: src/compilo.c:68 src/linker.c:51 src/simul.c:93
+#: src/compilo.c:69 src/linker.c:51 src/simul.c:95
msgid ""
"\n"
"Performing initialisation...\n"
"\n"
msgstr ""
-#: src/compilo.c:73 src/linker.c:63 src/simul.c:106
+#: src/compilo.c:74 src/linker.c:63 src/simul.c:108
msgid ""
"\n"
"Performing shutdown...\n"
"\n"
msgstr ""
-#: src/compilo.c:78 src/linker.c:68 src/simul.c:112
+#: src/compilo.c:79 src/linker.c:68 src/simul.c:114
msgid "Exitting, bye!\n"
msgstr ""
@@ -642,14 +647,14 @@ msgid ""
msgstr ""
#: src/simul.c:21
-msgid "Usage: linker [-q] [-d] binary\n"
+msgid "Usage: linker [-s] [-d] binary\n"
msgstr ""
#: src/simul.c:27
msgid " o Initialising the simulator... "
msgstr ""
-#: src/simul.c:96
+#: src/simul.c:98
msgid "Beginning simulation"
msgstr ""
diff --git a/po/cat-id-tbl.c b/po/cat-id-tbl.c
index 9b62514..f5efdd2 100644
--- a/po/cat-id-tbl.c
+++ b/po/cat-id-tbl.c
@@ -141,48 +141,49 @@ G: go\n\
P: Proceed\n\
R: display registers\n\
Q: quit\n", 126},
- {"Invalid Signature", 127},
- {"Loading file %s", 128},
- {"Executing file %s", 129},
- {"could not set terminal attributes", 130},
- {"could not open terminal", 131},
+ {"Opening file %s", 127},
+ {"Invalid Signature", 128},
+ {"Loading file %s", 129},
+ {"Executing file %s", 130},
+ {"could not set terminal attributes", 131},
+ {"could not open terminal", 132},
{"\
Assembler v1.0\n\
-\n", 132},
- {"Usage: compilo program.asm objet.out\n", 133},
- {" o Initialising the meta engine... ", 134},
+\n", 133},
+ {"Usage: compilo program.asm objet.out\n", 134},
+ {" o Initialising the meta engine... ", 135},
{"\
Done!\n\
- o Meta language loading... ", 135},
- {"Meta language loading failed.", 136},
+ o Meta language loading... ", 136},
+ {"Meta language loading failed.", 137},
{"\
Done!\n\
- o Initialising the assembler core...", 137},
- {"Assembler core init failed.", 138},
- {" Done!\n", 139},
- {"Signal received: segfault", 140},
+ o Initialising the assembler core...", 138},
+ {"Assembler core init failed.", 139},
+ {" Done!\n", 140},
+ {"Signal received: segfault", 141},
{"\
\n\
Performing initialisation...\n\
-\n", 141},
+\n", 142},
{"\
\n\
Performing shutdown...\n\
-\n", 142},
- {"Exitting, bye!\n", 143},
+\n", 143},
+ {"Exitting, bye!\n", 144},
{"\
Simul v1.0\n\
-\n", 144},
- {"Usage: linker [-q] [-d] binary\n", 145},
- {" o Initialising the simulator... ", 146},
- {"Beginning simulation", 147},
+\n", 145},
+ {"Usage: linker [-s] [-d] binary\n", 146},
+ {" o Initialising the simulator... ", 147},
+ {"Beginning simulation", 148},
{"\
Linker v1.0\n\
-\n", 148},
- {"Usage: linker obj1 [obj2 [obj3 [...]]] binary\n", 149},
- {" o Initialising the linker... ", 150},
- {"Linking files...\n", 151},
- {"Generating output file...\n", 152},
+\n", 149},
+ {"Usage: linker obj1 [obj2 [obj3 [...]]] binary\n", 150},
+ {" o Initialising the linker... ", 151},
+ {"Linking files...\n", 152},
+ {"Generating output file...\n", 153},
};
-int _msg_tbl_length = 152;
+int _msg_tbl_length = 153;
diff --git a/samples/Makefile.samples b/samples/Makefile.samples
index 35913b2..9877ae0 100644
--- a/samples/Makefile.samples
+++ b/samples/Makefile.samples
@@ -7,9 +7,10 @@
.s:
../src/compilo $< tmp.o
../src/linker tmp.o $@
+ chmod 755 $@
rm tmp.o
all: recherche rechcara sommeentiers testtout
clean:
- rm -f recherche rechcara sommeenters testtout *.o
+ rm -f recherche rechcara sommeenters testtout *.o __symbols__ __text__
diff --git a/samples/testtout.s b/samples/testtout.s
index 0c1350e..b3e0b5b 100644
--- a/samples/testtout.s
+++ b/samples/testtout.s
@@ -14,7 +14,7 @@ PROGS DD PROG1, PROG2, PROG3, 0
.text
.start
MOV R1, R0 ; R1 sera notre compteur de programme
-BOUCLE: MOV R2, PROGS[R0] ; On lit l'adresse du nom du prochain programme
+BOUCLE: MOV R2, PROGS[R1] ; On lit l'adresse du nom du prochain programme
JE R2, R0, FIN ; Si c'est l'adresse nulle, on sort
MOV, [0xffffff04], MSG1 ; On affiche le premier morceau de la chaîne
MOV, [0xffffff06], R1 ; On affiche le numéro du programme
@@ -23,9 +23,10 @@ BOUCLE: MOV R2, PROGS[R0] ; On lit l'adresse du nom du prochain programme
MOV, [0xffffff04], MSG3 ; On affiche la dernière chaîne
PUSH R1 ; On sauvegarde R1 avant
- MOV, [0xffffff0a], R1 ; On appelle le miniOS pour lui demander
+ MOV, [0xffffff0a], R2 ; On appelle le miniOS pour lui demander
; de charger un autre programme.
- POP R1 ; Et on récupère R1
+ POP R1 ; On récupère R1, ...
+ ADD R1, 1 ; .. et on l'incrémente.
MOV, [0xffffff04], MSGTERM ; On affiche la chaîne pour dire que l'on vient de sortir
JMP BOUCLE ; et on boucle
diff --git a/src/compilo.c b/src/compilo.c
index b4c44e9..12a6f05 100644
--- a/src/compilo.c
+++ b/src/compilo.c
@@ -60,8 +60,9 @@ int main(int argc, char **argv)
{
invite();
+#ifndef DEBUG
signal(SIGSEGV, segfaulthand);
-
+#endif
if (argc != 3)
usage();
diff --git a/src/simul.c b/src/simul.c
index 7b56ce1..e531150 100644
--- a/src/simul.c
+++ b/src/simul.c
@@ -18,7 +18,7 @@ void invite(void)
void usage(void)
{
- fprintf(stderr, _("Usage: linker [-q] [-d] binary\n"));
+ fprintf(stderr, _("Usage: linker [-s] [-d] binary\n"));
exit(0);
}
@@ -49,12 +49,14 @@ char * readargs(int argc, char ** argv) {
argc--;
argv++;
+
+ Rapide = 1;
while (argc) {
if (**argv == '-') {
switch ((*argv)[1]) {
- case 'q':
- Rapide = 1;
+ case 's':
+ Rapide = 0;
break;
case 'd':
debug = 1;