8086 汇编:将字符串的一部分 MOV 到变量中
假设我有一串 ascii 字符,例如“652+346*779=”,并且我想将一些字符从这个变量移动到另一个变量...
缓冲区是字符串(在本例中为“652+346*779=” ”) lengthofnum 是相关数字的长度(在本例中 346 的长度为 3) A_ascii 是我试图将字符串“346”传输到的变量。
我有一个循环根本不起作用,而且我不知道应该使用什么寻址模式。 emu8086 讨厌我迄今为止尝试过的所有内容,并给我提供了有关 MOV 指令语法的错误
mov cx,lengthofnum
dumploop1:
mov bx, offset buffer
;dump the number from buffer into A_ascii
mov A_ascii[cx],[bx]+cx
loop dumploop1:
,我收到以下错误代码:
(672) wrong parameters: MOV A_ascii[cx],[bx]+cx
(672) probably it's an undefined var: A_ascii[cx]
Assuming I have a string of ascii characters such as "652+346*779=", and I want to move some characters FROM this variable TO another variable...
Buffer is the string (in this case "652+346*779=")
lengthofnum is the length of the number in question (in this case 346 has length 3)
A_ascii is the variable to which I'm trying to transport the string "346".
I have a loop that doesn't work at all, and I can't figure out what addressing mode I'm supposed to use. emu8086 hates everything I've tried so far, and gives me errors regarding my syntax with the MOV instruction
mov cx,lengthofnum
dumploop1:
mov bx, offset buffer
;dump the number from buffer into A_ascii
mov A_ascii[cx],[bx]+cx
loop dumploop1:
I get the following error codes:
(672) wrong parameters: MOV A_ascii[cx],[bx]+cx
(672) probably it's an undefined var: A_ascii[cx]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
与(显然)流行的看法相反,您可以在 x86 上执行直接 mem->mem 移动,而无需(显式)移入/移出寄存器。由于您已经有了 CX 的长度,因此您已经开始朝着正确的方向前进:
Contrary to (apparently) popular belief, you can do a direct mem->mem move on an x86, without (explicitly) moving to/from a register. Since you already have the length in CX, you're already started in the right direction:
您不能直接在两个指针之间移动。您需要将其移动到寄存器中进行临时存储:
如果您有两个要移动的内存块,通常的方法是这样的:
You can't directly move between two pointers. You need to move it into a register for temporary storage:
If you've got two blocks of memory that you want to move, the usual method is something like this: