summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/alu.c8
-rw-r--r--lib/simulator.c25
-rw-r--r--po/ProjetArchi.pot26
-rw-r--r--samples/Makefile.samples2
-rw-r--r--samples/testtout.s9
5 files changed, 42 insertions, 28 deletions
diff --git a/lib/alu.c b/lib/alu.c
index 4ff01f3..0adac7d 100644
--- a/lib/alu.c
+++ b/lib/alu.c
@@ -32,9 +32,9 @@ Uint32 RAdditionNonSigne(Uint32 a, Uint32 b)
}
if (tr) {
- SetZero();
- } else {
ResetZero();
+ } else {
+ SetZero();
}
if (tr & 1) {
@@ -60,9 +60,9 @@ Uint32 RAdditionSigne(long int a, long int b)
}
if (tr) {
- SetZero();
- } else {
ResetZero();
+ } else {
+ SetZero();
}
if (tr & 1) {
diff --git a/lib/simulator.c b/lib/simulator.c
index 40c3431..729e379 100644
--- a/lib/simulator.c
+++ b/lib/simulator.c
@@ -25,7 +25,9 @@ Uint32 LireInstruction(void)
void IncrementeCompteurOrdinal(void)
{
+ Uint32 of = LireRegistreFLAG();
EcrireRegistrePC(AdditionNonSigne(LireRegistrePC(), 1));
+ EcrireRegistreFLAG(of);
}
static FILE *openfilereading(char *name)
@@ -96,7 +98,7 @@ void DecodeExec(Uint32 instruction)
{
Uint32 champ_registre_resultat, val1, val2, resultat;
int test1, test2;
- Uint32 val; /* valeur qui va etre stockée */
+ Uint32 val, of; /* valeur qui va etre stockée */
if (Opcode(instruction) & 0x80) {
@@ -323,22 +325,30 @@ void DecodeExec(Uint32 instruction)
case 13:
if (ValeurBit(Extension(instruction), 0) == 0) {
/* RET */
+ of = LireRegistreFLAG();
EcrireRegistreSP(AdditionNonSigne(LireRegistreSP(), Champ1(instruction)));
EcrireRegistreSP(AdditionNonSigne(LireRegistreSP(), 1));
EcrireRegistrePC(LD(LireRegistreSP()));
+ EcrireRegistreFLAG(of);
} else if (ValeurBit(Extension(instruction), 1) == 0) { /* JMP */
- if (ValeurBit(Extension(instruction), 2) == 0) {
+ if (ValeurBit(Extension(instruction), 2) != 0) {
EcrireRegistrePC(LireRegistre(Champ1(instruction)));
} else {
EcrireRegistrePC(LireInstruction());
}
} else { /* CALL */
- ST(LireRegistreSP(), LireRegistrePC());
- EcrireRegistreSP(SoustractionNonSigne(LireRegistreSP(), 1));
- if (ValeurBit(Extension(instruction), 2) == 0) {
+ if (ValeurBit(Extension(instruction), 2) != 0) {
+ ST(LireRegistreSP(), LireRegistrePC());
+ of = LireRegistreFLAG();
+ EcrireRegistreSP(SoustractionNonSigne(LireRegistreSP(), 1));
+ EcrireRegistreFLAG(of);
EcrireRegistrePC(LireRegistre(Champ1(instruction)));
} else {
+ ST(LireRegistreSP(), LireRegistrePC() + 1);
+ of = LireRegistreFLAG();
+ EcrireRegistreSP(SoustractionNonSigne(LireRegistreSP(), 1));
+ EcrireRegistreFLAG(of);
EcrireRegistrePC(LireInstruction());
}
}
@@ -352,12 +362,15 @@ void DecodeExec(Uint32 instruction)
IncrementeCompteurOrdinal();
}
ST(LireRegistreSP(), val);
+ of = LireRegistreFLAG();
EcrireRegistreSP(SoustractionNonSigne(LireRegistreSP(), 1));
+ EcrireRegistreFLAG(of);
break;
case 15: /* POP */
+ of = LireRegistreFLAG();
EcrireRegistreSP(AdditionNonSigne(LireRegistreSP(), 1));
EcrireRegistre(Champ1(instruction), LD(LireRegistreSP()));
-
+ EcrireRegistreFLAG(of);
break;
case 127: /* HALT-RESET */
if (ValeurBit(Extension(instruction), 0) == 0) {
diff --git a/po/ProjetArchi.pot b/po/ProjetArchi.pot
index 79dfdac..43bae4f 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 05:14+0200\n"
+"POT-Creation-Date: 2001-04-17 05:46+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"
@@ -191,7 +191,7 @@ msgid "Error writing file"
msgstr ""
#: lib/assembler.c:1799 lib/assembler.c:2187 lib/linker.c:56
-#: lib/simulator.c:37
+#: lib/simulator.c:39
msgid "Error reading file"
msgstr ""
@@ -458,7 +458,7 @@ msgstr ""
msgid "Invalid Register Descriptor"
msgstr ""
-#: lib/linker.c:76 lib/simulator.c:47
+#: lib/linker.c:76 lib/simulator.c:49
msgid "premature end of file"
msgstr ""
@@ -522,28 +522,28 @@ msgstr ""
msgid "Output file size: %i words containing %i relocating offsets.\n"
msgstr ""
-#: lib/simulator.c:58
+#: lib/simulator.c:60
msgid "Adresse: Call With Invalid r/m Field State ( r/m=00 )"
msgstr ""
-#: lib/simulator.c:71
+#: lib/simulator.c:73
msgid "Adresse: Unmatched Addr Field"
msgstr ""
#. arg2 = imm32
-#: lib/simulator.c:249
+#: lib/simulator.c:251
msgid "MOV: Memory to Memory Forbidden On This Type Of Processor"
msgstr ""
-#: lib/simulator.c:371
+#: lib/simulator.c:384
msgid "DecodeExec: Invalid Opcode"
msgstr ""
-#: lib/simulator.c:425
+#: lib/simulator.c:438
msgid "Shutdown requested"
msgstr ""
-#: lib/simulator.c:427
+#: lib/simulator.c:440
msgid ""
"Help:\n"
"G: go\n"
@@ -552,22 +552,22 @@ msgid ""
"Q: quit\n"
msgstr ""
-#: lib/simulator.c:460
+#: lib/simulator.c:473
#, c-format
msgid "Opening file %s"
msgstr ""
#. verification de la signature
-#: lib/simulator.c:464
+#: lib/simulator.c:477
msgid "Invalid Signature"
msgstr ""
-#: lib/simulator.c:468
+#: lib/simulator.c:481
#, c-format
msgid "Loading file %s"
msgstr ""
-#: lib/simulator.c:502
+#: lib/simulator.c:515
#, c-format
msgid "Executing file %s"
msgstr ""
diff --git a/samples/Makefile.samples b/samples/Makefile.samples
index 9877ae0..7d004ca 100644
--- a/samples/Makefile.samples
+++ b/samples/Makefile.samples
@@ -10,7 +10,7 @@
chmod 755 $@
rm tmp.o
-all: recherche rechcara sommeentiers testtout
+all: hello recherche rechcara sommeentiers testtout
clean:
rm -f recherche rechcara sommeenters testtout *.o __symbols__ __text__
diff --git a/samples/testtout.s b/samples/testtout.s
index b3e0b5b..f8bbdbf 100644
--- a/samples/testtout.s
+++ b/samples/testtout.s
@@ -1,7 +1,8 @@
.data
-PROG1 DS "sommeentiers"
-PROG2 DS "rechcara"
-PROG3 DS "recherche"
+PROG1 DS "hello"
+PROG2 DS "sommeentiers"
+PROG3 DS "rechcara"
+PROG4 DS "recherche"
MSG1 DS "Exécution du programme numéro "
MSG2 DS " appelé "
@@ -9,7 +10,7 @@ MSG3 DS "...\n"
MSGTERM DS "Le programme s'est terminé!\n"
MSGFIN DS "Tout est terminé, bye!\n"
-PROGS DD PROG1, PROG2, PROG3, 0
+PROGS DD PROG1, PROG2, PROG3, PROG4, 0
.text
.start