[comp.os.msdos.programmer] Need help with 386 asm for 32-bit segments

REIDMP@MAINE.BITNET (Reid M. Pinchback) (03/13/91)

Though I've done enough 86/286 asm in past, I'm new to the 386.
I've scanned assorted books/manuals on 386 asm.  I want to use
32-bit segments, but I'm not sure how to set them up.  Getting
the assembler to assume 32-bit segments is easy enough, but it
has much the same effect as an ASSUME for segment registers (you
still need to stuff the segregs with the ASSUME'd value).  How
do I actually make the seg's function in 32-bit mode?  Can this
be done in real mode, or do I need to go to all the grief of
figuring out how to cope with protected mode?
 
Code samples much appreciated, as are any pointers to a FAQ
that covers this.  I've scanned some FTP sites like Simtel for
help, and haven't had any luck.
 
Thanx in advance
                Reid

rcollins@altos86.Altos.COM (Robert Collins) (03/15/91)

In article <91071.130848REIDMP@MAINE.BITNET> REIDMP@MAINE.BITNET (Reid M. Pinchback) writes:
>Though I've done enough 86/286 asm in past, I'm new to the 386.
>I've scanned assorted books/manuals on 386 asm.  I want to use
>32-bit segments, but I'm not sure how to set them up.  
>Can this be done in real mode, or do I need to go to all the grief of
>figuring out how to cope with protected mode?

The 32-bit segment flag is only contained in a '386 descriptor table entry.
Therefore, you must be in protected mode to execute 32-bit code.  You
can use 32-bit operands in real-mode simply by using a 'USE16' segment
and write code using 32-bit operands.  32-bit code is different than
using 32-bit operands.  32-bit code, in addition to defaulting to 32-bit
operands, uses different encodings on some of the CPU instructions.
Therefore there is a need to tell the compiler which version of the
opcodes to compile.


-- 
"Worship the Lord your God, and serve him only."  Mat. 4:10
Robert Collins                 UUCP:  ...!sun!altos86!rcollins
HOME:  (408) 225-8002
WORK:  (408) 432-6200 x4356

phaethon@kontu.utu.fi (Timo Eronen, Space Research Laboratory, University of Turku, Finland.) (03/15/91)

In article <91071.130848REIDMP@MAINE.BITNET>, REIDMP@MAINE.BITNET (Reid M. Pinchback) writes:
> Though I've done enough 86/286 asm in past, I'm new to the 386.
> I've scanned assorted books/manuals on 386 asm.  I want to use
> 32-bit segments, but I'm not sure how to set them up. 
>
> .
> .
> .
> 
> Thanx in advance
>                 Reid

Read article "Four Gigabytes in Real Mode" by Tom Roden in "Programmer's
Journal" volume 7.6 (late '89).
-tke, phaethon@utu.fi