From 9ee8d65b5c04933861206ba9bfc18bef349228c3 Mon Sep 17 00:00:00 2001 From: DerelictDrone Date: Sun, 3 Dec 2023 03:39:09 -0600 Subject: [PATCH 1/4] Fix emits killing lua on emitted interrupt --- lua/wire/zvm/zvm_core.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wire/zvm/zvm_core.lua b/lua/wire/zvm/zvm_core.lua index 2119637..afacf59 100644 --- a/lua/wire/zvm/zvm_core.lua +++ b/lua/wire/zvm/zvm_core.lua @@ -269,7 +269,7 @@ function ZVM:Dyn_EmitInterrupt(intNo,intParam) self:Dyn_EmitState() self:Emit("VM.IP = %d",(self.PrecompileIP or 0)) self:Emit("VM.XEIP = %d",(self.PrecompileTrueXEIP or 0)) - self:Dyn_Emit("VM:Interrupt(%d,%d)",intNo,intParam) + self:Dyn_Emit("VM:Interrupt(%s,%s)",intNo,intParam) self:Dyn_EmitBreak() end From 6cb16a0178fc57939fa800abacde18f466c6ca4f Mon Sep 17 00:00:00 2001 From: DerelictDrone Date: Sun, 3 Dec 2023 18:57:10 -0600 Subject: [PATCH 2/4] Fix for CPG using idx and not IDX --- lua/wire/zvm/zvm_opcodes.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/wire/zvm/zvm_opcodes.lua b/lua/wire/zvm/zvm_opcodes.lua index ad8a235..b878b9f 100644 --- a/lua/wire/zvm/zvm_opcodes.lua +++ b/lua/wire/zvm/zvm_opcodes.lua @@ -234,11 +234,11 @@ ZVM.OpcodeTable[28] = function(self) --SPG self:Dyn_Emit("end") end ZVM.OpcodeTable[29] = function(self) --CPG - self:Dyn_Emit("$L idx = math.floor($1 / 128)") + self:Dyn_Emit("$L IDX = math.floor($1 / 128)") self:Dyn_Emit("$L PAGE = VM:GetPageByIndex(IDX)") self:Dyn_EmitInterruptCheck() - self:Dyn_Emit("if VM.CurrentPage.RunLevel <= VM.Page[idx].RunLevel then") + self:Dyn_Emit("if VM.CurrentPage.RunLevel <= VM.Page[IDX].RunLevel then") self:Dyn_Emit("PAGE.Read = 1") self:Dyn_Emit("PAGE.Write = 1") self:Dyn_Emit("VM:SetPageByIndex(IDX)") From 7053331edbe83684f387b2943582676b1fbca7bc Mon Sep 17 00:00:00 2001 From: DerelictDrone Date: Tue, 5 Dec 2023 20:08:15 -0600 Subject: [PATCH 3/4] Fix for CPG indexing VM.Page when it should index PAGE --- lua/wire/zvm/zvm_opcodes.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wire/zvm/zvm_opcodes.lua b/lua/wire/zvm/zvm_opcodes.lua index b878b9f..b70dbaf 100644 --- a/lua/wire/zvm/zvm_opcodes.lua +++ b/lua/wire/zvm/zvm_opcodes.lua @@ -238,7 +238,7 @@ ZVM.OpcodeTable[29] = function(self) --CPG self:Dyn_Emit("$L PAGE = VM:GetPageByIndex(IDX)") self:Dyn_EmitInterruptCheck() - self:Dyn_Emit("if VM.CurrentPage.RunLevel <= VM.Page[IDX].RunLevel then") + self:Dyn_Emit("if VM.CurrentPage.RunLevel <= PAGE.RunLevel then") self:Dyn_Emit("PAGE.Read = 1") self:Dyn_Emit("PAGE.Write = 1") self:Dyn_Emit("VM:SetPageByIndex(IDX)") From 50ddb8f667ace074f2d546885fa7897b548b3a89 Mon Sep 17 00:00:00 2001 From: DerelictDrone Date: Wed, 6 Dec 2023 04:37:08 -0600 Subject: [PATCH 4/4] Requested comment for dyn_emitinterrupt --- lua/wire/zvm/zvm_core.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/wire/zvm/zvm_core.lua b/lua/wire/zvm/zvm_core.lua index afacf59..db1fe38 100644 --- a/lua/wire/zvm/zvm_core.lua +++ b/lua/wire/zvm/zvm_core.lua @@ -265,6 +265,8 @@ end -------------------------------------------------------------------------------- -- Emit interrupt call +-- intNo can only be numeric or "$1" +-- intParam can only be numeric or "IDX" function ZVM:Dyn_EmitInterrupt(intNo,intParam) self:Dyn_EmitState() self:Emit("VM.IP = %d",(self.PrecompileIP or 0))