我想知道如何用arm汇编语言做模数。
我在arm网站上尝试过这个页面中的MOD算子代码:
MOV R1,#12 MOD 7 ; R1 = 5
MOV R2,#99 MOD 10 ; R2 = 9但它不组装。
我正在使用凯伊汇编程序。
发布于 2014-05-25 17:03:41
如果您正在寻找运行时模块而不是组装时,则可以使用以下两个指令执行div和mod操作:
;Precondition: R0 % R1 is the required computation
;Postcondition: R0 has the result of R0 % R1
: R2 has R0 / R1
; Example comments for 10 % 7
UDIV R2, R0, R1 ; 1 <- 10 / 7 ; R2 <- R0 / R1
MLS R0, R1, R2, R0 ; 3 <- 10 - (7 * 1) ; R0 <- R0 - (R1 * R2 )MLS的文档,它正是为这个用例设计的。
发布于 2013-11-15 07:03:43
Keil/armasm拼写它:MOD:。参见手册Cacechjd.htm
https://stackoverflow.com/questions/19977844
复制相似问题