Question

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Smith
Member
Member
Posts: 38
Joined: Wed Feb 02, 2005 12:00 am

Question

Post by Smith »

Is it possible to write an OS in BASIC?
Da_Maestro
Member
Member
Posts: 144
Joined: Tue Oct 26, 2004 11:00 pm
Location: Australia

Re: Question

Post by Da_Maestro »

Basically, No
Two things are infinite: The universe and human stupidity. But I'm not quite sure about the universe.
--- Albert Einstein
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: Question

Post by bubach »

For an expirienced coder it might, but i doubt that many BASIC programmer has the knowlegde to do it.
You need to get a BASIC compiler that can use extrenal assembly functions, that you have to write for yourself.

http://www.freebasic.net/ might be suitable for it.
Last edited by bubach on Mon Feb 27, 2006 12:00 am, edited 3 times in total.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Re: Question

Post by JAAman »

the biggest problem with BASIC is that it is designed to be interpreted -- not compiled

in fact, most BASIC 'compilers', don't actually compile -- instead they simply combine a tokenized copy of the BASIC source, with a copy of the interpreter, into an executable file (if you don't understand the difference, your not ready for OSdev)

you would need a compiler that truely compiles the code (which, btw, is not easy with BASIC -- the language is designed for a lot of runtime overhead, which is easy to do in an interpreter, but very difficult to compile)

and then you would be stuck writing large parts of code in ASM (much more than you would in another language -- such as C) because BASIC lacks the flexability to control how the code will be generated,

you would be unable to use many parts of the BASIC language (no print, input, get/put, open, write, etc)
all of these statements are designed to interface with the OS (which, of course, you are trying to write) and, in standard BASIC, statements cannot be replaced with your own (you would have to modify the compiler to use your own if you did want to use these statements -- and writing a 'print' handler would be a challenging task indeed -- almost like writing your own compiler)

can you imagine a BASIC program without a print statement? -- the advantage of BASIC is that it can handle a lot of things itself (the programmer doesn't have to) -- but that same simplicity, becomes a liability in OSdev
Smith
Member
Member
Posts: 38
Joined: Wed Feb 02, 2005 12:00 am

Re: Question

Post by Smith »

Thanks
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: Question

Post by earlz »

Does anyone know if there is a basic compiler that "interprets to be compiled"

for example do:
"print "hello"

and it sends a command to a dll in the format
conpiled_print("hello")

which the dll will interpret to compiled instructions and adds it to the buffer to be written to the compiled file

which therefor would let you use the same syntax all the time but be able to change platform simply by changing a dll


if not then that might be something i commit a bit of time to
Da_Maestro
Member
Member
Posts: 144
Joined: Tue Oct 26, 2004 11:00 pm
Location: Australia

Re: Question

Post by Da_Maestro »

hckr83, are you talking about JIT compiling? (Just-in-time).

This compiling style is used by the JVM for interpreting the java byte code. Instead of interpreting the file, it will compile a chunk of it, and execute the compiled chunk. When that chunk completes it compiles another chunk and executes and so on.
Two things are infinite: The universe and human stupidity. But I'm not quite sure about the universe.
--- Albert Einstein
Post Reply