Subject: Re: PXE boot loader?
To: Andrew Gillham <gillham@vaultron.com>
From: Frank van der Linden <fvdl@wasabisystems.com>
List: port-i386
Date: 09/11/2000 21:38:12
On Mon, Sep 11, 2000 at 03:30:15PM -0400, Andrew Gillham wrote:
 
> My assembler skills are very good, and this 16bit versus 32bit stuff
> (i.e. data32) has me confused and unable to make a simple 'int 0x10' call
> to print a byte reliably. :(

For a number of instructions (most notably mov), the data and address
size defaults to the default size set by the code segment (always 16
for real mode). For both data and address sizes, you can add a prefix
to override the size.

This prefix byte is 0x67 for addressing, and 0x66 for data. When in
16 bit mode, it will make the next instruction use 32 bits, and
vice versa.

Since you're in 16 bit mode, you will have to add a prefix each time
you want 32bit addressing/data.

If you keep it simple, that's all you need to know. Just don't use
any fancier compound indirect modes, because some are actually
different between real and protected mode (you gotta love it).

Have a look at sbin/fdisk/mbr/mbr.S, for example. Don't be put off
by the #define'd macros; I had to add those to be able to use some
shorter real mode instructions (prefixing takes up extra space and
space was short in the MBR).

- Frank