我想学习如何用汇编语言映射数组(Motorola 68k)。
我正在尝试将数据寄存器D1中的值移动到内存中,并且我希望将值移动到的内存中的地址保存在A1中。此外,值得一提的是,A1地址指向一个大小为500字节的声明存储,这应该是我想要做的充足空间。我尝试以下方法:
moveq #0,D1 *moves value of 0 into D1
loop:
cmpi.w #10,D1 *checks if D1 is less than 10, else branch out to done
bge done
move.w D1,(A0) *moves 0 into address that A0 points to
*then I get stuck here. I want to increment the address value ++
*(or whatever size I have to, which I am guessing is 1 word, since I am using words), so
*that my values in memory are contiguous up to ten in memory,
*such as 00 01 02 03 04 05 06 07 08 09 0a
addq.w #1,D1 *D1 incremented by 1
bra loop *branch to loop again
done:
break
你能帮帮我吗?
谢谢!
答案 0 :(得分:1)
68k具有后增量寻址模式,您可以使用尾随+
指定该模式,如下所示:
move.w D1,(A0)+
引自M68000程序员参考手册:
使用操作数地址后,它会递增一,二或四,具体取决于操作数的大小:字节,字或长字。