LIVM/xfcase.c
2022-01-23 23:28:53 +07:00

58 lines
1.6 KiB
C

// what is a template/generic?
switch (op) {
case NOP: break;
case END: break;
case LDA: a = xram[arg]; break;
case LDB: b = xram[arg]; break;
case LDC: c = xram[arg]; break;
case ULA: xram[arg] = (xtype) a; break;
case ULB: xram[arg] = (xtype) b; break;
case ULC: xram[arg] = (xtype) c; break;
case CST:
switch (arg) {
case 0: break;
case 1: a = (uint8_t) a; break;
case 2: a = (int8_t) a; break;
case 3: a = (uint16_t) a; break;
case 4: a = (int16_t) a; break;
case 5: a = (uint32_t) a; break;
case 6: a = (int32_t) a; break;
case 7: a = (uint64_t) a; break;
case 8: a = (int64_t) a; break;
case 9: a = (float) a; break;
case 10: a = (double) a; break;
};
break;
case SSM: size_mode = arg; mode_int = 0; break;
case JMP: ip = a; break;
case IVE: if (c) ip = arg; break;
case SLE: if (!c) ip = arg; break;
case SIP: a = ip; break;
case SUB: a -= b; break;
case SUM: a += b; break;
case MUL: a *= b; break;
case DIV: a /= b; break;
case MOD: a %= b; break;
case POW: a = pow(a, b); break;
case INC: c++; break;
case DEC: c--; break;
case AND: a &= b; break;
case BOR: a |= b; break;
case XOR: a ^= b; break;
case NOT: a = !a; break;
case EQU: a = a == b; break;
case LTH: a = a < b; break;
case GTH: a = a > b; break;
case OFR: vm_dev[arg]->offer(a, b, c); break;
case WAI: vm_dev[arg]->wait(a, b, c); break;
case OUT: vm_dev[arg]->out(a, b, c); break;
case REA: a = vm_dev[arg]->read(a, b, c); break;
case ALC: break;
case RLC: break;
case FRE: break;
case CPY: break;
case ADD: break;
case CAT: break;
case PRC: break;
}
ip += 2;