Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Modulo in assembly

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

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 84

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.
1
 

Author Comment

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

Accepted Solution

by:
Dave Baldwin earned 200 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

1

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

916 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