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
swapはスタックからポインタを受け取ります
spはスタックポインターですか?通常、コマンドがありますldw rA, 0(rB)(0はオフセット、rBはロード元のアドレス、実際のデータはrAになります)。ldwはワード全体をメモリにロードし、ldbはバイトをロードし、stw rA, 0(rB)ワードを格納します。mov通常、あるレジスタを別のレジスタにコピーします。
ldw rA, 0(rB)
stw rA, 0(rB)
mov