Skip to content

Commit

Permalink
add some stuff to flashing
Browse files Browse the repository at this point in the history
  • Loading branch information
bjcscat committed Oct 31, 2023
1 parent f5d0f0a commit 8b15922
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lua/entities/gmod_wire_cpu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,12 @@ end
-- Write data to RAM and then flash ROM if required
function ENT:FlashData(data)
self.VM:Reset()
for k,v in pairs(data) do
self.VM:WriteCell(k,tonumber(v) or 0)
if (k >= 0) and (k < self.VM.ROMSize) then
self.VM.ROM[k] = tonumber(v) or 0
for addr, v in pairs(data) do
addr = math.floor(addr)

self.VM:WriteCell(addr,tonumber(v) or 0)
if (addr >= 0) and (addr < self.VM.ROMSize) then
self.VM.ROM[addr] = tonumber(v) or 0
end
end
end
Expand Down

0 comments on commit 8b15922

Please sign in to comment.