27 users online: Apple, Ayami, BanjoN64Fan, Bernardo, Casper, Darolac, Exodustx0, ExONightZ, IAMADINOSAUR, Ice Man, JP 14,  KevinM, koine,  Maarfy, Mariotag1, MDBattleFrog,  Meirdent,  Noivern,  patcdr, RPG Hacker, segredo, Slash Chen,  Tahixham,  Telinc1, TheMorganah, toad64,  xHF01x - Guests: 45 - Bots: 274 Users: 45,748 (3,369 active)
Latest user: x1c0m3
Not logged in.
Help fixing a sprite please?
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Help fixing a sprite please?
Pages: « 1 »
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!
Pages: « 1 »
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Help fixing a sprite please?