/* Process 2OP Integer instructions */ bool eval_2OP_Int(struct lilith* vm, struct Instruction* c) { #ifdef DEBUG char Name[20] = "ILLEGAL_2OP"; #endif switch(c->raw_XOP) { case 0x0000: /* NEG */ { #ifdef DEBUG strncpy(Name, "NEG", 19); #elif TRACE record_trace("NEG"); #endif NEG(vm, c); break; } case 0x0001: /* ABS */ { #ifdef DEBUG strncpy(Name, "ABS", 19); #elif TRACE record_trace("ABS"); #endif ABS(vm, c); break; } case 0x0002: /* NABS */ { #ifdef DEBUG strncpy(Name, "NABS", 19); #elif TRACE record_trace("NABS"); #endif NABS(vm, c); break; } case 0x0003: /* SWAP */ { #ifdef DEBUG strncpy(Name, "SWAP", 19); #elif TRACE record_trace("SWAP"); #endif SWAP(vm, c); break; } case 0x0004: /* COPY */ { #ifdef DEBUG strncpy(Name, "COPY", 19); #elif TRACE record_trace("COPY"); #endif COPY(vm, c); break; } case 0x0005: /* MOVE */ { #ifdef DEBUG strncpy(Name, "MOVE", 19); #elif TRACE record_trace("MOVE"); #endif MOVE(vm, c); break; } case 0x0006: /* NOT */ { #ifdef DEBUG strncpy(Name, "NOT", 19); #elif TRACE record_trace("NOT"); #endif NOT(vm, c); break; } case 0x0100: /* BRANCH */ { #ifdef DEBUG strncpy(Name, "BRANCH", 19); #elif TRACE record_trace("BRANCH"); #endif BRANCH(vm, c); break; } case 0x0101: /* CALL */ { #ifdef DEBUG strncpy(Name, "CALL", 19); #elif TRACE record_trace("CALL"); #endif CALL(vm, c); break; } case 0x0200: /* PUSHR */ { #ifdef DEBUG strncpy(Name, "PUSHR", 19); #elif TRACE record_trace("PUSHR"); #endif PUSHR(vm, c); break; } case 0x0201: /* PUSH8 */ { #ifdef DEBUG strncpy(Name, "PUSH8", 19); #elif TRACE record_trace("PUSH8"); #endif PUSH8(vm, c); break; } case 0x0202: /* PUSH16 */ { #ifdef DEBUG strncpy(Name, "PUSH16", 19); #elif TRACE record_trace("PUSH16"); #endif PUSH16(vm, c); break; } case 0x0203: /* PUSH32 */ { #ifdef DEBUG strncpy(Name, "PUSH32", 19); #elif TRACE record_trace("PUSH32"); #endif PUSH32(vm, c); break; } case 0x0280: /* POPR */ { #ifdef DEBUG strncpy(Name, "POPR", 19); #elif TRACE record_trace("POPR"); #endif POPR(vm, c); break; } case 0x0281: /* POP8 */ { #ifdef DEBUG strncpy(Name, "POP8", 19); #elif TRACE record_trace("POP8"); #endif POP8(vm, c); break; } case 0x0282: /* POPU8 */ { #ifdef DEBUG strncpy(Name, "POPU8", 19); #elif TRACE record_trace("POPU8"); #endif POPU8(vm, c); break; } case 0x0283: /* POP16 */ { #ifdef DEBUG strncpy(Name, "POP16", 19); #elif TRACE record_trace("POP16"); #endif POP16(vm, c); break; } case 0x0284: /* POPU16 */ { #ifdef DEBUG strncpy(Name, "POPU16", 19); #elif TRACE record_trace("POPU16"); #endif POPU16(vm, c); break; } case 0x0285: /* POP32 */ { #ifdef DEBUG strncpy(Name, "POP32", 19); #elif TRACE record_trace("POP32"); #endif POP32(vm, c); break; } case 0x0286: /* POPU32 */ { #ifdef DEBUG strncpy(Name, "POPU32", 19); #elif TRACE record_trace("POPU32"); #endif POPU32(vm, c); break; } case 0x0300: /* CMPSKIP.G */ { #ifdef DEBUG strncpy(Name, "CMPSKIP.G", 19); #elif TRACE record_trace("CMPSKIP.G"); #endif CMPSKIP_G(vm, c); break; } case 0x0301: /* CMPSKIP.GE */ { #ifdef DEBUG strncpy(Name, "CMPSKIP.GE", 19); #elif TRACE record_trace("CMPSKIP.GE"); #endif CMPSKIP_GE(vm, c); break; } case 0x0302: /* CMPSKIP.E */ { #ifdef DEBUG strncpy(Name, "CMPSKIP.E", 19); #elif TRACE record_trace("CMPSKIP.E"); #endif CMPSKIP_E(vm, c); break; } case 0x0303: /* CMPSKIP.NE */ { #ifdef DEBUG strncpy(Name, "CMPSKIP.NE", 19); #elif TRACE record_trace("CMPSKIP.NE"); #endif CMPSKIP_NE(vm, c); break; } case 0x0304: /* CMPSKIP.LE */ { #ifdef DEBUG strncpy(Name, "CMPSKIP.LE", 19); #elif TRACE record_trace("CMPSKIP.LE"); #endif CMPSKIP_LE(vm, c); break; } case 0x0305: /* CMPSKIP.L */ { #ifdef DEBUG strncpy(Name, "CMPSKIP.L", 19); #elif TRACE record_trace("CMPSKIP.L"); #endif CMPSKIP_L(vm, c); break; } case 0x0380: /* CMPSKIPU.G */ { #ifdef DEBUG strncpy(Name, "CMPSKIPU.G", 19); #elif TRACE record_trace("CMPSKIPU.G"); #endif CMPSKIPU_G(vm, c); break; } case 0x0381: /* CMPSKIPU.GE */ { #ifdef DEBUG strncpy(Name, "CMPSKIPU.GE", 19); #elif TRACE record_trace("CMPSKIPU.GE"); #endif CMPSKIPU_GE(vm, c); break; } case 0x0384: /* CMPSKIPU.LE */ { #ifdef DEBUG strncpy(Name, "CMPSKIPU.LE", 19); #elif TRACE record_trace("CMPSKIPU.LE"); #endif CMPSKIPU_LE(vm, c); break; } case 0x0385: /* CMPSKIPU.L */ { #ifdef DEBUG strncpy(Name, "CMPSKIPU.L", 19); #elif TRACE record_trace("CMPSKIPU.L"); #endif CMPSKIPU_L(vm, c); break; } default: { illegal_instruction(vm, c); break; } } #ifdef DEBUG fprintf(stdout, "# %s reg%u reg%u\n", Name, c->reg0, c->reg1); #endif return false; }
void op_rts(cpu_state_t *cpu, uint8_t mode) { uint16_t retadr = POP16(cpu); cpu->pc = retadr + 1; }