Prints memory once
-- Uncomment only one of the following to set the values to print
--inputFilename="sq1-skimmer2.out" -- Prints values from an output file (searchmemory or searchdiffmemory)
--addressList = {246039,240192,240193,240183,240185,240159} -- Prints specific memory addresses
--for i=240140,240169 do -- Prints a range of consecutive addresses
-- table.insert(addressList, i)
--end
function string:split( inSplitPattern, outResults )
if not outResults then
outResults = { }
end
local theStart = 1
local theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart )
while theSplitStart do
table.insert( outResults, string.sub( self, theStart, theSplitStart-1 ) )
theStart = theSplitEnd + 1
theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart )
end
table.insert( outResults, string.sub( self, theStart ) )
return outResults
end
-- Main
if inputFilename then
print("Opening input file")
inputBinary, error=io.open_read(inputFilename)
print("Spitting input")
searchStr = inputBinary.read()
inputBinary:close()
searchList = searchStr:split(",")
print("Input split into " .. #searchList .. " items")
end
if not searchList then
searchList={}
end
if addressList then
for i,v in ipairs(addressList) do
table.insert(searchList, v)
end
end
--str = ""
for i,v in ipairs(searchList) do
--str = str .. string.char(jpcrr.read_byte(v))
print(v .. ": " .. jpcrr.read_byte(v) .. "/" .. jpcrr.read_word(v) .. " [" .. string.char(jpcrr.read_byte(v)) .. "]")
end
--print(str)