xRazor 1 Report post Posted March 18, 2017 Hello, I'm studying programming in ARM assembly and i'm stuck with my homework. I have to write a program, that calculates the sum of arithmetic progression from 1 to n, step is 1. Task seems to be quite easy, but i'm really stuck at the division/multiplication part. I can't use the multiplication instructions, so i guess i have to do it using shift (Kong gave me a hint to go for that one), but i'm failing to do the division part. Could anyone please give me an example with some comments how to do the division/multiplication in ARM assembly? Would appreciate, thank you. Quote Share this post Link to post Share on other sites
Wrexor 61 Report post Posted March 19, 2017 Too multiply you can do mul r0, r1, r2. r0 is destination register, r1 and r2 are values to be multiplied so like r0 = r1 * r2. Quote Share this post Link to post Share on other sites
xRazor 1 Report post Posted March 19, 2017 In that case i'd be using multiplication instructions, wouldnt i? Quote Share this post Link to post Share on other sites
Wrexor 61 Report post Posted March 19, 2017 Sorry, I didn't see that.you can't use that. One thing you could do for multiplication is a loop and add. For example if you want to do 3 * 3 you would loop 3 times and add 3 each loop. For division it's similar but you subtract. Quote Share this post Link to post Share on other sites