Problems in moving a register value to a memory address in assembly language using fasm assembler? -


i confused 1 thing. following book assembly programming x86 processors , reading mov instructions , how works. so, author said following instruction valid mov mem,reg.....basically moving register value memory address.

now tried , keep getting error called invalid operand. can please explain me error.

#fasm#   mov ax,[var] ;the value 67 moved ax register works perfect  mov myvar,ax ; aim move value 67 memory location of ;myvar keep getting error - invalid operand? why that?  var: dw 67    myvar: dw ? 

can try this:

mov [myvar], ax 
  • myvar constant holding address of memory allocated variable.
  • [myvar] instructs fetch/store value in memory @ address pointed myvar

so:

mov ax, myvar  ; load address of myvar in ax mov ax, [myvar]; load value stored @ address myvar mov [myvar], ax; store value of ax @ address myvar 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -