View Single Post
April 10th, 2012 (10:39 PM).
Join Date: Jul 2010
Quote originally posted by
With ASM, how would you do modulo?
View original post
There are a couple of ways in fr. There is software interrupt 0x6, which is a bios function call that does division and modulo. There is routine 081E4018 developed by gamefreak, that does division and modulo as well.
R0 = dividend
R1 = divisor
R0 = quotient
R1 = modulo answer
081E4684 is another routine made by gamefreak that does modulo only.
A few other math routines:
081E460C: another division routine
081E3B9C: square root, calls swi 0x8
I've stumbled across a few others that I dont remember..
View Public Profile
Send a private message to NintendoBoyDX
Find all posts by NintendoBoyDX
Find threads started by NintendoBoyDX
Ignore Posts by NintendoBoyDX