From 122c5a91a71a0dd5e3494b84434db836164324f6 Mon Sep 17 00:00:00 2001 From: Erick Date: Fri, 4 Feb 2022 01:58:28 +0100 Subject: [PATCH] add jump register --- tyvm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tyvm.c b/tyvm.c index 784969e..dfdd0f9 100644 --- a/tyvm.c +++ b/tyvm.c @@ -64,7 +64,7 @@ enum opcodes { // [name, value] OP_NOT, // bitwise not, OP_LDI, // indirect load, 1010 OP_STI, // indirect store, - OP_JMP, // jump, + OP_JMP, // jump, 1100 OP_RES, // reserved opcode, OP_LEA, // load effective address, OP_TRAP, // execute trap, @@ -195,7 +195,12 @@ int main(int argc, const char* argv[]) { //{STI}; break; case OP_JMP: - //{JMP}; + uint16_t BaseR = (instr >> 6) & 0x7; + + reg[RG_PC] = reg[BaseR]; + + update_flags(dr); + break; case OP_LEA: //{LEA};