flat assembler
Message board for the users of flat assembler.

Index > DOS > Referencing arithmetic operation as memory location

Author
Thread Post new topic Reply to topic
Phirrule



Joined: 14 May 2020
Posts: 1
Location: United States
Phirrule
Is it possible to use the result of a arithmetic operation as a memory location?

For instance:
Code:
mov [bx + 4096], [bx + 32768]    


In the second operand, can I perform an arithmetic operation while making it still reference a memory location. Like moving data from a memory location to another memory location while performing an offset on the register that references it.
Post 14 May 2020, 07:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
Memory-to-memory moves are only supported with push/pop and movs
Code:
push [bx+offset] ;[bx] to [sp]
movsb ; [si] to [di]    
Post 14 May 2020, 07:18
View user's profile Send private message Visit poster's website Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 385
Ali.Z
its possible, but not in the form you posted.

you will have to use string instructions such as MOVSB/MOVSW, but you will have to initialize both SI and DI registers first.

using movs? example:
Code:
lea si,[bx+8000h]
lea di,[bx+1000h]
movsb ; movsw to move WORD sized data (16-bits)    

_________________
Asm For Wise Humans
Post 14 May 2020, 07:24
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.