Using Turbo C++
Using Turbo C++
Hello. I am trying to build an operating system and I want to know if I can use the Borland Turbo C++ compiler for OS Development. I want to use it because I use the TASM syntax and I don't want to change to AT&T syntax right after I become fluent in Intel ASM. Please help me out. Thanks.
Re: Using Turbo C++
Well, I'm not sure if you can use Turbo C++, but you can use Visual C++(which uses (I think)the MASM asm syntax, which is pretty close to the TASM syntax).
http://wiki.osdev.org/Visual_Studio
http://www.brokenthorn.com/Resources/OSDevMSVC.html
http://wiki.osdev.org/Visual_Studio
http://www.brokenthorn.com/Resources/OSDevMSVC.html
OS-LUX V0.0
Working on...
Memory management: the Pool
Working on...
Memory management: the Pool
Re: Using Turbo C++
Turbo C++ is a real mode compiler for DOS. So I'd say no, you cannot use it for OS development. As for your concern of Intel vs. AT&T syntax:TheDragon wrote:Hello. I am trying to build an operating system and I want to know if I can use the Borland Turbo C++ compiler for OS Development. I want to use it because I use the TASM syntax and I don't want to change to AT&T syntax right after I become fluent in Intel ASM. Please help me out. Thanks.
1) In most cases, you'll have small(ish) ASM routines you want to call from C. In that case, use a seperate ASM file instead of inlining the ASM, and use nasm instead of gas for compilation. nasm uses Intel syntax just like tasm.
2) Even when inlining, it is possible to use Intel syntax. It's a little cumbersome though, in that for each block of ASM code you'll need to tell the compiler at the start to use Intel syntax, and at the end to use AT&T syntax; that can be solved relatively easy by useing some clever #define-s though. Also, it should theoretically be possible to do without, and to tell GCC to use Intel syntax as well in output, but I have never tried.
JAL
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Using Turbo C++
Turbo C is a compiler for real mode applications.
Almost all other compilers are for protected mode.
And you don't need to use GAS with its ugly syntax - nasm or yasm will do (beware with masm: it has a controversial license effectively denying you to use it for OS development)
Almost all other compilers are for protected mode.
And you don't need to use GAS with its ugly syntax - nasm or yasm will do (beware with masm: it has a controversial license effectively denying you to use it for OS development)
Re: Using Turbo C++
your question is nearly my previous question in post:
returned value from custom interrupt
anyway, you can use TC++ to build your OS like my UNEXT/os
its completely written under real mode compiler (TC++3.1)with some cool code
to access all memory using flat-mode trick
guy's suggest me to use:
in gcc compiler command line,and gcc can handle INTEL op-code
but most OS projects prefer using gcc,because it's protected mode
compiler ,and give your OS the power instead of FLAT-mode,
Finaly, it's your choice to select your compiler
returned value from custom interrupt
anyway, you can use TC++ to build your OS like my UNEXT/os
its completely written under real mode compiler (TC++3.1)with some cool code
to access all memory using flat-mode trick
guy's suggest me to use:
Code: Select all
-masm=intel
but most OS projects prefer using gcc,because it's protected mode
compiler ,and give your OS the power instead of FLAT-mode,
Finaly, it's your choice to select your compiler
Distance doesn't make you any smaller,
but it does make you part of a larger picture.
but it does make you part of a larger picture.
- codemastersnake
- Member
- Posts: 148
- Joined: Sun Nov 07, 2004 12:00 am
- Contact:
Re: Using Turbo C++
TheDragon wrote:Hello. I am trying to build an operating system and I want to know if I can use the Borland Turbo C++ compiler for OS Development. I want to use it because I use the TASM syntax and I don't want to change to AT&T syntax right after I become fluent in Intel ASM. Please help me out. Thanks.
Yes you can very well write an OS using Turbo C++ 3.0. I used it wto develope 'nOS' when I was in 11th grade. The only problem you'll face is that you'll only be able to write a 16bit Kernel. To write a 32bit kernel you'll have to shift to other compiler like gcc.
Re: Using Turbo C++
Thank you SO much for the help thus far. Now I have more questions:
1) Can't Turbo C++ 5 do 32 bit? I'm planning on using it or the newest free IDE (2006). Could it also do 64 bit? It'd be nice to encourage the CPU Manufacturers to
hurry up on advancing past 32 bit processors .
2) How would I use NASM separately? Would I compile it into DLLs first? Wouldn't it all be faster if I compiled it all at once?
3) Can I even USE DLLs? Or do I have to write the code to run them too? (Please say and mean no )
1) Can't Turbo C++ 5 do 32 bit? I'm planning on using it or the newest free IDE (2006). Could it also do 64 bit? It'd be nice to encourage the CPU Manufacturers to
hurry up on advancing past 32 bit processors .
2) How would I use NASM separately? Would I compile it into DLLs first? Wouldn't it all be faster if I compiled it all at once?
3) Can I even USE DLLs? Or do I have to write the code to run them too? (Please say and mean no )
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Using Turbo C++
First hit on google for Turbo C++ 5.0:
For the rest, Borland C++ 5.x seems to be indeed a 32-bit compiler, but for the rest I don't know how its compiling and linking mechanisms work (I did find that it got some nasty compiler bugs). Given that, I would seriously recommend GCC.
As for NASM: many projects consist of more than one file - each file is compiled in turn, and then in the end everything is linked together. So instead of having just a C-only project, you have a project with C and ASM files. That means you don't need DLLs (which would give you trouble anyways)
Some further investigation showed that the thing officially isn't called Turbo C++ at that version...I am using Turbo C++ 5, which doesnot allow me to use "namespace std" etc.
For the rest, Borland C++ 5.x seems to be indeed a 32-bit compiler, but for the rest I don't know how its compiling and linking mechanisms work (I did find that it got some nasty compiler bugs). Given that, I would seriously recommend GCC.
As for NASM: many projects consist of more than one file - each file is compiled in turn, and then in the end everything is linked together. So instead of having just a C-only project, you have a project with C and ASM files. That means you don't need DLLs (which would give you trouble anyways)
- codemastersnake
- Member
- Posts: 148
- Joined: Sun Nov 07, 2004 12:00 am
- Contact:
Re: Using Turbo C++
I would really suggest you that you should shift to gcc/ld/nasm environment for your os development. This is because you'll able to find out support for all the errors, bugs you encounter during development, here.TheDragon wrote:Thank you SO much for the help thus far. Now I have more questions:
1) Can't Turbo C++ 5 do 32 bit? I'm planning on using it or the newest free IDE (2006). Could it also do 64 bit? It'd be nice to encourage the CPU Manufacturers to
hurry up on advancing past 32 bit processors .
2) How would I use NASM separately? Would I compile it into DLLs first? Wouldn't it all be faster if I compiled it all at once?
3) Can I even USE DLLs? Or do I have to write the code to run them too? (Please say and mean no )
Re: Using Turbo C++
So what you're saying that I like compile the NASM sources into an object file, and then compile and link them all with GCC. Right?
Oh, BTW, if I can do something like that, I'd plan on using Dev-C++ or something like that.
But can I use DLLs?
Oh, BTW, if I can do something like that, I'd plan on using Dev-C++ or something like that.
But can I use DLLs?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Using Turbo C++
Yes you can use DLLs. But you're probably asking the wrong question here.TheDragon wrote:can I use DLLs?
Re: Using Turbo C++
TC 5 is win32 Compiler,that meanTheDragon wrote: Can't Turbo C++ 5 do 32 bit? I'm planning on using it or the newest free IDE (2006)
- TC 5 generate PE(protable executable) image
- Use windows API
if you use such compiler you need to:
- load PE image from your boot loader
- shut all external API (I think it's the very hard part,cause win32 application depend on windows 99.9%)
I think he is rightSnake wrote: I would really suggest you that you should shift to gcc/ld/nasm environment for your os development
Distance doesn't make you any smaller,
but it does make you part of a larger picture.
but it does make you part of a larger picture.
- codemastersnake
- Member
- Posts: 148
- Joined: Sun Nov 07, 2004 12:00 am
- Contact:
Re: Using Turbo C++
Ans: Exactly!TheDragon wrote:So what you're saying that I like compile the NASM sources into an object file, and then compile and link them all with GCC. Right?
I doubtTheDragon wrote:Oh, BTW, if I can do something like that, I'd plan on using Dev-C++ or something like that.
But can I use DLLs?
Re: Using Turbo C++
Yes, you will probably need to implement PE support in your boot loader, but I would argue with the other point (that it's hard to do). You can write code that doesn't depend on any Windows API even with MSVC (I compile the 32-bit and 64-bit portions of my boot loader with MSVC, so it is definitely possible). So you should be able to do it with Turbo C either.AhmadTayseerDajani wrote:TC 5 is win32 Compiler,that meanTheDragon wrote: Can't Turbo C++ 5 do 32 bit? I'm planning on using it or the newest free IDE (2006)
- TC 5 generate PE(protable executable) image
- Use windows API
if you use such compiler you need to:
- load PE image from your boot loader
- shut all external API (I think it's the very hard part,cause win32 application depend on windows 99.9%)
However, since most people here seem to use GCC, if you want others to compile your code with minimum hassle, you should switch over to GCC.
Re: Using Turbo C++
I know you've had a couple of answers relating to this already, but perhaps you need to think what happens when you use a DLL (or SO).TheDragon wrote:But can I use DLLs?
Your OS will (probably) consist of a kernel (+- modules) loaded in to memory by a boot loader. When you try to use a DLL, your host environment usually takes care of loading and linking with the DLL.
Now, because you are in an unhosted environment, your kernel will need to perform the dynamic loading and linking. This means that any disk drivers to access the DLL must be either loaded by the boot loader, or must be statically linked with your kernel. In addition, the dynamic linker itself MUST be statically linked (think about it ).
All of the above means that while you can use DLL's, you won't actually be using them until you have a few other things in place.
Cheers,
Adam