Fix bug with imm16 processing

This commit is contained in:
2026-07-16 19:18:49 +10:00
parent c5fc6a8493
commit ba4121b6c4

View File

@@ -83,7 +83,8 @@ Instruction decodeInstruction(Memory* m, uint32_t* pc) {
case OP_IMM16: { // the immediate 16 takes up the space where the next instruction would be
(*pc) += sizeof(SerializedInst);
uint16_t nextDataOver = m->data[*pc];
uint16_t nextDataOver;
memcpy(&nextDataOver, &m->data[*pc], sizeof(uint16_t));
outputInst.immediate = nextDataOver;
outputInst.hasImm16 = true;
break;