Home > other >  Write data from a pointer to a local variable(another pointer) in assembler
Write data from a pointer to a local variable(another pointer) in assembler

Time:04-12

replace PROC
    enter 8, 0
    min_i equ [bp - 2]
    min equ [bp - 4]
    max_i equ [bp - 6]
    max equ [bp - 8]

    mov bx,offset ptr_arr

    mov [min_i],[bx]
    mov [max_i],[bx]

    ...

    leave
    ret
replace ENDP

The program works with matrices and ptr_arr stores the offsets of the first row.
In bx there is an offset that I want to move to min_i and max_i, but the program does not compile. Compiler writes error a2023 instruction operand must have size.
I tried using mov [min_i],WORD ptr bx, but in debug is looks like mov [bp - 2],bx without dereference for bxwhich I need.
Is it possible to do this in 1 line without transferring bx to the buffer and reading from there.
I'm using masm for ms-dos. Compiling with masm link in dosbox.

CodePudding user response:

In asm isn't possible to copy from memory to memory(from pointer to pointer) in one instruction. More info here x86 Assembly pointers

  • Related