MaKiPL
MaKiPL

Reputation: 1200

MOV to variable pointer

I declared word at 0x7c02:

ramSpace: dw 0x500

Is it possible to directly change the memory at the address of which ramSpace points? Currently to change the memory at 0x500 I have to either:

MOV BX, [ramSpace]
MOV [BX], BYTE 01

or:

MOV [0x500], BYTE 01

However typing:

MOV [ramSpace], BYTE 01

changes the 0x7c02 value to 01 from 0x500. Is there a way to point to 0x500 from variable in memory? Something like this:

MOV [[ramSpace]], BYTE 01

Upvotes: 0

Views: 219

Answers (1)

Ruslan
Ruslan

Reputation: 19100

No, x86 doesn't have any instruction which would load a word from memory and use it as an address to access another word/byte of memory. You have to use an intermediate register to do this.

Upvotes: 2

Related Questions