diff --git a/mars_main.c b/mars_main.c index 764589f..f429280 100644 --- a/mars_main.c +++ b/mars_main.c @@ -101,7 +101,29 @@ void execute_instruction(union mars_instruction instruction, int player, struct int premiere_valeur; int first_pos, next_pos; union mars_instruction first_instruction, next_instruction; - + if (instruction.instruct.modeAddrA == IMMEDIAT){ + premiere_valeur = instruction.instruct.ArgA; + } else { + first_pos = calculer_position(position, instruction.instruct.modeAddrA, instruction.instruct.ArgA, memoire); + first_instruction.instructLL = memoire[first_pos].instruction; + if(first_instruction.instruct.codeOp == DAT){ + premiere_valeur = first_instruction.instruct.ArgB; + } else { + /* Instruction a raté, peut on dire que c'est un fail ? */ + } + } + + next_pos = calculer_position(position, instruction.instruct.modeAddrB, instruction.instruct.ArgB, memoire); + next_instruction.instructLL = memoire[next_pos].instruction; + + if (next_instruction.instruct.codeOp == DAT){ + next_instruction.instruct.ArgB += premiere_valeur; + memoire[next_pos].instruction = next_instruction.instructLL; + memoire[next_pos].player = player; + } else { + /* L'instruction a raté, peut-on dire que c'est pas bien ?*/ + } + } case JMP: { short int modeadresse = instruction.instruct.modeAddrA;