Unreal Mode: Difference between revisions

[unchecked revision][unchecked revision]
No edit summary
Line 122:
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 with the linear frame buffer enabled and drawing something on the screen in unreal mode.
[[Category:X86 CPU]]
[[Category:FAQ]]
Anonymous user