在两个内存地址之间移动 [英] MOVing between two memory addresses
问题描述
我正在尝试学习汇编语言(所以请多多包涵),并且在此行上出现编译错误:
I'm trying to learn assembly (so bear with me) and I'm getting a compile error on this line:
mov byte [t_last], [t_cur]
错误是
error: invalid combination of opcode and operands
我怀疑导致此错误的原因仅仅是mov指令无法在两个内存地址之间移动,而是半小时的谷歌搜索,而我却无法确认这一点-是这种情况吗?
I suspect that the cause of this error is simply that its not possible for a mov instruction to move between two memory addresses, but half an hour of googling and I haven't been able to confirm this - is this the case?
此外,假设我是对的,这意味着我需要使用寄存器作为复制内存的中间点:
Also, assuming I'm right that means I need to use a register as an intermediate point for copying memory:
mov cl, [t_cur]
mov [t_last], cl
推荐使用什么寄存器(或者我应该使用堆栈)?
Whats the recommended register to use (or should I use the stack instead)?
推荐答案
您的怀疑是正确的,您不能从一个内存转移到另一个内存.
Your suspicion is correct, you can't move from memory to memory.
任何通用寄存器都可以.如果不确定寄存器中的内容,请记住按一下寄存器,并在完成后将其恢复.
Any general-purpose register will do. Remember to PUSH the register if you are not sure what's inside it and to restore it back once done.
这篇关于在两个内存地址之间移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!