Advertisement
BILLPC2684

ROM-loader test

Oct 16th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.41 KB | None | 0 0
  1. function load(filename)
  2.  local File = io.open(filename,"r")
  3.  local data = File:read(("*all"))
  4.  File:close()
  5.  content = {}
  6.  for i=1,#data do
  7.   table.insert(content, string.byte(data[i]))
  8.  end
  9.  return content
  10. end
  11.  
  12. ROMFN = "/path/to/file.bin"
  13. ROM = load(ROMFN)
  14. local data = ""
  15. for i=1,#ROM do
  16.  data = data..ROM[i].." "
  17. end
  18. data = data.."\n"
  19. for i=1,#ROM do
  20.  data = data..string.char(ROM[i]).." "
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement