Advertisement
VlaD00m

SecuCODEX Creator

Mar 28th, 2021
876
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.50 KB | None | 0 0
  1. local component = require('component')
  2. local shell = require('shell')
  3. local filesystem = require('filesystem')
  4.  
  5. print('SecuCODEX EEPROM Creator')
  6. print('Read more on: https://github.com/Bs0Dd/OpenCompSoft/blob/master/SecuCODEX/README.md')
  7. print()
  8.  
  9. local ans, lb = ''
  10. while ans:lower() ~= 'm' and ans:lower() ~= 'c' do
  11. io.write( 'What type of system you wants to use? [M]ono/[C]olor: ')
  12. ans = io.read()
  13. end
  14.  
  15. print('Downloading EEPROM image...')
  16. if ans:lower() == 'm' then
  17.     shell.execute('wget -q https://github.com/Bs0Dd/OpenCompSoft/raw/master/SecuCODEX/Mono/bios.lua /sctemp.lua')
  18.     lb = 'SecuCODEX Mono'
  19. elseif ans:lower() == 'c' then
  20.     shell.execute('wget -q https://github.com/Bs0Dd/OpenCompSoft/raw/master/SecuCODEX/Color/bios.lua /sctemp.lua')
  21.     lb = 'SecuCODEX Color'
  22. end
  23. print('OK!\n')
  24.  
  25. local file = assert(io.open('/sctemp.lua', "rb"))
  26. local bios = file:read("*a")
  27. file:close()
  28. filesystem.remove('/sctemp.lua')
  29. print("Insert the EEPROM you would like to flash.")
  30. print("When ready to write, type `y` to confirm.")
  31. repeat
  32.   local response = io.read()
  33. until response and response:lower():sub(1, 1) == "y"
  34. print("Beginning to flash EEPROM.")
  35. local eeprom = component.eeprom
  36. print("Flashing EEPROM " .. eeprom.address .. ".")
  37. print("Please do NOT power down or restart your computer during this operation!")
  38. eeprom.set(bios)
  39. eeprom.setLabel(lb)
  40. print("All done! You can remove the EEPROM and re-insert the previous one now.")
  41. print("Remember to switch the access system processor to Lua 5.3 mode!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement