Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在汇编上写了交换,但我不确定我的代码是否正确,这是代码
swap: mov r1, -(sp) mov (sp) r1 mov 2(sp) (sp) mov r1 2(sp) mov (sp)+, r1 rts pc
交换从堆栈接收指针
sp 是堆栈指针吗?通常有命令ldw rA, 0(rB)(0 是偏移量,rB 是您将从中加载的地址,实际数据现在在 rA 中)。ldw 将整个字加载到内存中,ldb 加载一个字节,stw rA, 0(rB)存储一个字。mov通常将一个寄存器复制到另一个。
ldw rA, 0(rB)
stw rA, 0(rB)
mov