Skip to content

Commit

Permalink
Merge pull request #12 from DerelictDrone/expression-generator-segmen…
Browse files Browse the repository at this point in the history
…t-access-fix

Carry segments over during complex memory access expressions
  • Loading branch information
thegrb93 authored Nov 13, 2023
2 parents 4ad73dc + c4e0a40 commit 90d5877
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lua/wire/client/hlzasm/hc_codetree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ end
function HCOMP:ReadOperandFromMemory(operands,index)
if operands[index].MemoryPointer.Opcode then -- Parse complex expression
local addrReg,isTemp = self:GenerateLeaf(operands[index].MemoryPointer,true)
operands[index] = { MemoryRegister = addrReg, Temporary = isTemp }
operands[index] = { MemoryRegister = addrReg, Segment = operands[index].Segment, Temporary = isTemp }
self.RegisterBusy[addrReg] = isTemp
return addrReg
else -- Parse an operand
Expand All @@ -202,8 +202,7 @@ function HCOMP:ReadOperandFromMemory(operands,index)
rstackLeaf.Operands[1] = { Register = freeReg }
rstackLeaf.Operands[2] = { Constant = operands[index].MemoryPointer.Stack, Segment = 16 }
self:GenerateLeaf(rstackLeaf)

operands[index] = { MemoryRegister = freeReg, Temporary = true }
operands[index] = { MemoryRegister = freeReg, Segment = operands[index].Segment, Temporary = true }
self.RegisterBusy[freeReg] = true
return addrReg
else -- Generate more than just a stack read
Expand Down

0 comments on commit 90d5877

Please sign in to comment.