I have see the osfaq about using C++ for os design. It need to modify a little bit for using C++. However, the version for faq is for djgpp and it is 32Bit.
Now, I am developing a os that is real mode. The background is:
Compiler: Nasm, Turbo C++ 3.0
CPU: Pentium 433Mhz
Developing platform: Window XP
OS design: Real mode, maybe like the first version of old Dos.
So, how to make my os design using Object Oriented Design. I am using Turbo C++, not djgpp. Have anybody done that before.
Thank you for answering my question.
Using C++ in real mode(Turbo C++)
Re:Using C++ in real mode(Turbo C++)
if turbo c++ is so uncommon, use djgpp, or just use 'c'.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Using C++ in real mode(Turbo C++)
actually, the scope of the whole FAQ is ia32 protected mode OS development. Though borland's Turbo C++ is quite a different beast, the idea is roughly the same:
- find a loader that supports your compiler's output. EXE bootloaders were quite common a few years ago and i'd say XOSL should still support it.
- isolate the requirement to support language runtime (like malloc) and provide substitutes for them.
- Check if you can disable what you don't need (exceptions, rtti and other complex stuff)
- find a loader that supports your compiler's output. EXE bootloaders were quite common a few years ago and i'd say XOSL should still support it.
- isolate the requirement to support language runtime (like malloc) and provide substitutes for them.
- Check if you can disable what you don't need (exceptions, rtti and other complex stuff)
Re:Using C++ in real mode(Turbo C++)
Asuming that you have the IDE with it, look at the command line help
Re:Using C++ in real mode(Turbo C++)
http://www.invalidsoftware.net/os/?the_id=11
The URL above is about writing a kernel in C++, it is for 32bit Djgpp. It is the nearest resource I get. I try to use it's concept in my real mode kernel. But I need some hand.
The first problem, Turbo C++ don't have objdump, the nearest tool I get is objxref, and it is the dump file I get.
_kk is the test class I create, do you have any idea how to use of the data above.
Or any other tool that can dump the object file with OMF format.
#2 I have some question, first, what is BSS. And another thing, when the linker link the object file, will it collect all the global data and put all of then in some place. Or we need to setup where to put the global data in some place.
Thank you for answering my question. I know it is hard to solve it, but any help will be nice.
The URL above is about writing a kernel in C++, it is for 32bit Djgpp. It is the nearest resource I get. I try to use it's concept in my real mode kernel. But I need some hand.
This is what I get from the tutorial. So, for the first step, I need to check if the .ctors and .dtors(It may be other name in my object file that create from Turbo C++) is in the obj file. However, the object file I create from the Turbo C++ is OMF format, Djgpp can't read OMF format.objdump -h Kernel.o > Kernel.dis
Redirects the output of objdump to a file named Kernel.dis
Step 4 - Open the Kernel.dis with a text editor (Notepad, WordPad, my preferred choice is TextPad)
Look for something like this in the file
7 .ctors 00000004 000000f4 000000f4 00000294 2**2
CONTENTS, ALLOC, LOAD, RELOC, DATA
8 .dtors 00000004 000000f8 000000f8 00000298 2**2
CONTENTS, ALLOC, LOAD, RELOC, DATA.
If they are present, you can use solution 1.
The first problem, Turbo C++ don't have objdump, the nearest tool I get is objxref, and it is the dump file I get.
Code: Select all
WARNING: Unresolved symbol operator new(unsigned int) in module TTTT
WARNING: Unresolved symbol operator delete(void near*) in module TTTT
WARNING: Unresolved symbol _printf in module TTTT
PUBLIC SYMBOL DEFINITIONS BY SYMBOL NAME
SYMBOL DEFINED IN
operator delete(void near*) -undefined-
operator new(unsigned int) -undefined-
_kk TTTT
_main TTTT
_printf -undefined-
PUBLIC SYMBOL DEFINITIONS BY MODULE NAME
MODULE: -undefined- defines the following symbols
operator delete(void near*)
operator new(unsigned int)
_printf
MODULE: TTTT defines the following symbols
_kk
_main
EXTERNAL SYMBOL REFERENCES BY MODULE NAME
MODULE: -undefined- references the following symbols
MODULE: TTTT references the following symbols
operator delete(void near*)
operator new(unsigned int)
_printf
PUBLIC SYMBOL DEFINITION AND REFERENCES BY SYMBOL NAME
operator delete(void near*) (-undefined-)
TTTT
operator new(unsigned int) (-undefined-)
TTTT
_printf (-undefined-)
TTTT
MODULE SIZES BY SEGMENT
_BSS, PUBLIC
0 (00000h) total
_DATA, PUBLIC
22 (00016h) TTTT
22 (00016h) total
_EXIT_, PUBLIC
6 (00006h) TTTT
6 (00006h) total
_INIT_, PUBLIC
6 (00006h) TTTT
6 (00006h) total
_TEXT, PUBLIC
48 (00030h) TTTT
48 (00030h) total
MODULE SIZES BY CLASS
BSS
0 (00000h) total
CODE
48 (00030h) _TEXT, TTTT
48 (00030h) total
DATA
22 (00016h) _DATA, TTTT
22 (00016h) total
EXITDATA
6 (00006h) _EXIT_, TTTT
6 (00006h) total
INITDATA
6 (00006h) _INIT_, TTTT
6 (00006h) total
UNREFERENCED PUBLIC SYMBOLS BY MODULE NAME
MODULE: TTTT defines the following unreferenced symbols
_kk
_main
Symbols = 5
Modules = 2
Segments = 5
Classes = 5
Or any other tool that can dump the object file with OMF format.
#2 I have some question, first, what is BSS. And another thing, when the linker link the object file, will it collect all the global data and put all of then in some place. Or we need to setup where to put the global data in some place.
Thank you for answering my question. I know it is hard to solve it, but any help will be nice.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Using C++ in real mode(Turbo C++)
i suggest you get a copy of "linkers and loaders" (free pdfs around) and digest that first. I also suggest you really check your motivation for 16 bits (you do whatever you want, but considering the difficulty to get good tools, etc. does it really worth the pain ? what do you want to do that couldn't be done easily in 32 bits ?)
you may also wish to get a copy of OMF file format (e.g. at "wotsit.org")
you may also wish to get a copy of OMF file format (e.g. at "wotsit.org")