Page 1 of 1

mod reg r/m question

Posted: Sat Jun 23, 2007 6:11 am
by Masterkiller
I did notice an strange thing while programming a boot sector. I expected that real mode is the same as 16-bit mode (Real mode forces processor to execute instruction like 8088/8086 processors). So for example the dump of one instruction in my program in windows looks like this:

Code: Select all

00 00    ADD byte ptr[eax], al
use raw write on diskette and start it like boot sector, assuming this result:

Code: Select all

00 00    ADD byte ptr[ax], al
but it isn't right. In real mode instruction becomes:

Code: Select all

00 00    ADD byte ptr[bx+si], al
just like protected mode:

Code: Select all

67 00 00    ADD byte ptr[bx+si], al
Is there a list of mod reg r/m in real mode?
I found some information over internet how to convert opcodes to mod reg r/m but it is for protected 32-bit mode.

Sorry about bad english :oops:

Posted: Sat Jun 23, 2007 6:34 am
by jnc100
Intel manual, Vol 2A, section 2.1.3, Table 2.1 for 16-bit and table 2.2 for 32-bit.

Alternatively, see table 17-2 and 17-3.

Regards,
John.