Beril Aydemir
Beril Aydemir

Reputation: 1

ARM assembly addition

I'm trying to get modulo of addition of two numbers with ARM 32-bit processor. Well, I'm trying to make it with three unsigned long 128 bit numbers but I cant succeed. Can anyone give me an idea or basic example of it?

mov r1, #11
mov r2, #13
mov r3, #15

add r1, r1,r2
subge r1, r1, r3    

ldr lr, address_of_return2 
ldr lr, [lr] 
bx lr                          

Upvotes: 0

Views: 778

Answers (1)

firda
firda

Reputation: 3338

You need cmp r1,r3 between add and subge. First add, than test if greater than modulo, finally substract if greater or equal (assuming both input numbers are less than modulo).

PS: Or cmp r3,r1.... not sure by the order right now.

Upvotes: 0

Related Questions