yeah i can't find this on google but

i understand how to output data using 16bit (with int 21h/ah=02)

say im doing some math calculations, how can i output something in a 32bit register (eax, edx...)?

7 Years
Discussion Span
Last Post by NotNull

You aren't being very clear!

If you are using a more recent computer but somehow using an old DOS interface and not in an emulator, then you can use 32-bit instructions in Real Mode. An operand size instruction 66h is inserted before an instruction to command the processor to do a 32-bit operation instead of a 16-bit instruction. BUT this allows you to do 32-bit math. Memory addressing is done with a 67h but not applicable as in 16-bit mode when in Real mode.

From 32-bit code

mov eax,3
  66h mov ax,3

From 16-bit code

66h mov eax,3
  mov ax,3

Edited by wildgoose: n/a



mov cx, 0x10
mov ax, 0x123
db 0x66
shl ax, cl ; shift 0x123 into high-word of EAX
db 0x66
shr ax, cl ; shift back into low-word of EAX, that is, AX

You would need to use bitshifting to extract the values
of the registers 32-bit counterpart's high-words.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.