summaryrefslogtreecommitdiff
path: root/lib/simulator.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/simulator.c')
-rw-r--r--lib/simulator.c22
1 files changed, 16 insertions, 6 deletions
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;
}
}