In x86 assembly language, is there any way to obtain the upper half of the EAX register? I know that the AX register already contains the lower hal
EAX
AX
For 16-bit mode, this is the smallest (not fastest) code: only 4 bytes.
push eax ; 2 bytes: prefix + opcode pop ax ; 1 byte: opcode pop bx ; 1 byte: opcode
It's even more compact than single instruction shld ebx,eax,16 which occupies 5 bytes of memory.
shld ebx,eax,16