Thread: [Tutorial] HackMew's Knowledge
View Single Post
  #104    
Old April 10th, 2012 (10:39 PM).
NintendoBoyDX NintendoBoyDX is offline
     
    Join Date: Jul 2010
    Gender: Male
    Posts: 94
    Quote:
    Originally Posted by YouListeningROMs View Post
    With ASM, how would you do modulo?
    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

    returning
    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..
    Reply With Quote