Solved

Modulo in assembly

Posted on 2011-03-03
5
2,250 Views
Last Modified: 2012-05-11
How to implement modulo in ARM assembly???
0
Comment
Question by:Tom3333
  • 3
  • 2
5 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 35034037
0
 

Author Comment

by:Tom3333
ID: 35034124
Hello DaveBaldwin i  mean to implement modulo with out use command MOD. Do you have any resources about this ?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 35034185
The last time I saw a routine for that, they just subtracted the divisor until the result went negative and then they added it back once.
0
 

Author Comment

by:Tom3333
ID: 35089095
Hello DaveBaldwin,
can you give the code or the pseudo-code for this???
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 50 total points
ID: 35089609
Here's a little pseudo code.  This does not account for negative numbers as input.
; psuedo code...
mov a,dividend  ; the number to be divided
mov b,divisor   ; the number to divide by

loop:
sub a,b   ;subtract b from a
jmp positive, loop  ; do it again until the result is not positive

; if negative result, add it back Once
add a,b  ; and we're done

Open in new window

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

A procedure for exporting installed hotfix details of remote computers using powershell
A safe way to clean winsxs folder from your windows server 2008 R2 editions
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now