Page 1 of 2

FreeBasic

Posted: Tue Jun 03, 2008 3:19 pm
by fdxx
Hi, first sorry for my bad english, it is not my first language. I am starting getting into the world of the development of operative systems. My problem is the following one:
I want to develop an operative system in FreeBasic. I was reading the article in the "Wiki" on how as doing "GCC Cross-Compiler", but i am user of Windows XP(DJGPP). How I can do it?

thanxs :oops:

Posted: Wed Jun 04, 2008 3:44 am
by Combuster
First off, DJGPP was made for DOS. It's dated, old, bad, etc, etc.
Secondly, its a C compiler - I assume you wanted to do Basic right? :wink:

Read FreeBasic Barebones, chapter 3, to get a working setup.

Posted: Wed Jun 04, 2008 6:37 am
by Ready4Dis
Combuster wrote:First off, DJGPP was made for DOS. It's dated, old, bad, etc, etc.
Secondly, its a C compiler - I assume you wanted to do Basic right? :wink:

Read FreeBasic Barebones, chapter 3, to get a working setup.
I agree, if you are looking for writing it in basic, use that link/tutorial.

But hey, what's wrong with DJGPP? I use it for my OS dev, and it works perfectly fine, and to add, I can compile my programs to dos executeables or my OS executeables without having to call 2 sepereate compilers/linkers (I have written a few apps for Dos for dealing with my partition setup, installing mbr and boot loaders before my OS is installed, etc). I don't see any issues with DJGPP as long as you plan on supporting the formats it uses (I use Coff in my OS for now).

Posted: Wed Jun 04, 2008 10:14 am
by Combuster
Oh and, FB Barebones won't work with DJGPP. It needs a crosscompiler.

Posted: Wed Jun 04, 2008 10:16 am
by JAAman
sure, there is nothing wrong with using DJGPP if you are running DOS

