Fix bug STOREA

This commit is contained in:
Paul Faure 2021-06-24 09:43:08 +02:00
parent bff261fa01
commit cf119a9a25
2 changed files with 3 additions and 3 deletions

View file

@ -48,7 +48,7 @@ Instruction : tLOADI tNB tNB {add_instruction(LOADI, $2, $3, 0);};
// STOREI R R
Instruction : tSTOREI tNB tNB {add_instruction(STOREI, $2, $3, 0);};
// STOREA @ R
Instruction : tSTOREA tNB tNB {add_instruction(STORE, $2, $3, 0);};
Instruction : tSTOREA tNB tNB {add_instruction(STOREA, $2, $3, 0);};
// JMP Ins
Instruction : tJMP tNB {add_instruction(JMP, $2, 0, 0);};

View file

@ -68,6 +68,8 @@ int Z = 0;
int check_adresse(int adresse) {
if (adresse >= TAILLE_MEMOIRE || adresse < 0) {
printf("\033[31;01m ERROR : \033[00m Segmentation fault de %d avec eip = %d et ebp = %d\n", adresse, eip, ebp);
print();
print_reg();
exit(2);
}
return adresse;
@ -238,8 +240,6 @@ void execute() {
} else if (programme[eip].instruction == STOP) {
if (programme[eip].param1 == 0) {
continuer = 0;
print();
print_reg();
}
}
eip = (eip + 1) % TAILLE_BUFFER_INSTRUCTIONS;