Im reading the intel manuals and there is a chart (Table 3-3) displaying Effective Operand and Address-Size attributes
can someone explain to me what this chart is showing? I can't make heads or tails of it. The paragraph before it was hard for me to understand as well. What im really trying to understand is what the Operand-Size Prefix 66h and Address-Size Prefix 67h are tehre for
D flag
- Firestryke31
- Member
- Posts: 550
- Joined: Sat Nov 29, 2008 1:07 pm
- Location: Throw a dart at central Texas
- Contact:
Re: D flag
The operand-size prefix lets you use eax and friends in real mode, or the real-mode versions of opcodes in pmode. I'd assume that the address-size prefix does something similar.
Technically it's 'make 16-bit opcodes behave like their 32-bit counterparts' or vice-versa (sp?).
Although someone with more familiarity with x86 ASM should comment on that, because I'm just going with what my limited experience with them has been.
Technically it's 'make 16-bit opcodes behave like their 32-bit counterparts' or vice-versa (sp?).
Although someone with more familiarity with x86 ASM should comment on that, because I'm just going with what my limited experience with them has been.
Owner of Fawkes Software.
Wierd Al wrote: You think your Commodore 64 is really neato,
What kind of chip you got in there, a Dorito?
Re: D flag
You're more or less right. The operand size prefix allows you to use 16 bit values as operands in 32 bit mode and vice versa. It's used whenever you work with 16 bit values in 32 bit mode.
The address size prefix allows you to use 16-bit addresses in 32 bit mode or 32-bit addresses in 16-bit mode. The former is pretty much pointless, but the latter might be used in the transition from real mode to protected mode, not sure there.
The address size prefix allows you to use 16-bit addresses in 32 bit mode or 32-bit addresses in 16-bit mode. The former is pretty much pointless, but the latter might be used in the transition from real mode to protected mode, not sure there.
Re: D flag
From long experience as an ASM programmer:
To simplify things into the real world: You will never ever want to use the address-size prefix under any circumstances.
For the operand prefix: When you are writing code that is supposed to run in Real Mode (16 bits) -- there are occasions when you want to use "normal" 32 bit instructions (rather than the very limited 16 bit instructions). Sometimes, you want to access a 32bit memory address (load, store, or modify with a 32bit register). Sometimes you just want to access the upper word of some 32bit register (why waste them if they are there?).
In 32bit mode, when you want to access a 16bit-size memory address (load, store, or modify with a 16bit register) you will also use an operand prefix. This is especially common with things like REP MOVSW.
To simplify things into the real world: You will never ever want to use the address-size prefix under any circumstances.
For the operand prefix: When you are writing code that is supposed to run in Real Mode (16 bits) -- there are occasions when you want to use "normal" 32 bit instructions (rather than the very limited 16 bit instructions). Sometimes, you want to access a 32bit memory address (load, store, or modify with a 32bit register). Sometimes you just want to access the upper word of some 32bit register (why waste them if they are there?).
In 32bit mode, when you want to access a 16bit-size memory address (load, store, or modify with a 16bit register) you will also use an operand prefix. This is especially common with things like REP MOVSW.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: D flag
you will use the address size prefix when you're in unreal mode and you want to access above the 1M limit (like in a32 o32 rep movs)