(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
05-21-24 07:40 AM
0 users currently in SMW Hacking.
Acmlm's Board - I3 Archive - SMW Hacking - Lava Spout subroutine, a few problems... (ASM) New poll | |
Add to favorites | Next newer thread | Next older thread
User Post
Goldensunboy

Snifit








Since: 12-30-05
From: Georgia

Last post: 6306 days
Last view: 6306 days
Posted on 06-28-06 07:21 PM Link | Quote
Greetings, some of you may recognize me from the board before the restart, I was Dark Ludwig. For those of you who don't know me I know a fair amount of ASM. I have a lot of SMW hacking experience (although I have been pretty quiet about it ever since a few weeks before the board restarted), I have several programs I use to hack SMW, I make my own blocks, yada yada yada...

Anyway, now for my problem. I am making a long level that has two minibosses and a tough(er?) boss at the end. Miniboss? What? Oh, it's just big boo.



I also turned Lemmy into some cloud guy thingy that you have to fight. However, I had a novel idea for the last boss, Wendy: Why not have the lava under her active!

I worked for several days on a custom code that will cause a nicely animated lava spout to rise up slowly under mario and make a rumbling noise until it can be seen above the lava pool, then shoot up and then recede. I am using PALASM (I haven't really installed LevelASM yet), so the code basically runs once each frame. The code doesn't work, though. I never could understand those assemblers, so I use notepad to make my notes on what OPcodes to make, I translate it manually with 65816REF.hlp, and I write it into the rom with XVI32. It's all manual, so I thought there'd be some problem with it, and there probably was. I used Geiger's SNES9X debugger to disassemble the code, and it turned out to be the same as my notes. I have an idea that there may be some problem with the RAM addresses I'm using, but it might not be that anyway. The code is basically supposed to cause this to happen:

Note: the lava pool has layer priority over the lava spout, so it can't be seen when it's behind the lower lava.


If some experienced ASM hackers could help me here, I would really appreciate it.

Edit: Updated my notes.

-Goldensunboy

PS: If you have trouble viewing the pictures, right click them and click "show picture". If that doesn't work, go to it's properties and copy it's URL into your address bar. If it still doesn't work, IM me at Goldensunboy1.


(edited by Goldensunboy on 06-29-06 05:37 PM)
Sukasa

Birdo
Not quite as active as before.
Xkeeper supporter
Xk > ||bass
I IP Banned myself! Twice!








Since: 11-17-05
From: Somewhere over there

Last post: 6302 days
Last view: 6301 days
Posted on 06-28-06 07:25 PM Link | Quote
What part of it doesn't work, and where are you storing the GFX for the lava?

Anyways, consider waiting a bit for MikeyK's sprite tool to be released, then make the lava spout a sprite. that would likely work better than PalASM (Which rocks, BTW).
Goldensunboy

Snifit








Since: 12-30-05
From: Georgia

Last post: 6306 days
Last view: 6306 days
Posted on 06-28-06 07:37 PM Link | Quote
MikeyK's working on a sprite tool? That's awesome, I never knew that since I was away for about 7 months... I don't think that would work, though, because it would have to be a very large sprite, like 10 by 40 8x8 tiles, it's unreal. plus, there has to be Wendy and her two dummies on the same screen, too. Anyway, When I just have it run, it crashes, and I can't quite figure out where, but I can't really run it properly since I think there may be something wrong with the RAM addresses I'm using (7EC100 - 7EC104). They seem to be automatically set to some number (not sure how, but in different levels its all a different number), and changing them didn't work, I tried using STZ on them in a separate code first but it didn't help, I'm just not sure why though.

Edit: Fixed RAM addresses from 7F to 7E.


(edited by Goldensunboy on 06-28-06 06:54 PM)
mikeyk

Shyguy


 





Since: 02-22-06

Last post: 6464 days
Last view: 6310 days
Posted on 06-28-06 07:38 PM Link | Quote
i like the creativity, and i will take at your code after i get a nap.

when you say your code doesn't work, what exactly do you mean? does it crash the rom? does it make it to all the phases, but not act properly at a certain one? is it getting caught a certain phase and not progressing? tracing is your friend there, and any specifics would help someone who didn't write the code themself. this kind of thing would be much easier to debug if you have an idea of where it's breaking, and also if you're willing to share a rom with the code already inserted.

for now i strongly recommend that you start working with an assembler (http://www.programmersheaven.com/zone8/cat715/13206.htm), for someone who understands, it should be a breeze to learn and it will make asm hacking a million times easier. not having to update every branch anytime you make a change will take away any reluctance you have to change things.
Sukasa

Birdo
Not quite as active as before.
Xkeeper supporter
Xk > ||bass
I IP Banned myself! Twice!








Since: 11-17-05
From: Somewhere over there

Last post: 6302 days
Last view: 6301 days
Posted on 06-28-06 07:40 PM Link | Quote
or just enough to cover one part of the lava tile, the rest could be handled by layers, just like what the moving pipe top sprite does already. Just move part of your sprite, and the other part can be handled by layer one, or three if you use few enough colours.
Cirvania

Cyball
I guess this is as close as Xkeeper will get to spell it right. :<


 





Since: 11-17-05
From: The Island of Puerto Rico.

Last post: 6303 days
Last view: 6302 days
Posted on 06-28-06 07:42 PM Link | Quote
Use long addressing modes for your loading and storing opcodes.

Glyph had a problem with this as well, you may find this thread useful.

Good luck, and happy hacking!

Oh, and we'd like to know how you made the light field around the chandeliers.


(edited by Cirvante on 06-28-06 06:44 PM)
mikeyk

Shyguy


 





Since: 02-22-06

Last post: 6464 days
Last view: 6310 days
Posted on 06-28-06 07:47 PM Link | Quote
I didn't check out the code before Cirvante's post, but that would be a definite problem. If using a RAM address >= 8000, you definitely need to use long addressing.
Goldensunboy

Snifit








Since: 12-30-05
From: Georgia

Last post: 6306 days
Last view: 6306 days
Posted on 06-28-06 08:04 PM Link | Quote
Long addressing? I'll try that. I am telling you what I do remember happened when my rom had this problem, recently the code I used disappeared, I think level data covered it. Another problem I have is that I don't understand the whole RATS thing, all I know is that it's RATS, then four bytes for length of data protection, then four more bytes that I don't understand. Plus, I wasn't sure how I put the data protection size in there. Is there some byte ordering issue? like instead of AB CD, is it CD AB? and one last thing, how do the last four bytes work? What do they do? I heard they are the inverse/inverted/something of the four bytes before them, and I was wondering about the byte ordering for them, too.

As for that assembler, I just downloaded it, and as I only know a few things about ASM (but enough to code my own things manually), it was way over my head. I'll try to figure it out, though. If I can't, I'll just manually change the bytes in my notes to long addressing, and rewrite the code into the rom somewhere that it will (hopefully) not get overwritten until I understand RATS tags.

Edit: Oh yes, MikeyK, it crashed early in the routine, I don't remember exactly where, though. I'm rewriting the code into the rom and changing it right now.

Edit 2: What about INC? Because I don't see an increment long...


(edited by Goldensunboy on 06-28-06 07:05 PM)
(edited by Goldensunboy on 06-28-06 07:08 PM)
Cirvania

Cyball
I guess this is as close as Xkeeper will get to spell it right. :<


 





Since: 11-17-05
From: The Island of Puerto Rico.

Last post: 6303 days
Last view: 6302 days
Posted on 06-28-06 08:08 PM Link | Quote
All you need to know about RATS tags:
Originally posted by LevelASM readme: Appendix
RATS stands for ROM Allocation Tag System. When you use a RAT function to
store a segment of data to the ROM, it has a tag prepended to it which
indicates the size of the data stored after it. This makes scanning for
free space much safer, as the RAT functions will automatically scan and
skip over the areas defined by the tags. Erasing the data also becomes
safer, as the RAT functions can simply examine the tag to find out how
large the section of data is before deleting it.

The format of a RAT tag is as follows:

S T A R ssssssss SSSSSSSS cccccccc CCCCCCCC (8 bytes)

"STAR" Tag identifier, which is the word "RATS" reversed in
all-caps.
SSSSSSSS ssssssss Size-1 of data, 16 bit, little endian. It does not
include the size of the RAT tag itself.
CCCCCCCC cccccccc Inverse of size-1, 16 bit, little endian.

Min/Max size allowed: 1-0x10000

Nested RATs are not allowed.
Sukasa

Birdo
Not quite as active as before.
Xkeeper supporter
Xk > ||bass
I IP Banned myself! Twice!








Since: 11-17-05
From: Somewhere over there

Last post: 6302 days
Last view: 6301 days
Posted on 06-28-06 08:12 PM Link | Quote
INC long is basically
PHA
LDA $xxxxxx
INC A
STA $xxxxxx
PLA

And without the stack operations if you don't need them.

EDIT: Looking at your first shot... Nice windowing with HDMA. Good effect


(edited by Sukasa + on 06-28-06 07:35 PM)
Goldensunboy

Snifit








Since: 12-30-05
From: Georgia

Last post: 6306 days
Last view: 6306 days
Posted on 06-28-06 09:05 PM Link | Quote
As many times as I tried to understand RATS, I think I'm getting a clue... If I wanted to protect, say, 8 bytes, it would be "STAR", little endian -1 would make it 0700 (?), and would the inverse mean "I = FFFF - (data size - 1)"? making the RATS tag "STAR 0700 F8FF"? I am a little confused, and I tried something like this before, but I had no way of knowing if the RATS was correct, and it got overwritten.

Oh and Sukasa, I never used HDMA. It didn't make sense to me. The background-looking pillars are on layer 1, and the blackness is on Layer 2. I tried to update the CGADSUB with some value that would make the blackness slightly transparent, but it didn't work.

As far as fixing the code, I have changed the LDA's and STA's that involve anything past $7E8000 to long, and I recalculated any branches that may have had their distance change because of this. Do the INC's, STZ's, DEC's, etc. that reference anything past $7E8000 have to somehow be changed to long, too?
Sukasa

Birdo
Not quite as active as before.
Xkeeper supporter
Xk > ||bass
I IP Banned myself! Twice!








Since: 11-17-05
From: Somewhere over there

Last post: 6302 days
Last view: 6301 days
Posted on 06-28-06 10:24 PM Link | Quote
Yeah. Oh, and RAM is only accessible by 16-bit addressing up to x1FFF. anythign after that, and you'd be accessing things like hardware and ROM and that. So, anythign over 7E:1FFF has to become long.
Goldensunboy

Snifit








Since: 12-30-05
From: Georgia

Last post: 6306 days
Last view: 6306 days
Posted on 06-29-06 12:09 AM Link | Quote
I changed all the INC's, DEC's, STZ's, etc. to "long mode", and I recalculated all the branches AGAIN, I have to go to bed now but I'm in the middle of checking for errors... I'll work on it tomorrow. The code looks more as if it'll work, I should get that tracer fired up by tomorrow night.


(edited by Goldensunboy on 06-28-06 11:09 PM)
smwedit

Red Paragoomba


 





Since: 11-18-05

Last post: 6487 days
Last view: 6303 days
Posted on 06-29-06 11:07 AM Link | Quote
Originally posted by Goldensunboy
I tried to update the CGADSUB with some value that would make the blackness slightly transparent, but it didn't work.

I'm not exactly sure about this solution, but I think there is a level property option: "horizontal translucent layer 2 level" (one that makes layer 2 see-through a little bit) in the change properties in header window that you can use to make the black translucent, unless you are using a vertical level, that is.


(edited by smwedit on 06-29-06 10:08 AM)
Goldensunboy

Snifit








Since: 12-30-05
From: Georgia

Last post: 6306 days
Last view: 6306 days
Posted on 06-29-06 06:42 PM Link | Quote
Edit: I made a crucial mistake at the beginning of the code which would basically cause the code to do nothing by constantly writing $00 to 7EC100 then checking if it's zero. I updated it again.


All INC's, DEC's, LDA's, STA's, and anything that request or modify values above 7E1FFFF use long addressing now. I spent a while and redirected all the branches. I'm about to try the code in the rom, and I'll see what happens. If it crashes, I'll leave details up here.

On a side note, I updated my notes, and I turned it into a .bin file. (download)

As of now: I'm fixing the RTS's and changing them to RTL's. It seems to return to the wrong place when I have:

.
.
.
PALASM's jump to subroutine
.
.
.
JMP "MyCode"
RTL
MyCode
.
.
.

I have all my returns as RTS's, so I had it like that. I will change it soon.

PS: SmwEdit, I am using the translucent layer 2 level mode. It didn't work, so I left it as it is. I tried many things, but none worked. I don't really want to discuss this much, though, because it's off-topic.


(edited by Goldensunboy on 06-29-06 06:12 PM)
(edited by Goldensunboy on 06-29-06 07:43 PM)
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6302 days
Last view: 6302 days
Posted on 06-29-06 09:36 PM Link | Quote
You can't return with RTS or RTL from a JMP. You need to use JSR or JSL respectively. To put it simply:
JMP x: Go to x.
JSR x/JSL x: Push the address of the next instruction (2 bytes for JSR, 3 for JSL) to the stack and go to x.
RTS/RTL: Pop an address from the stack (2 bytes for RTS, 3 for RTL) and go to it.

If you use JMP, you haven't pushed any address to the stack, so it just returns to some random place.
Goldensunboy

Snifit








Since: 12-30-05
From: Georgia

Last post: 6306 days
Last view: 6306 days
Posted on 06-29-06 11:32 PM Link | Quote
Although I already changed it so all the RTS's are now RTL's and the JMP at the start was removed, thank you for that bit of information, it could really be a help in the future.

I got the first phase of the code working properly, at least the timing (it has to wait FF frames), I haven't checked to make sure Layer 2 is working yet though, since I am focusing on getting my code to run smoothly without crashing. I got the first phase working, but it either does or doesn't freeze sometimes when it gets to phase 2. I am tired and will take a little break from it, as tomorrow I have to go to school early and try to finish my math book, then I am going to a friend's house for a birthday, then I'm out of town for a week. But thank you Hyper, Mikey, Sukasa and Cirvante (and any others I may have missed?) the code is working relatively smoothly, at least compared to not running at all.
Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - SMW Hacking - Lava Spout subroutine, a few problems... (ASM) |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.021 seconds; used 441.59 kB (max 566.29 kB)