Unreal Mode: Difference between revisions

no edit summary
[unchecked revision][unchecked revision]
m (Reverted edits by Thepowersgang (talk) to last revision by Octocontrabass)
No edit summary
Line 116:
WARNING: this may not work on some emulators or some hardware. This is because of direct 32bit PMODE -> (Un)real mode.
 
==Compiler Support==
===Smaller C===
The [[Smaller C]] compiler supports unreal mode. It produces [[MZ]] executables for unreal mode (can be loaded with [[BootProg]]).
 
The code and the stack are to be located below the 1MB mark and the stack size is limited by 64KB (IOW, there's nothing unusual about CS:(E)IP, SS:(E)SP, it's a natural setup for MZ executables in DOS). The DS and ES segment registers are set to 0, so C pointers can work as flat 32-bit physical addresses and address data or memory-mapped devices anywhere in the first 4GB of memory.
 
The startup code of these executables performs the necessary relocation (there are only custom relocations and no standard MZ relocations, which may simplify loading of the executables) and sets up unreal mode before passing control to the equivalent of main. See ''srclib/c0du.asm'' and other C/assembly code under ''srclib'' in the compiler source tree for how to write bits of assembly code for unreal mode (look for ''asm("inline asm code")'' under ''#ifdef __UNREAL__'').
 
You can try out unreal mode in DOS (e.g. in DOSBox, VirtualBox + FreeDOS) as the compiler fully supports the DOS + unreal mode combo in its C library. ''tests/vesalfb.c'' is a simple example of setting up a [[VESA]] graphics mode and drawing something on the screen.
[[Category:X86 CPU]]
[[Category:FAQ]]
Anonymous user