Banner
Views: 236,662,418
Time: 2013-05-25 04:12:08 AM
10 users online: Chachii, Eevee, everest700, Fireblast124, HyperMario, Pokeymeister80, o ShadowPhoenix, THY, WhiteYoshiEgg, o Yoshi Master - Guests: 24 - Bots: 11Users: 22,885 (1,280 active)
Latest: ar1an1
Tip: When using custom palettes, remember that certain colors in palettes 0 and 1 will also affect the status bar.
Custom block trouble
Forum Index - SMW Hacking - General SMW Hacking Help - ASM & Related Topics - Custom block trouble
Pages: « 1 »
I'm trying to learn how to write my own custom blocks. I'm using BTSD. I've been following Iceguy's "SMW ASM Tutorial" and have done the block-insertion exercise there.

Code
jmp Below : jmp Above : jmp Side : jmp SpriteV : jmp SpriteH : jmp Cape : jmp Fire Below: Side: Above: lda $19 beq MakeBig rtl MakeBig: lda #$01 sta $19 SpriteV: SpriteH: Cape: Fire: rtl

That was what I did following the tutorial. It's a block that makes Mario big when he touches it. I inserted it at Map16 0x200, and it works perfectly.

Then I decided to try rolling my own:
Code
jmp Below : jmp Above : jmp Side : jmp SpriteV : jmp SpriteH : jmp Cape : jmp Fire Below: Cape: lda #$3F sta $14AD Above: Side: SpriteV: SpriteH: Fire: rtl

It was going to be a block that activated the P-switch. I inserted this as well, at Map16 0x201, but it crashes the game for some reason. What am I doing wrong?
That's strange. That code seems completely correct as far as I can tell. This sounds like an insertion problem of some sort, not the block itself.
Okay, this is really weird. I reassigned my P-switch block to Map16 0x202, and it works now. #w{:s}
Same with using tile 0x203.

So yeah, it's definitely an insertion problem.

NOT-REALLY-EDIT: And after changing it back to 0x201, it works now.
I'm still confused though #w{:s}
Last edited on 2012-02-21 09:11:13 PM by Bedelato.
I'm not sure, but I think that page 0x02 has some problems (?).
Interaction wise, it's exactly the same as any other page. It just has different graphics based on the graphics header (and you can turn that off).


No clue why it'd break like that. Does 201 explode your game when touched, even without a custom block used on it?
What do you mean "without a custom block used on it"? I didn't try that tile before inserting custom blocks. And as I said above, it worked after moving the block's tile number, and even after moving it back. It just broke that one time for some reason.

Tile $201 just acted like $130 when it didn't have a custom block on it.

Precisely because of things like this, I'm not doing this on my main hack, but rather on a clean copy of SMW that I made for the purpose of practicing ASM stuff. The only tools used on the ROM in question were LM and BTSD.

What's really confusing is that now it's back on tile $201, except now it works.
Last edited on 2012-02-22 02:45:20 AM by Bedelato.
Oh, my bad. I read that wrong (thought it broke again when moving it back).


In all likelihood: Something overwrote BTSD's (or the block's) code. When you reapplied the blocks through BTSD, it restored the overwritten code and boom, fixed.


Apply any patches recently? Might've had a freespace issue.
Nope, no patches. Like I said, clean ROM, plus LM and BTSD, nothing more. Xkas was used only as the backend for BTSD.

And it wasn't just "reapplying"; it was specifically moving the block to another tile that fixed it. I had tried Reinsert All several times with no success.

Here's what I actually did:

1. Made a copy of my clean SMW ROM.
2. Opened the clean copy in Lunar Magic. Saved level 0x105 so that LM would expand the ROM and insert its hacks.
3. Following Iceguy's tutorial, wrote a custom block that makes Mario big on contact. That would be the first code block in my OP.
4. Opened the ROM in BTSD. Got a message "Hack inserted at <some address>".
5. Added the new block to BTSD and inserted it into the ROM at tile 0x200.
6. In Lunar Magic, edited level 0x105 by adding tile 0x200 to the start of the level.
7. Tested the ROM in ZSNES. The newly inserted block worked with no problems.
8. Wrote a new block (the second code block in my OP); it was supposed to write to $14AD triggering the blue P-switch timer. Added to BTSD database and inserted at tile 0x201.
9. In Lunar Magic, edited level 0x105, again, by adding the newly inserted block.
10. Tested in ZSNES. Block 0x200 still worked. Block 0x201 crashed the game upon hitting it.
11. Tried Reinsert All in BTSD several times. This didn't work.
12. Modified the block's code in several ways, at one point stripping out all but the RTL. It still crashed. That was when I posted this thread. (Yes, the LDA, STA were put in there from memory in my browser. That was the actual code I had though. Hopefully I'm not a bad person for this :-P )
13. I think at this point I closed BTSD and reopened it later.
14. On a hunch, reassigned the problem block to tile 0x202, and put that tile into level 0x105. To my complete surprise, it worked this time. Of course, since at the time it was nothing but an RTL, it acted just like tile 0x130.
15. Added back the P-switch code. Also added a brown block to level 0x105. Hitting tile 0x202 turned the brown block into a coin, as expected. Yay, it works.
16. Also on a hunch, moved the block again to 0x203. No problems this time either.
17. On yet another hunch, moved the block back to 0x201. To my even more complete surprise, it still worked.
18. Wrote a third block that writes to $1887 to shake the screen. Inserted at tile 0x203. This block also works.

And that's basically where I'm at now. Hopefully that'll shed light on something.
Last edited on 2012-02-22 10:59:53 AM by Bedelato.
Make sure that you have your rom open in only one program at a time. I can't promise that is the source of the problem, but if you have your ROM open in Lunar Magic and BlockTool, or zsnes, etc, it allows for a lot of big errors due to overwrite issues. If your block works fine now, great; I wouldn't worry about it. But that's just something to keep in mind.
There's a bug that I caught a while ago that can cause a crash if rare requirements are met. It's fixed and ready for the next BT but I might either patch it if ends up taking a while. PM me the ROM with your steps followed that causes this crash and I'll confirm the issue.
A few days ago I opened a ROM in BTSD and then Lunar Magic, then I saved a level before inserting some blocks, and it corrupted part of the level... for some reason it's best to only have one open at a time. Does BTSD only check for freespace when you first open it or something?
BTSD puts a copy of the hack in RAM while editing, and saves that back to file. That means edits you make to the ROM after being loaded into BTSD will be overwritten once you save again.

LM however does not, so it's safe to leave that open.
Originally posted by smkdan
There's a bug that I caught a while ago that can cause a crash if rare requirements are met. It's fixed and ready for the next BT but I might either patch it if ends up taking a while. PM me the ROM with your steps followed that causes this crash and I'll confirm the issue.


A staff member asking for a ROM? The irony! :-P

In all seriousness though, the problem is pretty much over on my end. The block in question no longer crashes, and I've since mutilated that particular ROM in other ways. So I can't send anything, sorry.

That said, I'm now curious: Can you tell me a little bit more about this bug? What are these rare requirements?
Last edited on 2012-03-09 12:08:35 PM by Bedelato.
Pages: « 1 »
Forum Index - SMW Hacking - General SMW Hacking Help - ASM & Related Topics - Custom block trouble

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

Copyright © 2005 - 2013 - SMW Central
Legal Information - Link To Us


Total queries: 29

Menu