I made a long research to use the Modulo operator in Assembly language and the closest I found was the DIV operator however it's not available on the simple educational Assembler PEP8 http://www.filewatcher.com/b/ftp/ftp.pepperdine.edu/pub/compsci/pep8/downloads.0.0.html with the following operators http://pastebin.com/f595fb11b (translation from French ''Annexe C'' in http://www.er.uqam.ca/nobel/k20250/Notes_cours.html detailled in "Chapitre 7").

Is there a way to do modulo with only ADD, SUB and bitwise operations (ASL, ROL, AND, OR, ...) ?

Thank you kindly
I've been having trouble with subscription so if someone could reply something today, a tip or a preliminary reply, it would be great !

Just think about it.

Given 11 % 3 how would you find the remainder? Well how would you do divide?
11 - 3 = +1 cycle with 8 left over
8 is > 3 so keep going
8 - 3 = +1 cycle with 5 left over
5 > 3 so...
5 - 3 = +1 cycle with 2 left over
2 is < 3 and > 0 so the remainder is 2 after 11 % 3

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.