diff --git a/lua/wire/cpulib.lua b/lua/wire/cpulib.lua index 8879e10..ef31a9c 100644 --- a/lua/wire/cpulib.lua +++ b/lua/wire/cpulib.lua @@ -1082,8 +1082,8 @@ VEX(255, "VMOV", 2, 7.00, 0, "VEC", "VEC", "X = Y") VEX(256, "VNORM", 2, 7.00, 0, "VEC", "VEC", "X = NORMALIZE(Y)") VEX(257, "VCOLORNORM", 2, 10.0, 0, "COLOR", "COLOR", "Normalize color (clamp it to RGB range)") GPU(258, "RESERVED", 2, 0.0, 0, "", "", "") -GPU(259, "DLOOPXY", 2, 0.7, CB, "PTR", "PTR", "2D loop by ECX/EDX registers") -VEX(259, "LOOPXY", 2, 10.0, CB, "PTR", "PTR", "2D loop by ECX/EDX registers") +GPU(259, "DLOOPXY", 2, 0.7, CB, "PTR", "PTR", "2D loop by ECX/EDX registers, where on EDX = -1 it will decrement ECX and jump to ptr 1, else it will decrement EDX and jump to ptr 2 until ECX = -1") +VEX(259, "LOOPXY", 2, 10.0, CB, "PTR", "PTR", "2D loop by ECX/EDX registers, where on EDX = -1 it will decrement ECX and jump to ptr 1, else it will decrement EDX and jump to ptr 2 until ECX = -1") ---- Dec 26 -- Matrix math ---------------------------------------------------------------------------------------------------------------------- VEX(260, "MADD", 2, 7.00, 0, "MATRIX","MATRIX","X = X + Y") VEX(261, "MSUB", 2, 7.00, 0, "MATRIX","MATRIX","X = X - Y") diff --git a/lua/wire/zvm/zvm_opcodes.lua b/lua/wire/zvm/zvm_opcodes.lua index 069aea8..7b37ae3 100644 --- a/lua/wire/zvm/zvm_opcodes.lua +++ b/lua/wire/zvm/zvm_opcodes.lua @@ -1358,8 +1358,19 @@ end ZVM.OpcodeTable[259] = function(self) --LOOPXY self:Dyn_EmitForceRegisterLocal("ECX") self:Dyn_EmitForceRegisterLocal("EDX") - --- self:Dyn_Emit(" + self:Dyn_Emit("EDX = EDX - 1") + self:Dyn_Emit("if EDX ~= -1 then") + self:Dyn_Emit("VM:Jump($2)") + self:Dyn_EmitState() + self:Dyn_EmitBreak() + self:Dyn_Emit("else") + self:Dyn_Emit("ECX = ECX - 1") + self:Dyn_Emit("if ECX ~= -1 then") + self:Dyn_Emit("VM:Jump($1)") + self:Dyn_EmitState() + self:Dyn_EmitBreak() + self:Dyn_Emit("end") + self:Dyn_Emit("end") end -------------------------------------------------------------------------------- ZVM.OpcodeTable[260] = function(self) --MADD