the problem is, windows (windows '95 and later, but not earlier ones) runs DJGPP in an emulator (the one in NT/XP has well known bugs, btw, which does affect older versions of DJGPP) emulating a 16bit RMode DOS environment, then DJGPP then provide a simulated 32bit PMode environment (which windows already provides natively...) within that 16bit RMode environment... and so on (that is not the end of the repetitious emulations, which essentially provide to GCC the same services windows already provides natively)

Posted: Wed Jun 04, 2008 10:29 am
by Ready4Dis
JAAman wrote:sure, there is nothing wrong with using DJGPP if you are running DOS

the problem is, windows (windows '95 and later, but not earlier ones) runs DJGPP in an emulator (the one in NT/XP has well known bugs, btw, which does affect older versions of DJGPP) emulating a 16bit RMode DOS environment, then DJGPP then provide a simulated 32bit PMode environment (which windows already provides natively...) within that 16bit RMode environment... and so on (that is not the end of the repetitious emulations, which essentially provide to GCC the same services windows already provides natively)
I don't know, I develope under windows xp and vista without issues. I don't typically run djgpp programs under said OS's, but then again, how many times have you run programs compiled in an OS specific cross compiler under vista? I just don't see the argument you're trying to make. Like I said, I run/develope on XP and vista without issues using DJGPP, that may or may not change some day, but for now it works fine. I understand what you're saying, but it works fine for me, outputs the format I am using, and required little to no work to setup, and I can use it for developing applications under dos for direct access to hardware without having to run under my OS. In the future I will probably drop gcc all together and use something move compact and more focused for my OS, but for now it works, and works well.

Posted: Wed Jun 04, 2008 10:29 am
by fdxx
Combuster wrote:Oh and, FB Barebones won't work with DJGPP. It needs a crosscompiler.
This it is my problem, I cannot do the "crosscompiler"

Posted: Wed Jun 04, 2008 10:36 am
by Ready4Dis
Combuster wrote:Oh and, FB Barebones won't work with DJGPP. It needs a crosscompiler.
That is a poblem with djgpp, lol. I haven't read it, but i assume it uses a different file format if it's not compatible?

Posted: Wed Jun 04, 2008 10:46 am
by JAAman
I don't know, I develope under windows xp and vista without issues. I don't typically run djgpp programs under said OS's
there arent any problems with the programs compiled with the compiler, its the compiler itself i was refering to

I just don't see the argument you're trying to make. Like I said, I run/develope on XP and vista without issues using DJGPP, that may or may not change some day, but for now it works fine.
thats a combination of which features your using, luck, and the fact that your using new versions (which have been modified to avoid the bug in NT/XP DPMI)
I understand what you're saying, but it works fine for me, outputs the format I am using, and required little to no work to setup, and I can use it for developing applications under dos for direct access to hardware without having to run under my OS.
all of which can be done under other implementations as well, although its probably easier to compile DOS programs with DJGPP

thing is, there are always more potential for problems when things are more complicated, and you dont get any more complicated than a compiler running inside an emulator, running inside another emulator, running inside another emulator, running inside another emulator...

i counted once, iirc it was 7 levels of emulation every time you run DJGPP


for you, your already set up with DJGPP, and now that they have fixed the problems with XP (i think) your happy with it, but we certainly dont want to be recommending new people who dont have an environment set up already, to start using DJGPP

Posted: Wed Jun 04, 2008 11:22 am
by Ready4Dis
I don't know which version had issues, but i started OS deving before XP came out, then took a long break, and got back into it. I haven't had an issues with any of the djgpp versions i've used, and the setup is much simpler than cross compiling. I don't see it as a bad option for new people, i found it very simple to get working, and it can output coff or flat binaries easily. Like I said, I am probably not going to stick with it due to it's size/speed characteristics, I will probably swtich over to something like tiny c, which compiles to elf files, and does so MUCH faster than gcc. It is an optimizing compile, not positive how well it optimizes comparitevely, but i know it does well. It can also compile itself, so it's a perfect candidate for an OS which is written in C (such as mine). It is much simpler to compile (not huge toolchain, etc) and is an all in one (it's an assembler, c compiler and linker in one). As mentioned, it supports elf filse, and is pretty small, so it wouldn't be a bad option for a person new to OS dev, since elf seems to be the prefered format. I am not 100% sure of all it's capabilities (like position independant code, etc). I am good with djgpp for now, it does what i need, and i don't have issues, i run it off my thumb-drive and it compiles my OS fine under 98,2k,xp, and vista (as well as dos, but I don't typically use it under dos).

Posted: Wed Jun 04, 2008 11:27 am
by Combuster
fdxx wrote:
Combuster wrote:Oh and, FB Barebones won't work with DJGPP. It needs a crosscompiler.
This it is my problem, I cannot do the "crosscompiler"
Then you should really re-read the crosscompiler page. If it doesn't work, you can't follow instructions to the letter. It's been tried and tested a few times too often.

Posted: Wed Jun 04, 2008 12:28 pm
by ollie123
If you want a C compiler for XP, I suggest Cygwin or MinGW (the latter being the one I use)

Posted: Thu Jun 05, 2008 8:43 am
by JAAman
Ready4Dis wrote:I don't know which version had issues, but i started OS deving before XP came out, then took a long break, and got back into it. I haven't had an issues with any of the djgpp versions i've used
iirc the potential problems were fixed about 2 years ago (though i dont remember for sure -- they talked about it on the DJGPP website, and its probably in the version history...)

thing is, most people never encountered it, but you never knew for sure when you had another problem, or if it was that problem

if there was a commonly encountered, readily reproducible problem with NT-DPMI, MS would have fixed it -- but the problem was very rare, and inconsistent even with programs which could have the problem
and the setup is much simpler than cross compiling.
cross-compiling is never necessary with any compiler -- the reason its recommended (even for DJGPP) is so that everyone is using exactly the same compiler/configurations (makes it much easier to help newer people who dont know what they are doing)
I don't see it as a bad option for new people, i found it very simple to get working, and it can output coff or flat binaries easily...

...It is an optimizing compile, not positive how well it optimizes comparitevely, but i know it does well. It can also compile itself, so it's a perfect candidate for an OS which is written in C (such as mine). It is much simpler to compile (not huge toolchain, etc)
compared to what? the popular alternative is GCC -- DJGPP is GCC -- the only difference between DJGPP and cygwin is that DJGPP is (usually) using an older version of the same compiler
As mentioned, it supports elf filse, and is pretty small, so it wouldn't be a bad option for a person new to OS dev, since elf seems to be the prefered format. I am not 100% sure of all it's capabilities (like position independant code, etc).
its capabilities are exactly the same as any other version of GCC...
I am good with djgpp for now, it does what i need, and i don't have issues, i run it off my thumb-drive and it compiles my OS fine under 98,2k,xp, and vista (as well as dos, but I don't typically use it under dos).
as i said, i would never think of suggesting that an experienced OSdever should change their existing and working environment, but to suggest that people running one OS, should start by installing an emulator for another OS, and run that inside another emulator for yet another OS, just to run the compiler in it... especially when the exact same compiler is readily available natively for the OS they are actually running, i just dont think its a very good idea

Posted: Thu Jun 05, 2008 9:28 am
by Ready4Dis
JAAman wrote:
I don't see it as a bad option for new people, i found it very simple to get working, and it can output coff or flat binaries easily...

...It is an optimizing compile, not positive how well it optimizes comparitevely, but i know it does well. It can also compile itself, so it's a perfect candidate for an OS which is written in C (such as mine). It is much simpler to compile (not huge toolchain, etc)
compared to what? the popular alternative is GCC -- DJGPP is GCC -- the only difference between DJGPP and cygwin is that DJGPP is (usually) using an older version of the same compiler
As mentioned, it supports elf filse, and is pretty small, so it wouldn't be a bad option for a person new to OS dev, since elf seems to be the prefered format. I am not 100% sure of all it's capabilities (like position independant code, etc).
its capabilities are exactly the same as any other version of GCC...
Sorry for the confusion, these were referring to Tiny C, not GCC (the capabilities of Tiny C may not be as extensive as GCC). I was talking about tiny C in both those statements, I was saying that it's much easier to compile than GCC, it's more compact and doesn't have a huge toolchain.
JAAman wrote: as i said, i would never think of suggesting that an experienced OSdever should change their existing and working environment, but to suggest that people running one OS, should start by installing an emulator for another OS, and run that inside another emulator for yet another OS, just to run the compiler in it... especially when the exact same compiler is readily available natively for the OS they are actually running, i just dont think its a very good idea
Who said anything about 'installing' an emulator for another OS to run inside of another emulator? I'm pretty sure copying djgpp to a thumb drive and running it doesn't constitute running it under an emulator as you are suggesting. Does it use a DPMI (dos protected mode interface), yes, it does for certain parts, but it compiles plenty fast for me, very easy to setup (just basic set 2 path variables and use) and get started, and once you compile code, it is just the same as using any other version of the software. How many 'how do I make a cross compiler' questions do we get on here? Even after they've read the links, and wiki, they still make mistakes on it, because it's a pain. Like I said, I have had no issues with djgpp so far, and will use it until i change file formats (still not sure which one, not many support multiple sized relocations like a.out does). I have no problems recommending djgpp as a quick and dirty start for OS dev, although you do lose the benefit of using GRUB (since it is coff format). different people have different desires/knowledge levels, what is wrong with starting with something simple (set a 2 path variables, and run). Anyways, i'm done with this discussion, sorry for going off topic, the discussion is free-basic, I am not that familiar with it, but it sounds as though you need a cross compiler for it, so using djgpp is a mute point anyways.

Posted: Fri Jun 06, 2008 11:37 am
by babylon2233
Why don't you just switch to Unix-like OS? or dual-boot..maybe?