Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish implementation of LOOPXY #23

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -255,7 +255,7 @@
end
ZVM.OpcodeTable[31] = function(self) --CALL
self:Dyn_EmitForceRegisterGlobal("ESP")
self:Dyn_Emit("if VM:Push("..self.PrecompileIP..") then")

Check warning on line 258 in lua/wire/zvm/zvm_opcodes.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator

Check warning on line 258 in lua/wire/zvm/zvm_opcodes.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator
self:Dyn_Emit("VM:Jump($1)")
self:Dyn_EmitState()
self:Dyn_EmitBreak()
Expand Down Expand Up @@ -457,8 +457,8 @@
--------------------------------------------------------------------------------
ZVM.OpcodeTable[70] = function(self) --EXTINT
self:Dyn_EmitState()
self:Emit("VM.IP = "..(self.PrecompileIP or 0))

Check warning on line 460 in lua/wire/zvm/zvm_opcodes.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator
self:Emit("VM.XEIP = "..(self.PrecompileTrueXEIP or 0))

Check warning on line 461 in lua/wire/zvm/zvm_opcodes.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator
self:Dyn_Emit("VM:ExternalInterrupt(math.floor($1))")
self:Dyn_EmitBreak()
self.PrecompileBreak = true
Expand All @@ -466,7 +466,7 @@
ZVM.OpcodeTable[71] = function(self) --CNE
self:Dyn_EmitForceRegisterGlobal("ESP")
self:Dyn_Emit("if VM.CMPR ~= 0 then")
self:Dyn_Emit("if VM:Push("..self.PrecompileIP..") then")

Check warning on line 469 in lua/wire/zvm/zvm_opcodes.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator

Check warning on line 469 in lua/wire/zvm/zvm_opcodes.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator
self:Dyn_Emit("VM:Jump($1)")
self:Dyn_EmitState()
self:Dyn_EmitBreak()
Expand All @@ -476,7 +476,7 @@
end
ZVM.OpcodeTable[72] = function(self) --CJMP
self:Dyn_EmitForceRegisterGlobal("ESP")
self:Dyn_Emit("if VM:Push("..self.PrecompileIP..") then")

Check warning on line 479 in lua/wire/zvm/zvm_opcodes.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator

Check warning on line 479 in lua/wire/zvm/zvm_opcodes.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator
self:Dyn_Emit("VM:Jump($1)")
self:Dyn_EmitState()
self:Dyn_EmitBreak()
Expand All @@ -486,7 +486,7 @@
ZVM.OpcodeTable[73] = function(self) --CG
self:Dyn_EmitForceRegisterGlobal("ESP")
self:Dyn_Emit("if VM.CMPR > 0 then")
self:Dyn_Emit("if VM:Push("..self.PrecompileIP..") then")

Check warning on line 489 in lua/wire/zvm/zvm_opcodes.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator

Check warning on line 489 in lua/wire/zvm/zvm_opcodes.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator
self:Dyn_Emit("VM:Jump($1)")
self:Dyn_EmitState()
self:Dyn_EmitBreak()
Expand Down Expand Up @@ -1358,8 +1358,19 @@
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
Loading