summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPixel <>2001-05-14 08:55:15 +0000
committerPixel <>2001-05-14 08:55:15 +0000
commitff1f5fcda29d65c4149f09ffb3359d9373dfa948 (patch)
treebb711e7e160b4a4d1b9b7fc5f1d43179553883e4 /lib
parentbc04f8913f205bbe0baafb6d286c8c569d1768cd (diff)
Pouet
Diffstat (limited to 'lib')
-rw-r--r--lib/registre.c4
-rw-r--r--lib/simulator.c22
2 files changed, 20 insertions, 6 deletions
diff --git a/lib/registre.c b/lib/registre.c
index 82ecfdd..8f86951 100644
--- a/lib/registre.c
+++ b/lib/registre.c
@@ -111,12 +111,16 @@ void EcrireRegistre(Uint32 champ_registre, Uint32 valeur)
switch (champ(champ_registre, 4)) {
case 0:
EcrireRegistreRG(valeur);
+ break;
case 1:
EcrireRegistreRD(valeur);
+ break;
case 2:
EcrireRegistrePC(valeur);
+ break;
case 3:
EcrireRegistreFLAG(valeur);
+ break;
default:
exception(1, _("Invalid Register Descriptor"));
}
diff --git a/lib/simulator.c b/lib/simulator.c
index 1438143..7cb764b 100644
--- a/lib/simulator.c
+++ b/lib/simulator.c
@@ -99,7 +99,7 @@ void Flush(void)
void DecodeExec(Uint32 instruction)
{
Uint32 champ_registre_resultat, val1, val2, resultat;
- int test1, test2;
+ int test1, test2, i;
Uint32 val, of; /* valeur qui va etre stockée */
@@ -118,7 +118,7 @@ void DecodeExec(Uint32 instruction)
/* ALU */
champ_registre_resultat = Champ1(instruction); /* Champ du registre dans lequel va etre stocké le résultat */
val1 = LireRegistre(Champ2(instruction)); /* Premier entier qui va etre utilisé dans l'opération */
- if (Opcode(instruction) < 6) {
+ if (Opcode(instruction) < 8) {
if (ValeurBit(Extension(instruction), 0) == 0)
val2 = LireRegistre(Champ3(instruction)); /* Deuxième entier, stocké dans un registre, qui va etre utilisé dans l'opération */
else {
@@ -147,10 +147,16 @@ void DecodeExec(Uint32 instruction)
resultat = OR(val1, val2);
break;
case 6:
- resultat = SHL(val1);
+ for (resultat = val1; val2; val2--) {
+ fprintf(stderr, "Doing shl... (%i)\n", val2);
+ resultat = SHL(resultat);
+ }
break;
case 7:
- resultat = SHR(val1);
+ for (resultat = val1; val2; val2--) {
+ fprintf(stderr, "Doing shr...\n");
+ resultat = SHR(resultat);
+ }
break;
}
} else {
@@ -174,10 +180,14 @@ void DecodeExec(Uint32 instruction)
resultat = OR(val1, val2);
break;
case 6:
- resultat = SHL(val1);
+ for (resultat = val1; val2; val2--) {
+ resultat = SHL(resultat);
+ }
break;
case 7:
- resultat = SHR(val1);
+ for (resultat = val1; val2; val2--) {
+ resultat = SHR(resultat);
+ }
break;
}
}