This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Removing The Bios?
Started by sci4me, 06 September 2013 - 06:19 AMPosted 06 September 2013 - 08:19 AM
Hey guys! So, I want a little bit different of a coding experience, and I basically want to delete all the rom folder, and edit the bios to just do the bear minimum to get a computer working. It isnt important to be able to edit code in game for me so this would work fine. My question is: what should i change the bios code to?
Posted 06 September 2013 - 10:31 AM
1 thing:
DONT even THINK about deleting the "rom" folder!
Doing so will make all APIS unusable.. which means the "os" will crash upon loading (i've tried this… i had to reinstall CC)
I wont help you by doing this… you have to figure that out yourself… (or maybe another will answer)
Period
DONT even THINK about deleting the "rom" folder!
Doing so will make all APIS unusable.. which means the "os" will crash upon loading (i've tried this… i had to reinstall CC)
I wont help you by doing this… you have to figure that out yourself… (or maybe another will answer)
Period
Posted 06 September 2013 - 10:48 AM
The problem you would have made is not making any modifications to the bios or any other files you did not delete, so they would have errored causing the problem you thought you couldn't have fixed and then just reinstalling CC.DONT even THINK about deleting the "rom" folder!
Doing so will make all APIS unusable.. which means the "os" will crash upon loading (i've tried this… i had to reinstall CC)
It really depends on what you want to do, really nothing in the bios.lua file is needed, they are all just niceties given to us, without them we could still do all the same things as before, we would just have to code them ourselves. Also by deleting the rom folder do note that you'll have to interface with the terminal with term.native, and turtles with turtle.native (which returns an id and events) and you have to use http.request, there is nothing else, etc. There is quite a lot removed by removing the rom folder. However if you do want to go bare minimum then just this will do I guess.what should i change the bios code to?
--# print and write from bios.lua
--# read from bios.lua
--# os.shutdown and reboot niceties from bios.lua
--# os.run from the bios.lua (and any functions it may also use, like loadfile, setmetatable, also change the printErrors to work without the term API)
local ok, err = pcall(function()
end)
if not ok then
print("Error!\n"..err)
end
pcall( function()
term.native.setCursorBlink( false )
print("Press any key to continue")
os.pullEvent( "key" )
end )
os.shutdown()
Be aware though, there is a LOT of code that you're going to have to change in everything you program, and if you want to use a program or API someone else has used you may as well write it yourself because you'll be changing lots of their code just to work with your new environment.
Posted 06 September 2013 - 04:14 PM
Yes, I am well aware of what can happen. Honestly, I didn't really need to ask this, but at the time I didn't realize how to do it. All I have to do is try to run a boot file and if its not there just wait for it… easy. :P/> Thanks guys! :D/>
Posted 06 September 2013 - 04:36 PM
you'll have to interface with the terminal with term.native, and turtles with turtle.native (which returns an id and events) and you have to use http.request, there is nothing else, etc.
actually, term.native and turtle.native won't even exist; the lua term and turtle api's wrap up the native term and turtle apis, storing the originals as term.native and turtle.native in the new APIs.
So you would use term and turtle, but they would behave like, and be limited to the functions from, term.native and turtle.native.
http api is as you said.
sci4me: If it were me, I would make it run a lua prompt if there is no startup file, so that a blank computer without a floppy drive or startup disk isn't completely useless.
Posted 06 September 2013 - 04:52 PM
Okay, a few questions:
1. I have to restart MC to get the bios changes?
2. But if I remove the term and turtle files, i use term.native? it isnt working … explain more?
1. I have to restart MC to get the bios changes?
2. But if I remove the term and turtle files, i use term.native? it isnt working … explain more?
Posted 06 September 2013 - 05:09 PM
read my previous post again. term.native won't exist, the global term will just be what would normally have been term.native. Same with turtle.
the "native" term and turtle are defined in java, the normal lua apis in the bios wrap them and extend functionality, preserving the raw java (native) apis as term.native and turtle.native.
the "native" term and turtle are defined in java, the normal lua apis in the bios wrap them and extend functionality, preserving the raw java (native) apis as term.native and turtle.native.
Posted 06 September 2013 - 05:21 PM
yeah, I got it now. thanks for the help! ill post again if i need more help but I think i got it! :D/> thanks again!
Posted 06 September 2013 - 05:44 PM
Hmm, I cant use the http api for some reason?
Posted 06 September 2013 - 06:50 PM
Did you try using http.get or .post or did you try using http.request as Bit mentioned? http.get and http.post are defined in bios.lua, you have only http.request by default.
Posted 06 September 2013 - 06:55 PM
I used .request… and it said im trying to use nil or whatever… and it is enabled in the config…