[comp.sys.ibm.pc.programmer] Code to change from real mode to protected mode

rhl@computing-maths.cardiff.ac.uk (Robert Hartill) (04/04/91)

Can someone send (e-mail) me some code to switch to protected mode on a '386 

I'm not bothered about returning to real-mode, or returning to DOS,
'cos I don't intend doing so.

Commented code would be appreciated.

------
While I'm here, has anyone had any success writing protected mode programs
using Zortech DOS 386, that DON'T use the Phar Lap Dos Extender..
- I'm trying to do this, I won't make use of any library routines, or the
memory management system. I'm writing an operating system.

I can get 32-bit / '386 code, which needs the Extender,
I've managed to *cut* my code out of the .EXP file, and make it into a .COM
file, but then it runs in REAL-MODE. (Hence my request for switching code)

Can anyone suggest a better method ? (No 'use another compiler' type replies
please)

Thanks in advance
		robert.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::     Robert Hartill, Dept Of Computing Mathematics, UWCC, Cardiff, UK.     ::
::          e-mail : rhl@cm.cf.ac.uk         Fax : 0222 666182               ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
A verbal contract isn't worth the paper it's written on.
-Samuel Goldwyn.
-------------------------------------------------------------------------------

marcap@antares.concordia.ca ( MARC ANDREW PAWLOWSKY ) (04/06/91)

In article <1991Apr4.140649.27253@cm.cf.ac.uk> 
rhl@computing-maths.cardiff.ac.uk (Robert Hartill) writes:

> ...
>While I'm here, has anyone had any success writing protected mode programs
>using Zortech DOS 386, that DON'T use the Phar Lap Dos Extender..
>- I'm trying to do this, I won't make use of any library routines, or the
>memory management system. I'm writing an operating system.
>
>...
>Thanks in advance
>		robert.
>:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>::     Robert Hartill, Dept Of Computing Mathematics, UWCC, Cardiff, UK.     ::
>::          e-mail : rhl@cm.cf.ac.uk         Fax : 0222 666182               ::
I have used the compiler and it simply does not work.  The bugs I have found,
one of which has been confirmed by Zortech are in the function calling.

When a function is called, not all of the registers that are modified are 
saved, causing the statement following a function call to fail.

Related to this is that the values the functions use and thinks are in
registers, aren't.  So if you pass a parameter with a value of 1,
it becomes something like -1687736363 in the function.

Finaly, and probably for the same reason teh function addresses can get 
mixed up.  If the functions address was supposed to be in a register, or
the register is supposed to point to a virtaul table, then all may be
lost.  Two effects I have observed are for the program to bomb, by going
into never never land; and for the wrong function to be called.

For example given classes A and B, where B inherits from A.

virtual A::f()
// function body

virtual B::f() {
  A::f();
}

This code recursed endlessly in B::f, which is very wrong.

In summary, the compiler does not work and that is what is probably causing 
you trouble, rather than skipping the DOS EXTENDER (I was using Pharr Lap).

There are no fixes for these bugs, in fact there is no bug list, and
therefore no patches.


For those unbitten:

    DON'T BUY THIS PRODUCT.  IT DOES NOT WORK.
    If in doubt check the Zortech bulliten board, 
    where everybody has given up!

Marc Pawlowsky
Montreal, Quebec, Canada