Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Modulo in assembly

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

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 83

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 83

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

1

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Binary Bomb: Phase 5 3 1,670
LNK2017 error with MASM64 2 1,625
z390 Mainframe Assembly Code Programming 21 951
What does this assembly code do 4 445
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …

861 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