How do I convert a register pair to an extended register?

I have this code snippet adapted from the pcasm book by Paul Carter:
mov bx, 10d
mov ax, 10d
mul bx ; multiplied by ax, stored in dx:ax

Now, how would I store the register pair dx:ax into, say, ecx?

Comments

  • [code]
    _32bit dd 0

    ...

    mov word ptr [_32bit], ax
    mov word ptr [_32bit+2], dx
    mov ecx, [_32bit]
    [/code]
  • A couple of other ways, which don't require a special memory register:

    PUSH DX
    PUSH AX
    POP ECX

    MOV CX,DX
    SHL ECX,16
    MOV CX,AX

    You could also just do something like this, if you don't need to preserve the EAX or EDX registers for some reason:

    MOV EAX,10d
    MOV EDX,10d
    MUL EDX
    MOV ECX,EAX
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories