Banner
Views: 794,891,203
Time:
16 users online: Bernardo,  Dan, Darkwoon, Golden Yoshi,  MarioFanGamer, MaSSacOte__,  Meirdent, MiracleWater, MM102,  Ninja Boy, PaperLuigi128, Sokobansolver, VLSkoot, xfix, Yoshi Master, Yume Nikki Fan - Guests: 59 - Bots: 165 Users: 41,486 (1,496 active)
Latest: JayPea13
Tip: Do not put an excessive number of lives in a level; they should have a value to them.Not logged in.
My ASM block keeps crashing my emulator.
Forum Index - SMW Hacking - SMW Hacking Help - My ASM block keeps crashing my emulator.
Pages: « 1 »
Hello. I was epicly failing at making an ASM block from scratch, using knowledge from examining tool-generated blocks and ASM command tutorials. However, I've had no luck in getting one to not crash my emulator.

Here I'm trying to make a block that, when Mario is above the block, tests if the timer is at 1 second, and if it is, teleports Mario to a certain level. Of course I'd make this block act like tile 25 in the map16 data and maybe spam it in layer 2.

Code
db $42
JMP MarioAbove : JMP CheckTimer : JMP Teleport
MarioAbove:
	LDA $7E0F32
	CMP #$00
	BEQ CheckTimer
	RTS
CheckTimer:
	LDA $7E0F33
	CMP #$01
	BEQ Teleport
	RTS
Teleport:
	LDX $95
	PEA $0105
	PLA
	STA $19B8,x
	PLA
	ORA #$04
	STA $19D8,x
	LDA #$06
	STA $71
	STZ $89
	STZ $88
	PLX
	RTS
Label_0000:
RTL

print "Teleports Mario to level 105 when timer hits 1."


Can someone tell me why this is going wrong and maybe show me how to fix it?
Originally posted by ThePat545
JMP MarioAbove : JMP CheckTimer : JMP Teleport

You need all 10 JMPs. You can't just remove the ones you don't want. Point them to RTLs, for example Label_0000.

Quote
RTS
RTS
RTS

Block code ends with RTL.

Quote
PLX

There is no matching push for that push. Remove it.

--------------------
<blm> zsnes users are the flatearthers of emulation
Originally posted by Alcaro
Originally posted by ThePat545
JMP MarioAbove : JMP CheckTimer : JMP Teleport

You need all 10 JMPs. You can't just remove the ones you don't want. Point them to RTLs, for example Label_0000.

Quote
RTS
RTS
RTS

Block code ends with RTL.

Quote
PLX

There is no matching push for that push. Remove it.

Thanks a bunch! I got most of the code down, but I don't know all the labels. Can you please list them for me?
db $42
JMP MarioBelow : JMP MarioAbove : JMP MarioSide
JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireball
JMP TopCorner : JMP BodyInside : JMP HeadInside

MarioBelow:
MarioAbove:
MarioSide:

TopCorner:
BodyInside:
HeadInside:

SpriteV:
SpriteH:

MarioCape:
MarioFireball:
RTL

--------------------
<blm> zsnes users are the flatearthers of emulation
Thank you very much! Just one more question and I'm done. :P
Do you need different labels for all the JMPs or is just "Label_0000:" for all of them fine?
It works perfectly fine to let multiple JMPs target the same label.

But I recommend not renaming them. Keeping the names makes it easier to read the code later.

--------------------
<blm> zsnes users are the flatearthers of emulation
In GPS it's saying "An error has been detected: blocks/timerteleport.asm:20: error: 'Label_0000' redefined [Label:0000]"

Code
db $42
MP MarioBelow : JMP MarioAbove : JMP MarioSide
JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireball
JMP TopCorner : JMP BodyInside : JMP HeadInside

MarioBelow:
	LDA $7E0F32
	CMP #$00
	BEQ CheckTimer
	RTL
return
Label_0000:

MarioAbove:
	LDA $7E0F32
	CMP #$00
	BEQ CheckTimer
	RTL
return
Label_0000:

MarioSide:
	LDA $7E0F32
	CMP #$00
	BEQ CheckTimer
	RTL
return
Label_0000

TopCorner:
Label_0000:

BodyInside:
Label_0000:

SpriteV:
Label_0000:

SpriteH:
Label_0000:

MarioCape:
Label_0000:

MarioFireball:
Label_0000:

CheckTimer:
	LDA $7E0F33
	CMP #$01
	BEQ Teleport
	RTL
Teleport:
	LDX $95
	PEA $0105
	PLA
	STA $19B8,x
	PLA
	ORA #$04
	STA $19D8,x
	LDA #$06
	STA $71
	STZ $89
	STZ $88
	RTL
Label_0000:

RTL

print "Teleports Mario to level 105 when timer hits 1."


^ That's the new code. What do I do?
Multiple JMPs to the same label is fine. Having multiple labels with the same name is not. Nothing is using those 0000s, so remove them.

You also have the following typos or other invalid constructions:

MP MarioBelow : JMP MarioAbove : JMP MarioSide
The J is mandatory for all JMPs.

return
Labels must end with colon.

return
return

You're defining this label multiple times too. Nothing is using it, you can remove it.

print "Teleports Mario to level 105 when timer hits 1."
I'd recommend moving this to UberASM, so you won't need to put that block all over the level.

edit: Sorry Thomas, nice try. Tell Kieran to turn ninja protection back on.

--------------------
<blm> zsnes users are the flatearthers of emulation
It's saying "blocks/timerteleport:asm:4: error Label HeadInside not found [JMP HeadInside]"

But as you can see here...
Code
db $42
JMP MarioBelow : JMP MarioAbove : JMP MarioSide
JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireball
JMP TopCorner : JMP BodyInside : JMP HeadInside

...JMP HeadInside is in line 4. What do I do>

edit: never mind, I realized I needed to direct it to a label too.
If you want a JMP HeadInside, you must have a HeadInside: somewhere.

Right below BodyInside: would be a good choice.

--------------------
<blm> zsnes users are the flatearthers of emulation
Thank you so much, it works!
Pages: « 1 »
Forum Index - SMW Hacking - SMW Hacking Help - My ASM block keeps crashing my emulator.

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2019 - SMW Central
Legal Information - Privacy Policy - Link To Us


Total queries: 7

Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • SMBX Community
  • ROMhacking.net
  • MFGG