• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Another ASM question

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Bmxpunk86pl

Member
Joined
Sep 7, 2001
Location
CT/Poland
why is it that some people in their code do this:

mov bx, ax
mov cx, bx

instead of just doing

mov cx, ax?


Why just take that extra step?


Thanks,
adam
 
Maybe they are typically doing some other operation on it while it is in BX? You can't do an op on something out in memory, you have to copy it to a register first. I.e., copy something to AX. Multiply it with something else and store that in BX. Do something else and store that result in CX.
 
I think this is what XW said but i'll repeat it again to clarify it for myself. I've only started the assembly course this semester so i'm not terribly sure if this is completely accurate but this is my understanding.

You can't move something from one point in memory to another therefore you have to use a register as the intermediate step.

mov ax,[mem1]
mov [mem2],ax
 
Back