【发布时间】:2013-03-12 04:57:12
【问题描述】:
我正在尝试编写一个在 x86 汇编 (MASM) 中添加两个大数的子例程。数字由 si 和 di 寄存器指向,函数应该从右到左迭代,添加每个数据字并传递进位,并将结果保存在 di 中。要添加的数据字数由前一段代码决定。
...
mov cx, ( number of data words to add )
adding:
mov bx,cx ;copy the loop counter to bx
lea ax,[di+2*bx] ;move ax to the destination word
adc ax,[si+2*bx] ;add the source word into the destination word
loop adding ;main sub loop
...
不幸的是,当我尝试编译此代码时,我收到错误 A2032:lea 和 adc 行上的寄存器使用无效。我使用的语法有什么问题?
【问题讨论】:
-
重复问题。总结:寄存器*2是80386+的一个特性,它使用32位寄存器。也使用 mov 代替 lea。
-
修改标题:原标题与问题关系不大。这也是这个问题的十几个重复的问题——这是一个双周循环的主题。