Ajout du PRIC
This commit is contained in:
parent
a035a534e9
commit
b6f5abf852
4 changed files with 8 additions and 4 deletions
|
@ -33,6 +33,7 @@ yyerror (char const *s)
|
|||
|
||||
"GET" { return tGET; }
|
||||
"PRI" { return tPRI; }
|
||||
"PRIC" { return tPRIC; }
|
||||
|
||||
"CALL" { return tCALL; }
|
||||
"RET" { return tRET; }
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
%token tAFC tCPY tAFCA
|
||||
%token tREAD tWR
|
||||
%token tJMP tJMF
|
||||
%token tGET tPRI
|
||||
%token tGET tPRI tPRIC
|
||||
%token tCALL tRET
|
||||
%token tSTOP
|
||||
%token<nombre> tNB
|
||||
|
@ -55,6 +55,8 @@ Instruction : tWR tNB tNB {add_instruction(WRITE, $2, $3, 0);};
|
|||
Instruction : tGET tNB {add_instruction(GET, $2, 0, 0);};
|
||||
// PRI @
|
||||
Instruction : tPRI tNB {add_instruction(PRI, $2, 0, 0);};
|
||||
// PRIC @
|
||||
Instruction : tPRIC tNB {add_instruction(PRIC, $2, 0, 0);};
|
||||
|
||||
// CALL Ins Val
|
||||
Instruction : tCALL tNB tNB {add_instruction(CALL, $2, $3, 0);};
|
||||
|
|
|
@ -187,10 +187,11 @@ void execute() {
|
|||
}
|
||||
|
||||
} else if (programme[eip].instruction == GET) {
|
||||
printf("Veuillez saisir un nombre : \n");
|
||||
scanf("%d", &(mem[check_adresse(ebp + programme[eip].param1)]));
|
||||
} else if (programme[eip].instruction == PRI) {
|
||||
printf("%d@%d\n", mem[check_adresse(ebp + programme[eip].param1)], ebp + programme[eip].param1);
|
||||
printf("%d", mem[check_adresse(ebp + programme[eip].param1)]);
|
||||
} else if (programme[eip].instruction == PRIC) {
|
||||
printf("%c", mem[check_adresse(ebp + programme[eip].param1)]);
|
||||
|
||||
} else if (programme[eip].instruction == CALL) {
|
||||
if (SECURISED) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
|
||||
// Enum of the instruction
|
||||
enum instruction_t {ADD, MUL, SUB, DIV, INF, SUP, EQU, CPY, AFC, AFCA, READ, WRITE, JMP, JMF, PRI, GET, CALL, RET, STOP};
|
||||
enum instruction_t {ADD, MUL, SUB, DIV, INF, SUP, EQU, CPY, AFC, AFCA, READ, WRITE, JMP, JMF, PRI, PRIC, GET, CALL, RET, STOP};
|
||||
|
||||
// Add a new instruction
|
||||
void add_instruction(enum instruction_t inst, int param1, int param2, int param3);
|
||||
|
|
Loading…
Reference in a new issue