diff --git a/cpu.c b/cpu.c index a04e1f6..e07966c 100644 --- a/cpu.c +++ b/cpu.c @@ -245,88 +245,37 @@ void decode_instruction(uint16_t opcode, uint16_t *arg1, uint16_t *arg2, uint16_ switch(opcode) { case HALT: - break; - case MOV: - *arg1 = fetch(); - *arg2 = fetch(); + case RET: + case NOP: break; case PUSH: - *arg1 = fetch(); - break; case POP: - *arg1 = fetch(); - break; - case TEQ: - *arg1 = fetch(); - *arg2 = fetch(); - *arg3 = fetch(); - break; - case TGT: - *arg1 = fetch(); - *arg2 = fetch(); - *arg3 = fetch(); - break; case JMP: + case CALL: + case OUT: + case IN: *arg1 = fetch(); break; + case MOV: case JNZ: - *arg1 = fetch(); - *arg2 = fetch(); - break; case JZ: + case NOT: + case LOAD: + case STOR: *arg1 = fetch(); *arg2 = fetch(); break; + case TEQ: + case TGT: case ADD: - *arg1 = fetch(); - *arg2 = fetch(); - *arg3 = fetch(); - break; case MUL: - *arg1 = fetch(); - *arg2 = fetch(); - *arg3 = fetch(); - break; case MOD: - *arg1 = fetch(); - *arg2 = fetch(); - *arg3 = fetch(); - break; case AND: - *arg1 = fetch(); - *arg2 = fetch(); - *arg3 = fetch(); - break; case OR: *arg1 = fetch(); *arg2 = fetch(); *arg3 = fetch(); break; - case NOT: - *arg1 = fetch(); - *arg2 = fetch(); - break; - case LOAD: - *arg1 = fetch(); - *arg2 = fetch(); - break; - case STOR: - *arg1 = fetch(); - *arg2 = fetch(); - break; - case CALL: - *arg1 = fetch(); - break; - case RET: - break; - case OUT: - *arg1 = fetch(); - break; - case IN: - *arg1 = fetch(); - break; - case NOP: - break; default: break; }