Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
Bananasrawesome

Don't like Lua

Question

I am currently studying C++ and know nothing about Lua. I know Batch pretty well so can someone tell me how I could add MS-DOS to my copy of the mod? The only thing I could do in the mod is put computers together and find ways to power them. Also, a separate mod adding MS-DOS to Open Computers would be cool. Please be sure it is compatible with Minecraft 1.7.10 because 1.7.10 seems to be the most stable version.

Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

The only way to use another language (unless you write the whole interpreter in Lua and use it as a boot script) as the core of OpenComputers is to make it yourself with Java or Scala, using this: http://ocdoc.cil.li/tutorial:modding_architecture (And wow I noticed it got easier).
Implementing an OS directly through this mechanism has little interest, and I'm not sure it can be done (Hint: It probably can.).

Someone had wrote a JavaScript architecture (Look in Addon Mods), and there were projects to implement both ARM and x86 architectures. (ARM has been dropped, and I'm not sure about x86 but I'm pretty sure it was.)

 

Sadly, I doubt machine code will ever be a thing as it's a really big task to emulate an actual CPU and have it run smoothly enough, load code from EEPROM, and have all APIs implemented and stuff. Maybe someone will take on the challenge some day, though. I'm shrugging heavily at whether or not there is a possibility.

Link to post
Share on other sites
  • 0

I am currently studying C++ and know nothing about Lua. I know Batch pretty well

Let me help you rethink your life:

Lua's easier than C++ and you'll probably enjoy it much more.

It's fairly lightweight but there's some funky stuff you can do with metatables and closures and whatnot.

Also, join us on IRC, seriously.

As long as you can read some documentation and have some idea of how to use a search engine, you'll do just fine.

----

While I'm at it, might as well address this point:

Sadly, I doubt machine code will ever be a thing as it's a really big task

to emulate an actual CPU and have it run smoothly enough, load code from EEPROM,

and have all APIs implemented and stuff. Maybe someone will take on the challenge

some day, though. I'm shrugging heavily at whether or not there is a possibility.

I'll use OCMIPS as a reference. Sadly there's no post here (memo to self, get back into this stuff).

During testing (prior to actually making it into a Minecraft mod) I could get about 70-100MHz.

Current version has virtual memory, though, thus you'll probably get a slower speed;

however, it apparently does achieve at least 40MHz (higher frequencies have not been tested).

The provided EEPROM bootloader loads a statically-linked ELF file.

Yes, even with every instruction taking up 4 bytes, you can fit it in comfortably.

IIRC it took less than a week before the damn thing could run Lua. Another reason why MIPS is awesome.

(Of course, you also have newlib to thank. That meant I didn't have to write *too* much code to get it to work.)

I think it took a couple of days to get virtual memory working,

then a few more days to get a nanokernel working that could run the ~350KB of Lua 5.3.2

off a T1 stick of RAM (192KB), with about 72KB RAM spare... in about ~20 minutes.

(Disk I/O isn't instantaneous. Given sufficient RAM it takes about 5 seconds to load.)

Thus, AFAIK OCMIPS is currently the only architecture that can run programs that are bigger than RAM... without cheating.

(I don't know how far the ARM architectures are right now.)

APIwise I only have a few syscalls implemented.

I'll probably have to use a modified Lua REPL for the component and computer libraries,

as currently mocha (the nanokernel I wrote for this) doesn't handle more than one file for virtual memory mapping.

The ideal would be to get a standard OCMIPS system to be self-hosting.

Unfortunately, I've yet to get any lightweight C compilers working, so at the moment that's just a pipedream.

But to address this point:

Implementing an OS directly through this mechanism has little interest, and I'm not sure it can be done (Hint: It probably can.).

I almost got Linux to mount root properly.

It's impractical though, as you pretty much need 8MB of RAM.

Link to post
Share on other sites
  • 0

I believe Lua is a very powerful and solid language, and I don't believe MS-DOS compares or would be worthwhile recreating/supporting in Minecraft or OC.

 

I think if you spend some quality time learning Lua it'd be worthwhile. If you know C++ (or any programming language), Lua shouldn't be so hard to pick up and understand.

 

 

Edit: https://oc.cil.li/index.php?/topic/202-minios/

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.