【发布时间】:2013-02-22 18:02:35
【问题描述】:
如何交换地址中的值。目前我有 2 个包含地址的寄存器。然后我有 2 个临时变量来存储这些地址。然后我加载了值,因为我有地址。但我不知道如何交换值。我正在尝试进行冒泡排序。下面的代码是我目前拥有的
IF ;swapping condition
ST R2,idata ;temporily hold the smaller data
ST R1,imindata ;temporaily hold the larger data
ST R2,iminaddres ;store the values into that address
ST R2,iaddress ;finish the swaping of the two values
LD R1,iminaddres ;reput the address back into the register
LD R2,iaddres ;reput the address back into the register to be used for next cycle
【问题讨论】:
-
什么不起作用?你怎么知道它不起作用?