mod reg r/m question

Programming, for all ages and all languages.
Post Reply
User avatar
Masterkiller
Member
Member
Posts: 153
Joined: Sat May 05, 2007 6:20 pm

mod reg r/m question

Post 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:
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Post 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.
Post Reply