Jump to content




BIOS Recommendations?

lua

  • You cannot reply to this topic
12 replies to this topic

#1 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 24 June 2013 - 08:53 AM

Can anyone recommend a good bios replacement that supports OS selection?
I tried writing my own but I'm finding the process of looking back at the code then reinserting it into the CC zip and rebooting minecraft rather tedious, particularly when the VM behind CC won't give out what line the error is on.
After procrastinating and programming for so long in C#, I've finally decided to get back to working on my OS for CC and a nice bios selector would be handy, particularly one that will tell me the line number of any errors I make along the way.

#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 24 June 2013 - 09:07 AM

To test for errors, why don't you just run it on the computer as a program? That's what I plan on doing.

#3 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 24 June 2013 - 09:33 AM

Well, I wrote a bios that supports multi-boot. I use it to test my own OS. Here's the github repo.
Also, I recommend using an emulator (CCEmu or CCDesk) to test. It makes the development faster, since you don't have to go into minecraft, then into the computer, you just have all the computers there in one screen. And it saves some resources too ;)

#4 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 25 June 2013 - 06:59 PM

View Posttheoriginalbit, on 24 June 2013 - 09:07 AM, said:

To test for errors, why don't you just run it on the computer as a program? That's what I plan on doing.

Because functions get changed and added as part of CraftOS's loading up. If the OS is reliant on anything generated by CraftOS, it's not a true OS because it requires another OS to load first.

View PostMysticT, on 24 June 2013 - 09:33 AM, said:

Well, I wrote a bios that supports multi-boot. I use it to test my own OS. Here's the github repo.
Also, I recommend using an emulator (CCEmu or CCDesk) to test. It makes the development faster, since you don't have to go into minecraft, then into the computer, you just have all the computers there in one screen. And it saves some resources too ;)

I've used CCemu as well, but it has the same problems regardless because the requirement of a rom file and the whole not telling you what line the error is on is an issue with ComputerCraft itself.
That bios there has an issue btw. It replaces the native getmetatable.
I may consider it however, depending on what alternatives are available.

#5 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 25 June 2013 - 08:41 PM

View PostPharap, on 25 June 2013 - 06:59 PM, said:

I've used CCemu as well, but it has the same problems regardless because the requirement of a rom file and the whole not telling you what line the error is on is an issue with ComputerCraft itself.
I'm not sure what you mean. I never had any problem getting the line number for an error. And what do you mean by "the requirement of a rom file"?

View PostPharap, on 25 June 2013 - 06:59 PM, said:

That bios there has an issue btw. It replaces the native getmetatable.
I may consider it however, depending on what alternatives are available.
Well, originally it didn't change or add any function. But I had to add that one, it's a protection that must be done on the bios. The only change with the native getmetatable is that it doesn't allow to get the string metatable. The string metatable is one for the whole Lua VM, so it's shared across computers. You don't want another computer changing your string functions, do you? :P

#6 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 25 June 2013 - 10:32 PM

View PostPharap, on 25 June 2013 - 06:59 PM, said:

Because functions get changed and added as part of CraftOS's loading up. If the OS is reliant on anything generated by CraftOS, it's not a true OS because it requires another OS to load first.
I'm not saying run it there to make sure that it will work on a computer, I'm saying run it there to check for logic and syntax errors. If you have any, then it wouldn't matter where it is run, it will show up.

#7 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 26 June 2013 - 08:18 AM

View PostMysticT, on 25 June 2013 - 08:41 PM, said:

View PostPharap, on 25 June 2013 - 06:59 PM, said:

I've used CCemu as well, but it has the same problems regardless because the requirement of a rom file and the whole not telling you what line the error is on is an issue with ComputerCraft itself.
I'm not sure what you mean. I never had any problem getting the line number for an error. And what do you mean by "the requirement of a rom file"?

If there's no rom file in the lua directory in computercraft, computercraft complains. Also if bios.lua errors, it doesn't give you a line number, it only complains that you have 'installed craftOS wrong'.

View PostMysticT, on 25 June 2013 - 08:41 PM, said:

View PostPharap, on 25 June 2013 - 06:59 PM, said:

That bios there has an issue btw. It replaces the native getmetatable.
I may consider it however, depending on what alternatives are available.
Well, originally it didn't change or add any function. But I had to add that one, it's a protection that must be done on the bios. The only change with the native getmetatable is that it doesn't allow to get the string metatable. The string metatable is one for the whole Lua VM, so it's shared across computers. You don't want another computer changing your string functions, do you? :P

If it's that crucial they should really make it Java-side, or at least leave a bit more of a note. Makes me wonder why the usual __metatable trick won't work.

View Posttheoriginalbit, on 25 June 2013 - 10:32 PM, said:

View PostPharap, on 25 June 2013 - 06:59 PM, said:

Because functions get changed and added as part of CraftOS's loading up. If the OS is reliant on anything generated by CraftOS, it's not a true OS because it requires another OS to load first.
I'm not saying run it there to make sure that it will work on a computer, I'm saying run it there to check for logic and syntax errors. If you have any, then it wouldn't matter where it is run, it will show up.

