Hi,
I want to create a 16bit OS in C++.
Which parameter do i need for g++ (under linux) to create a bootable 16bit image?
thank you very much for you help
g++ 16bit
Re:g++ 16bit
As far as I understood it, GNU as (used as a backend for GCC) is unable to generate "pure" 16bit code, which would mean you're out of luck in generating 16bit code with GCC.
I might be wrong, though.
I might be wrong, though.
Every good solution is obvious once you've found it.
Re:g++ 16bit
gcc/gas provides the .code16, .code16gcc directives for producing 16 bit
code. LD provides a flat binary format for producing binary images.
You can read up about .code16 in the man pages.
code. LD provides a flat binary format for producing binary images.
You can read up about .code16 in the man pages.
Re:g++ 16bit
While GAS is capable of generating 16 bit code if you know exactly what you're doing as even .code16 doesn't guarantee your code will run on a 286, it's a different ballgame when you're using it in the GCC - GAS - LD toolchain.jinksys wrote: gcc/gas provides the .code16, .code16gcc directives for producing 16 bit
code.
GCC generates 32bit code per se, and even .code16gcc doesn't really help with that. From the binutils man's:
So, no luck in making G++ spit out 16bit code I'm afraid..code16gcc provides experimental support for generating 16-bit code from gcc, and differs from .code16 in that call, ret, enter, leave, push, pop, pusha, popa, pushf, and popf instructions default to 32-bit size. This is so that the stack pointer is manipulated in the same way over function calls, allowing access to function parameters at the same stack offsets as in 32-bit mode. .code16gcc also automatically adds address size prefixes where necessary to use the 32-bit addressing modes that gcc generates.
Every good solution is obvious once you've found it.