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.
我已经搜索了一段时间,但我没有看到任何类似的东西。我知道您是否有一个数字(即它将在 R1 中),您实现该数字是奇数还是偶数的方式是检查寻找 0 或 1 的最后一个字节。我如何在 ARM 代码中编写它?我认为你必须将数字与“1”或类似的东西进行比较,但我不知道如何正确地做到这一点。
我想你正在寻找TST指导。尝试以下操作:
TST
TST R1, #1 ; at this point the Z flag will be set if R1 AND 1 is zero, i.e. if R1 is even, ; so you could do something like the following: BEQ number_is_even BNE number_is_odd