Again, that won't combat the whole 'not giving line errors' problem if the error crops up mid-program. At least not without either explicitly adding extra pcalls or being able to replicate the issues undercraftOS. In which case if it's a relapse of accidentally using craftOS functions, that will lead to more cryptic problems regarding identifying that a craftOS-added function is the problem and where it is.

#8 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 26 June 2013 - 12:00 PM

View PostPharap, on 26 June 2013 - 08:18 AM, said:

If there's no rom file in the lua directory in computercraft, computercraft complains. Also if bios.lua errors, it doesn't give you a line number, it only complains that you have 'installed craftOS wrong'.
Ahhh, now I remember. Yeah, that was anoying :P I think I used another file that loaded the bios or something like that to test.

View PostPharap, on 26 June 2013 - 08:18 AM, said:

If it's that crucial they should really make it Java-side, or at least leave a bit more of a note. Makes me wonder why the usual __metatable trick won't work.
True, not sure why it's not done java-side. But still, I think it should be done, and the bios is the best place to do it (the only safe place to do it actually).
The __metatable way should work. Maybe they should do that java-side. Doing it on the bios would mean that you just need to do it once, since it's modified on every computer. I think I'll do that.

#9 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 26 June 2013 - 12:25 PM

Keep the what-is-a-real-OS debate out of Ask a Pro.

#10 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 27 June 2013 - 03:22 AM

View PostLyqyd, on 26 June 2013 - 12:25 PM, said:

Keep the what-is-a-real-OS debate out of Ask a Pro.

Was that actually directed at anyone?

View PostMysticT, on 26 June 2013 - 12:00 PM, said:

View PostPharap, on 26 June 2013 - 08:18 AM, said:

If there's no rom file in the lua directory in computercraft, computercraft complains. Also if bios.lua errors, it doesn't give you a line number, it only complains that you have 'installed craftOS wrong'.
Ahhh, now I remember. Yeah, that was anoying :P I think I used another file that loaded the bios or something like that to test.

View PostPharap, on 26 June 2013 - 08:18 AM, said:

If it's that crucial they should really make it Java-side, or at least leave a bit more of a note. Makes me wonder why the usual __metatable trick won't work.
True, not sure why it's not done java-side. But still, I think it should be done, and the bios is the best place to do it (the only safe place to do it actually).
The __metatable way should work. Maybe they should do that java-side. Doing it on the bios would mean that you just need to do it once, since it's modified on every computer. I think I'll do that.

I may try that. I'm a tad rusty because I've been busy on other non-lua projects, so I keep forgetting what the return values of things like loadstring are. :P

Personally I think the 'bios' is a stage too late and something that crucial should be Java-side. If it were any normal lua VM I'd say it was fine but given this VM's usage, it's better to be safe than sorry.
Do be sure to notify me if the __metatable trick works, I would think there's some reason it isn't used, but you never know, it might just be that nobody has tried it before and it turns out to be a much better solution.

#11 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 27 June 2013 - 11:21 AM

View PostPharap, on 27 June 2013 - 03:22 AM, said:

Do be sure to notify me if the __metatable trick works, I would think there's some reason it isn't used, but you never know, it might just be that nobody has tried it before and it turns out to be a much better solution.
It's worked so far. You can't get the string metatable, but it doesn't error like the other method did (wich can be good in some cases, bad in some others). I haven't found any way to bypass this, but that doesn't mean there isn't. Will keep testing that.
The only "problem" I found is that you can't set the metatable for strings (also, it will error if you try). But, who does that anyway? :P

#12 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 27 June 2013 - 12:37 PM

View PostPharap, on 27 June 2013 - 03:22 AM, said:

View PostLyqyd, on 26 June 2013 - 12:25 PM, said:

Keep the what-is-a-real-OS debate out of Ask a Pro.

Was that actually directed at anyone?

Of course.

View PostPharap, on 25 June 2013 - 06:59 PM, said:

Because functions get changed and added as part of CraftOS's loading up. If the OS is reliant on anything generated by CraftOS, it's not a true OS because it requires another OS to load first.

Emphasis mine. The first sentence was fine, the second is not welcome here, as it's completely opinion-based, irrelevant to the discussion, and plays into a recurring debate.

#13 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 28 June 2013 - 11:37 AM

View PostMysticT, on 27 June 2013 - 11:21 AM, said:

View PostPharap, on 27 June 2013 - 03:22 AM, said:

Do be sure to notify me if the __metatable trick works, I would think there's some reason it isn't used, but you never know, it might just be that nobody has tried it before and it turns out to be a much better solution.
It's worked so far. You can't get the string metatable, but it doesn't error like the other method did (wich can be good in some cases, bad in some others). I haven't found any way to bypass this, but that doesn't mean there isn't. Will keep testing that.
The only "problem" I found is that you can't set the metatable for strings (also, it will error if you try). But, who does that anyway? :P

I think not erroring is a better idea personally. Errors and exceptions do make things less cryptic, but on the other hand there's a performance cost for handling them. It's one thing I think C/C++ has/had right (returning null pointers if something didn't allocate properly). I wouldn't go as far to say the whole error thing is a bad idea, I just think there are some times where errors are better handled with single if statements than multi-line pcalls.

It's something I've considered experimenting with to see how much I can break, but otherwise, nobody lol





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users