add repeated line notation to mem dump
This commit is contained in:
parent
46e5b83cef
commit
83d668fa5c
@ -443,8 +443,16 @@ local function printMemory(mem)
|
|||||||
print("Memory Dump:")
|
print("Memory Dump:")
|
||||||
local anynonempty = false
|
local anynonempty = false
|
||||||
local lastbase = -16
|
local lastbase = -16
|
||||||
|
local lastline = ""
|
||||||
|
local numreps = 0
|
||||||
|
local function closereps(base)
|
||||||
|
if numreps~=0 then
|
||||||
|
print("(repeated "..numreps.." more times, up to "..string.format("%04X", base+16)..")")
|
||||||
|
numreps = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
for base = 0, 0xFFF0, 16 do
|
for base = 0, 0xFFF0, 16 do
|
||||||
local line = { string.format("%04X", base), " |" }
|
local line = {}
|
||||||
local nonempty = false
|
local nonempty = false
|
||||||
for addr = base, base+15 do
|
for addr = base, base+15 do
|
||||||
if addr%4==0 then table.insert(line, " ") end
|
if addr%4==0 then table.insert(line, " ") end
|
||||||
@ -459,12 +467,20 @@ local function printMemory(mem)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if nonempty then
|
if nonempty then
|
||||||
if base ~= lastbase+16 then print("...") end
|
local l = table.concat(line)
|
||||||
print(table.concat(line))
|
if l~=lastline or base~=lastbase+16 then
|
||||||
|
closereps(base)
|
||||||
|
if base ~= lastbase+16 then print("...") end
|
||||||
|
print(string.format("%04X", base).." |"..l)
|
||||||
|
else
|
||||||
|
numreps = numreps+1
|
||||||
|
end
|
||||||
|
lastline = l
|
||||||
lastbase = base
|
lastbase = base
|
||||||
anynonempty = true
|
anynonempty = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
closereps(lastbase)
|
||||||
if not anynonempty then print("Empty") end
|
if not anynonempty then print("Empty") end
|
||||||
print()
|
print()
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user