VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

Do opcodes 0FB7 and 0FBF(MOVS/ZX) in 16-bit mode function like a normal MOV(without sign extension to 32-bit, since it's from a 16-bit memory/register location to 16-bit register)? Or do they always extend to a 32-bit register, regardless of operand size?

I already implemented it in both 16-bit(plain MOV in effect) and 32-bit fashion(Sign/Zero extending to 32-bit), but I'm just double checking here.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 2, by Stenzek

User metadata
Rank Newbie
Rank
Newbie

As far as I can tell, 0FB6 extends 8-bits to the operand size, 0FB7 is always 16->32-bit. As the second operand of 0FB7 is 16-bit, it wouldn't make sense to zero-extend 16-bits to 16-bits.

Edit: Seems my implementation (and bochs) differs. 0FB7 with a 16-bit operand size is essentially a 16->16 MOV without affecting the upper bits. I think this is one of the cases where the documentation is confusing 😒

Reply 2 of 2, by peterferrie

User metadata
Rank Oldbie
Rank
Oldbie

0FB6 is an 8-bit extension to the operand size. 0FB7 is a 16-bit extension to the operand size. Both can be extended from 16-bit to 32-bit via override (or truncated from 32-bit to 16-bit).