summaryrefslogtreecommitdiff
path: root/lib/simulator.c
diff options
context:
space:
mode:
authorPixel <>2001-04-17 06:55:02 +0000
committerPixel <>2001-04-17 06:55:02 +0000
commita7bc5cfa7399926941a3754e3cbdc671f24b4b3d (patch)
tree6527baa45482798b61777cae9bf84eccb44075db /lib/simulator.c
parent502e0cd237a9a474b224ab9a741fe4d91ecdec36 (diff)
Pout
Diffstat (limited to 'lib/simulator.c')
-rw-r--r--lib/simulator.c54
1 files changed, 15 insertions, 39 deletions
diff --git a/lib/simulator.c b/lib/simulator.c
index 1bfdcd2..ea3b142 100644
--- a/lib/simulator.c
+++ b/lib/simulator.c
@@ -58,8 +58,7 @@ Uint32 Adresse(Uint32 u, Uint32 instruction)
switch (champ(u, 4)) {
case 0:
- exception(1,
- _("Adresse: Call With Invalid r/m Field State ( r/m=00 )"));
+ exception(1, _("Adresse: Call With Invalid r/m Field State ( r/m=00 )"));
return (0);
case 1:
tmp = LireInstruction();
@@ -228,13 +227,10 @@ void DecodeExec(Uint32 instruction)
if (ValeurBit(Extension(instruction), 1) == 0) { /* Mov arg1 arg2 */
if (ValeurBit(Extension(instruction), 0) == 0) { /* arg2 = reg */
if (champ(Champ1(instruction), 2) == 0) { /* r/m de arg1 = 0 */
- EcrireRegistre(Champ3
- (instruction),
- LireRegistre(Champ2(instruction)));
+ EcrireRegistre(Champ3(instruction), LireRegistre(Champ2(instruction)));
} else {
ST(Adresse
- (Champ1(instruction),
- instruction), LireRegistre(Champ2(instruction)));
+ (Champ1(instruction), instruction), LireRegistre(Champ2(instruction)));
}
} else { /* arg2 = imm32 */
if (champ(Champ1(instruction), 2) == 0) { /* r/m de arg1 = 0 */
@@ -249,19 +245,14 @@ void DecodeExec(Uint32 instruction)
} else { /* mov arg2, arg1 */
if (ValeurBit(Extension(instruction), 0) == 0) { /* arg2 = reg */
if (champ(Champ1(instruction), 2) == 0) { /* r/m de arg1 = 0 */
- EcrireRegistre(Champ2
- (instruction),
- LireRegistre(Champ3(instruction)));
+ EcrireRegistre(Champ2(instruction), LireRegistre(Champ3(instruction)));
} else {
EcrireRegistre(Champ2
(instruction),
- LD(Adresse
- (Champ1(instruction), instruction)));
+ LD(Adresse(Champ1(instruction), instruction)));
}
} else { /* arg2 = imm32 */
- exception(1,
- _
- ("MOV: Memory to Memory Forbidden On This Type Of Processor"));
+ exception(1, _("MOV: Memory to Memory Forbidden On This Type Of Processor"));
}
}
fin:
@@ -279,26 +270,17 @@ void DecodeExec(Uint32 instruction)
if (Champ1(instruction) == Champ2(instruction)) {
test1 = 1;
} else {
- test1 =
- LireRegistre(Champ1
- (instruction)) ==
- LireRegistre(Champ2(instruction));
+ test1 = LireRegistre(Champ1(instruction)) == LireRegistre(Champ2(instruction));
}
break;
case 1:
- test1 =
- LireRegistre(Champ1(instruction)) !=
- LireRegistre(Champ2(instruction));
+ test1 = LireRegistre(Champ1(instruction)) != LireRegistre(Champ2(instruction));
break;
case 2:
- test1 =
- LireRegistre(Champ1(instruction)) <
- LireRegistre(Champ2(instruction));
+ test1 = LireRegistre(Champ1(instruction)) < LireRegistre(Champ2(instruction));
break;
case 3:
- test1 =
- LireRegistre(Champ1(instruction)) <=
- LireRegistre(Champ2(instruction));
+ test1 = LireRegistre(Champ1(instruction)) <= LireRegistre(Champ2(instruction));
break;
}
switch (champ(Extension(instruction) >> 2, 4)) {
@@ -348,8 +330,7 @@ void DecodeExec(Uint32 instruction)
if (ValeurBit(Extension(instruction), 0) == 0) {
/* RET */
of = LireRegistreFLAG();
- EcrireRegistreSP(AdditionNonSigne
- (LireRegistreSP(), Champ1(instruction)));
+ EcrireRegistreSP(AdditionNonSigne(LireRegistreSP(), Champ1(instruction)));
EcrireRegistreSP(AdditionNonSigne(LireRegistreSP(), 1));
EcrireRegistrePC(LD(LireRegistreSP()));
EcrireRegistreFLAG(of);
@@ -424,8 +405,7 @@ void AfficheReg(void) // affiche reg
fprintf(stderr, "\n");
}
fprintf(stderr, "Rg: %08lX | Rd: %08lX | Flag: %08lX | PC: %08lX\n",
- LireRegistreRG(), LireRegistreRD(), LireRegistreFLAG(),
- LireRegistrePC());
+ LireRegistreRG(), LireRegistreRD(), LireRegistreFLAG(), LireRegistrePC());
}
void Debogueur(void)
@@ -441,8 +421,7 @@ void Debogueur(void)
Opcode(instruction), Extension(instruction),
Champ1(instruction), Champ2(instruction), Champ3(instruction));
fprintf(stderr, "%08lX:%08lX - %08lX - %08lX > ",
- LireRegistrePC(), instruction, LD(LireRegistrePC() + 1),
- LD(LireRegistrePC() + 2));
+ LireRegistrePC(), instruction, LD(LireRegistrePC() + 1), LD(LireRegistrePC() + 2));
switch (fgetc(input)) {
case 'G':
@@ -464,9 +443,7 @@ void Debogueur(void)
clearterm();
exception(1, _("Shutdown requested"));
default:
- fprintf(stderr,
- _
- ("Help:\nG: go\nP: Proceed\nR: display registers\nQ: quit\n"));
+ fprintf(stderr, _("Help:\nG: go\nP: Proceed\nR: display registers\nQ: quit\n"));
}
}
}
@@ -528,8 +505,7 @@ void ChargeBinaire(char *filename)
}
for (i = 0; i < nr; i++) { /* relogement */
- ST(base_addr + relocation_table[i],
- LD(base_addr + relocation_table[i]) + base_addr);
+ ST(base_addr + relocation_table[i], LD(base_addr + relocation_table[i]) + base_addr);
}
free(relocation_table);