Skip to content

Commit

Permalink
LOOPXY now works.
Browse files Browse the repository at this point in the history
  • Loading branch information
DerelictDrone committed Nov 24, 2023
1 parent a00b47a commit cdfbd06
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lua/wire/cpulib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
15 changes: 13 additions & 2 deletions lua/wire/zvm/zvm_opcodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cdfbd06

Please sign in to comment.