Language…
19 users online:  BeeKaay, ben15420, DanMario24YT, Fullcannon, Golden Yoshi, Gorry, Green, Heitor Porfirio, JezJitzu, JPhanto, Metal-Yoshi94, Michel2023, NewPointless, OrangeBronzeDaisy, playagmes169, Ray Hamilton, ShoopDaWhoop, Skystarmania,  yoshi3706 - Guests: 266 - Bots: 506
Users: 64,795 (2,369 active)
Latest user: mathew

Help fixing a sprite please?

Hi there. I put together something a bit specific, and knowing how much I suck at ASM it didn't work.
My sprite has the basic function down, but spawns the wrong thing. I inserted it as 00 and it does this when I insert it with the extra byte set to 2. I'll just show you a video of it.

The code:
Code
	dcb "INIT"	;initial code, doesn't do anything
	RTL
	dcb "MAIN"	;main code
	LDA $14		;run every 256 frames
	AND #$FF
	LDA $186C,x	;code to spawn turn block at sprite's position
	BNE EndSpawn
	JSL $02A9DE
	BMI EndSpawn
	LDA #$01
	STA $14C8,y
	LDA #53		;spawn turn block
	STA $009E,y
	LDA $E4,x
	STA $00E4,y
	LDA $14E0,x
	STA $14E0,y
	LDA $D8,x
	STA $00D8,y
	LDA $14D4,x
	STA $14D4,y
	PHX
	TYX
	JSL $07F7D2
	PLX
	LDA #$FF	;amount of frames before turn block disappears
	STA $1540,x
EndSpawn:
	RTL


The .cfg file:
Code
01
36
01 06 33 01 01 24
00 00
turnblockspawner.asm


So uhh, can someone help me, please? I know somehow I messed up the sprite number because it spawns Yoshis instead of turn blocks. Thanks.


Originally posted by ThePat545
Code
LDA #53


There's your issue. A "#" on its own in ASM refers to a decimal number (so 53 becomes 35 in hex); you want to use "#$", which refers to a hexadecimal number.

Also, the reason the sprite is hitting Yoshi might be because of your last line, STA $1540,x. Because of the way sprite codes work, that's setting the address for the generator, rather than the throw block. Change the ",x" to ",y" instead.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Originally posted by ThePat545
Code
LDA #$01
STA $14C8,y



Also, don't forget to change #$01 to #$09 since sprite 53 can only be spawned in stunned status.
Thank you both very much! I finally worked it out with your solutions. I also realized I needed to add a label as well. Thanks a lot!