summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPixel <>2001-04-16 19:47:30 +0000
committerPixel <>2001-04-16 19:47:30 +0000
commitec9c43fb3ffdfc7331f457b93b7f76e96b555e50 (patch)
tree2fdbb671c4f34d53ae41b3ff394102780d3a691e /lib
parentd57bbfb2967f145d93b1d309f373a28d309c5a1e (diff)
Indentation
Diffstat (limited to 'lib')
-rw-r--r--lib/simulator.c90
1 files changed, 45 insertions, 45 deletions
diff --git a/lib/simulator.c b/lib/simulator.c
index 64a2aff..d00a528 100644
--- a/lib/simulator.c
+++ b/lib/simulator.c
@@ -24,7 +24,7 @@
int HasToRun = 1, HasToReset;
-Uint32 base_addr = 0;
+Uint32 base_addr = 0;
Uint32 LireInstruction(void)
@@ -68,15 +68,15 @@ void Initialisation(void)
for (i = 0; i < TAILLE_MEMOIRE; i++)
Reset(&memoire_principale[i]);
- InitRegistres(); /* initialisation des registres */
- EcrireRegistreSP(ADD_SP); /* initialisation du stack pointer */
+ InitRegistres(); /* initialisation des registres */
+ EcrireRegistreSP(ADD_SP); /* initialisation du stack pointer */
}
void DecodeExec(Uint32 instruction, Uint32 entrypoint)
{
Uint32 champ_registre_resultat, val1, val2, resultat;
int test1, test2;
- Uint32 val; /* valeur qui va etre stockée */
+ Uint32 val; /* valeur qui va etre stockée */
if (Opcode(instruction) & 0x80) {
fpu(Opcode(instruction));
@@ -101,7 +101,7 @@ void DecodeExec(Uint32 instruction, Uint32 entrypoint)
IncrementeCompteurOrdinal();
}
}
- if (ValeurBit(Extension(instruction), 1) == 0) {/* Teste si l'opération est signée ou pas */
+ if (ValeurBit(Extension(instruction), 1) == 0) { /* Teste si l'opération est signée ou pas */
switch (Opcode(instruction)) {
case 0:
resultat = AdditionNonSigne(val1, val2);
@@ -127,7 +127,7 @@ void DecodeExec(Uint32 instruction, Uint32 entrypoint)
case 7:
resultat = SHR(val1);
break;
- }
+ }
} else {
switch (Opcode(instruction)) {
case 0:
@@ -286,8 +286,8 @@ void DecodeExec(Uint32 instruction, Uint32 entrypoint)
}
if (test1) {
Uint32 tmp;
-
-
+
+
tmp = LireInstruction();
if (Opcode(instruction) & 1) {
tmp += LireRegistrePC();
@@ -340,7 +340,7 @@ void DecodeExec(Uint32 instruction, Uint32 entrypoint)
if (ValeurBit(Extension(instruction), 0)) {
HasToRun = 0; /* Halt */
} else {
- HasToReset = 1; /* Reset */
+ HasToReset = 1; /* Reset */
ResetRegistres();
}
break;
@@ -389,56 +389,56 @@ void Debogueur(void)
AfficheReg();
}
-void ChargeBinaire(char * filename)
+void ChargeBinaire(char *filename)
{
-FILE * file;
-char message[BUFSIZ];
-Uint32 entrypoint, nb, ns, nbss, nr;
-Uint32 * relocation_table;
-int i;
-
-file = openfilereading(filename);
-if (readword(file)==0x58454e4e) { /*verification de la signature*/
-sprintf(message,_("Total Size Of The Binary File: %d"),readword(file));
-pushcontext(message);
-nb=readword(file); /* taille du segment text */
-ns=readword(file); /* taille des donnes statiques */
-nbss=readword(file); /* taille des donnees non init */
-nr=readword(file); /* taille de la table de relogement */
-
-relocation_table=Emalloc(nr);
-for (i=0;i<nr;i++) {
- relocation_table[i]=readword(file);
-}
+ FILE *file;
+ char message[BUFSIZ];
+ Uint32 entrypoint, nb, ns, nbss, nr;
+ Uint32 *relocation_table;
+ int i;
+ file = openfilereading(filename);
+ if (readword(file) == 0x58454e4e) { /*verification de la signature */
+ sprintf(message, _("Total Size Of The Binary File: %d"), readword(file));
+ pushcontext(message);
+ nb = readword(file); /* taille du segment text */
+ ns = readword(file); /* taille des donnes statiques */
+ nbss = readword(file); /* taille des donnees non init */
+ nr = readword(file); /* taille de la table de relogement */
+
+ relocation_table = Emalloc(nr);
+ for (i = 0; i < nr; i++) {
+ relocation_table[i] = readword(file);
+ }
-for(i=base_addr;i<(base_addr+nb+ns);i++) { /*chargement en ram de .text et .data */
- ST(i,readword(file));
-}
-
-for (i=0;i<nr;i++) { /* relogement */
- ST(base_addr+relocation_table[i],LD(base_addr+relocation_table[i])+base_addr);
-}
-
-free(relocation_table);
-InitRegistres(); /* initialisation des registres */
-EcrireRegistreSP(ADD_SP); /* initialisation du stack pointer */
+ for (i = base_addr; i < (base_addr + nb + ns); i++) { /*chargement en ram de .text et .data */
+ ST(i, readword(file));
+ }
+
+ for (i = 0; i < nr; i++) { /* relogement */
+ ST(base_addr + relocation_table[i], LD(base_addr + relocation_table[i]) + base_addr);
+ }
-EcrireRegistrePC(LireRegistrePC()+base_addr); /* maj de PC */
+ free(relocation_table);
-base_addr+=nb+ns+nbss;
-fclose(file);
+ InitRegistres(); /* initialisation des registres */
+ EcrireRegistreSP(ADD_SP); /* initialisation du stack pointer */
+ EcrireRegistrePC(LireRegistrePC() + base_addr); /* maj de PC */
+ base_addr += nb + ns + nbss;
+ fclose(file);
-}
+ }
+
-} \ No newline at end of file
+
+}