Language…
9 users online: anoMaly666, anonimzwx, DanMario24YT, Darolac, Gamet2004, MorrieTheMagpie, Nayfal, Neuromancer, simon.caio - Guests: 269 - Bots: 325
Users: 64,795 (2,378 active)
Latest user: mathew

SA-1 problem

In my hack I inserted sa1 patch but when I insert more than 85 sprites in a level the game freeze when I reach the screen that exceeds that number. Lunar magic don't show any advice when I put more than 85 sprites. The sprite memory is set on 10. What's the problem? Help me


Make sure you have this set in LM's general options (Options > General Options):



84 sprites is pretty much the hard limit unless you do some ASM to fix the issue. Sprite data is normally indexed in 8-bit (which means at most 0xFF = 255 bytes), and each sprite's data is 3 bytes long, which means you can at most have data for 255 / 3 = 85 sprites. However, the last byte of the data has to be an $FF terminator byte, so 84 is the limit. If you have any more than that, the game will try to spawn the next sprite but will never reach either a sprite later in the level or the $FF terminator byte, and as a result will infinitely try to loop through the data (resulting in the game freezing).

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Thanks for the reply, but the sa1 patch didn't allow to add more than 84 sprites? In the description it say that the patch increases the maximum amount of sprites *per level* to 255. Why it doesn't work for me?
I know the answer: PIXI. Because of how it handels the level sprite data index, it is incomatible with the SA-1 level sprite expansion.
There is a possible solution, though. Search for "SprtOffset:" and you find below it the following code:
Code
	TYA						; \
	CLC						; | Y += Size table
	ADC.l Size,x			; |
	XBA : LDA #$00 : XBA ; | still better than REP #$20 : AND #$00FF : SEP #$20
	TAY	

Try to replace it with:
Code
    sty $0e
    lda.l Size,x
    rep #$21
    and #$00ff
    adc $0e
    tay
    sep #$20

Note that this is untested, though.
Where I have to search for "SprtOffset:"? In the SA1 patch or in the PIXI's files? And I have to repatch all again?
In PIXI's main.asm. I just forgot to tell it where you have to search for it. And yes, you have to rerun PIXI so the effect takes place.
Originally posted by MarioFanGamer
In PIXI's main.asm. I just forgot to tell it where you have to search for it. And yes, you have to rerun PIXI so the effect takes place.

Now it seems to work, thank you!