Language…
21 users online: Alex No, Anas, DanMario24YT, gemstonezVA, GiraffeKiller, Golden Yoshi, Gorry, Green, GRIMMKIN, h.carrell, Heitor Porfirio, JudithPrietht, Metal-Yoshi94, playagmes169, Ray Hamilton, Rykon-V73, Seamus Sinclair, ShoopDaWhoop, Sniwott, Spedinja,  StayAtHomeStegosaurus - Guests: 276 - Bots: 602
Users: 64,795 (2,370 active)
Latest user: mathew

ASM Modulus?

How would you go about doing a modulus in asm anyway? XD I am makeing a sprite that I think will use the X coord as a peramiter like some of the normal ones do.
Your layout has been removed.
The SNES has hardware multiply / divide (with remainders).

Code
4204  wl++++ WRDIVL - Dividend C low byte
4205  wh++++ WRDIVH - Dividend C high byte
        dddddddd dddddddd
4206  wb++++ WRDIVB - Divisor B
        bbbbbbbb

        Write $4204/5, then $4206. 16 "machine cycles" (probably 96 master
        cycles) after $4206 is set, the quotient may be read from $4214/5, and
        the remainder from $4216/7. Presumably, $4204/5 are not altered by this
        process, much like $4202.
        
        The division is unsigned. Division by 0 gives a quotient of $FFFF and a
        remainder of C.


I guess you'll be making use of the remainder there.
so what, I have to insert code to delay untill it's done or will it do it it's self?
Your layout has been removed.
You have to delay with instructions. 8 NOPS for divide and 4 for multiply is in order unless you have something to do within the wait period.
I might, but does it take EXACTLY that long?
Your layout has been removed.
It's a safe limit..
Bah It's not working as I expected and it takes a bunch of code to do what I want, so I will just make multible custom sprites I guess.

Bah! dosn't sprite tool have a way of makeing sprites which use the las sprites code pointer without reassmembleing the code? =_=
Your layout has been removed.
Sorry to grave-dig, but this very searchable topic relates to a solved issue I was having, so I'm sharing what I found out. I'm still learning ASM and the method posted by smkdan is pretty far over my head, but there is an easier (and probably slower) way.

This is a modulus that can track the amount of reductions made. This is also an interesting way to make a loop. This is my source.
Code
; A should be loaded with the input value
; X is the amount of reductions
; A is reduced by 100 until it is less than 100
LDX #$00 ; remove this if you don't want the amount of reductions
.Loop1
CMP #$64
BCC .endLoop1
SBC #$64
INX ; remove this if you don't want the amount of reductions
BRA .Loop1
.endLoop1