Page 3 of 3

Re: Using Turbo C++

Posted: Mon Dec 08, 2008 6:51 am
by DeletedAccount
Hi,
It is possible to write an OS in Turbo C . See FreeDos kernel as an example , also pdos . I used trubo C for writing my first operating system . The only problem is that i got somewhat addicted to bad turbo habits .. like accessing registers with _AX = 5 ; etc and that really leads to non portable code .


Regards
Shrek

Re: Using Turbo C++

Posted: Tue Dec 09, 2008 9:18 am
by i586coder
Shrek wrote: It is possible to write an OS in Turbo C .
sure, my OS kernel "UNEXT/os" it's completely written under turbo c 3.1
Shrek wrote: The only problem is that i got somewhat addicted to bad turbo habits .. like accessing registers with _AX = 5 ; etc and that really leads to non portable code .
i don't see any problem or bad turbo habits if you e.g "accessing registers with _AX = 5", it may an advantage of turbo C to access
regs in that simple way, about portable code, also no problem use
external NASM source to code your assembly chunk, & link it to your
C file, that make it 99% protable to other compilers

CheerS,
a.T.d

Re: Using Turbo C++

Posted: Tue Dec 09, 2008 4:43 pm
by pcmattman
You could write a macro to make things portable:

Code: Select all

#ifdef TURBOC // or some other thing ala GNUC
#    define SetAX(a) (_AX = a)
#endif
You can then add an #elif too for things like GNU C and other compilers (that might use inline assembly). It'll do the same thing, in a far more portable way.

Re: Using Turbo C++

Posted: Tue Dec 09, 2008 6:16 pm
by tantrikwizard
TheDragon wrote:Though I confess I haven't done much research on that
Obviously, save yourself some typing and us some reading and do some simple research. Start here:
http://wiki.osdev.org/Getting_Started
next here
http://wiki.osdev.org/Beginner_Mistakes
next here
http://wiki.osdev.org/Rolling_Your_Own_Bootloader
Every answered you seek has been posted numerous times and is quickly found in the wiki or by searching the forum

Re: Using Turbo C++

Posted: Thu Dec 11, 2008 9:19 pm
by TheDragon
GREAT! I can use Turbo C!!!!!! This is a great joy to me, thanks, shrek. :D :D :D :D :D :D . Now, the question is, can I use TASM syntax and just tasm whatever into .o and then tcc whatever.o whoever.cpp to get my kernal code? And then I have to put a special header on it to load it with grub, right? That would be awesome. Also, the specs for the header is in the muliboot spec, right? I'm printing that as I type. Also, how exactly would I configure Turbo C++ to output the right format (I think bin is one...)? Thank you so much.

Re: Using Turbo C++

Posted: Thu Dec 11, 2008 9:38 pm
by DeletedAccount
Hi,
You need to know that turbo C ( versions <= 3) are 16 bit compilers , they only generate 16 bit code . Using grub is not really an option , you need to probably roll your own bootlolader :D .You can off course tasm or nasm with Turbo C


Regards
Shrek