Page 1 of 1

unreal mode

Posted: Mon Oct 03, 2005 4:16 am
by amitkumartiwari29
I am programming an unreal protected mode OS. Unreal mode is created when we switch from real mode to Protected mode and back to real mode. It offers 32 bit mode. The codes are available in assembly language. Please let me know the way to do it in C language. Also in unreal mode how can I create an array whose size is greater than 1 mb. I want this to be done without using the DOS memory manager. It should use the BIOS interrupts.

I am using Borland C to do this.

Re:unreal mode

Posted: Mon Oct 03, 2005 4:38 am
by Pype.Clicker
the main problem you'll face if you try to make an OS in unreal mode is that only 1MB is available for storing code and that code segments cannot be any bigger than 64K (iirc, in both real and unreal mode, only the lowest 16 bits of eip and esp are used), so the only things this mode is good at is
- loading plenty of things in high memory using BIOS/DOS calls
- writing to non-vga framebuffer (such as those 1280x1024x32bpp framebuffers located at physical address 0xf7000000)
- extend existing 16 bits software that need to work on documents larger than 1MB. Some old games/office tools have been using this back in early '90s.

You're likely to experience big troubles if you try to write C code for such an environment, mainly because your compiler is not aware of 32bits pointers in 16 bits code. There may be some compiler that can handle this, but none i'm aware of.

Re:unreal mode

Posted: Mon Oct 03, 2005 4:54 am
by Candy
amitkumartiwari29 wrote: Also in unreal mode how can I create an array whose size is greater than 1 mb.
Make pretend.

Code: Select all

char *some_array = (char *)0x100000;
pretends that at 0x100000 there's some_array. No point about size or anything, you don't have any guards.

Better methods include making a memory allocator etc. Still, it all comes down to make pretend.