Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
1 user currently in Super Mario World hacking: labmaster | 3 guests
Acmlm's Board - I2 Archive - Super Mario World hacking - Subroutines in Super Mario World | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
francoispress

Goomba
Level: 8

Posts: 18/30
EXP: 2158
For next: 29

Since: 05-14-05

Since last post: 168 days
Last activity: 167 days
Posted on 05-16-05 06:22 PM Link | Quote
Has anyone decoded any of the subroutines in Super Mario World, like the ones related to collision detection or drawing of the sprite or any other possible operations not specifically related to hardware but to the game itself?
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 567/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 05-17-05 05:17 AM Link | Quote
No, very little of it has been mapped. look in the ROM locations thread for any routines that have been mapped, as well as a non-stickied "the ASM locaton thread".
blackhole89

LOLSEALS
Moderator of ROM hacking
EmuNET IRC network admin
Head GM of TwilightRO
Level: 47

Posts: 699/971
EXP: 739208
For next: 26995

Since: 03-15-04
From: Dresden/Germany

Since last post: 14 hours
Last activity: 12 hours
Posted on 05-18-05 01:07 AM Link | Quote
If you want to receive further information, you might also try to directly PM one of the board's resident SMW assembly geeks (BMF, HyperHacker, mikeyk, HabsoluteFate, myself, ... sorry if I forgot anyone). All of us are familiar with tracing (or so I think), so you also stand a good chance to find out what you want when asking for something that is not known yet.
FloBo

Koopa
Level: 17

Posts: 52/101
EXP: 20723
For next: 4020

Since: 09-11-04

Since last post: 3 days
Last activity: 13 hours
Posted on 05-18-05 01:25 AM Link | Quote
@darth mole: Uhm,... about tracing, I think there are quite many motivated hackers who just don't know how to trace efficiently.. me included. If I want to trace, I try something. And I don't succeed. Then again, I try, and nothing seems to work. When I finally get a Tracelog (like once D4S created for my Lufia-issues), I seem to be so confused that I can't get any idea on how to interpret what happens during that code-segment...

Are there no simple tutorials about how to trace data with geigers SNES-debugger?! I really do want to learn how to handle this.... But seems like I'm just too stupid...


(edited by FloBo on 05-17-05 08:26 AM)
francoispress

Goomba
Level: 8

Posts: 30/30
EXP: 2158
For next: 29

Since: 05-14-05

Since last post: 168 days
Last activity: 167 days
Posted on 05-18-05 01:38 AM Link | Quote
Originally posted by FloBo
@darth mole: Uhm,... about tracing, I think there are quite many motivated hackers who just don't know how to trace efficiently.. me included. If I want to trace, I try something. And I don't succeed. Then again, I try, and nothing seems to work. When I finally get a Tracelog (like once D4S created for my Lufia-issues), I seem to be so confused that I can't get any idea on how to interpret what happens during that code-segment...

Are there no simple tutorials about how to trace data with geigers SNES-debugger?! I really do want to learn how to handle this.... But seems like I'm just too stupid...


Assembly is a bitch. That's why I never took to machine code. Has anyone disassembled
Super Mario World sucessfully? Is there anything in that code that looks like a subroutine?
I wonder if Nintendo's programmers used assembly when making Super Mario World. Do you think they also could have used C?
Smallhacker

Green Birdo

SMW Hacking Moderator
Level: 68

Posts: 1630/2273
EXP: 2647223
For next: 81577

Since: 03-15-04
From: Söderhamn, Sweden

Since last post: 10 hours
Last activity: 9 hours
Posted on 05-18-05 02:00 AM Link | Quote
What happened to the SMW Open Source Project, by the way?
francois
Newcomer
Level: 5

Posts: 1/9
EXP: 350
For next: 179

Since: 05-18-05

Since last post: 167 days
Last activity: 159 days
Posted on 05-18-05 02:38 AM Link | Quote
Originally posted by Smallhacker
What happened to the SMW Open Source Project, by the way?


Super Mario World open source? I never heard of it.
d4s

Panser
Level: 29

Posts: 212/325
EXP: 142151
For next: 5734

Since: 03-23-04

Since last post: 13 days
Last activity: 1 day
Posted on 05-18-05 03:19 AM Link | Quote
Originally posted by francoispress


Has anyone disassembled
Super Mario World sucessfully? Is there anything in that code that looks like a subroutine?



yes!
maybe about 1000 of them.
MathOnNapkins

Math n' Hacks
Level: 67

Posts: 1833/2189
EXP: 2495887
For next: 96985

Since: 03-18-04
From: Base Tourian

Since last post: 1 hour
Last activity: 32 min.
Posted on 05-18-05 05:08 AM Link | Quote
Yes, but the disassembled "subroutines" are in assembly, which you hate so much. d4s's answer is very sarcastic tongue-in-cheek.

Either way, it would be pretty pointless to convert them to, say, VB style routines or C style routines b/c you usually have to interpret the assembly yourself to figure out what it should say in C, or VB. No program could do that for you or it would already exist.

It might get some things right but it would not accurately capture the semantics. BCC and BCS operations in particular are cryptic in assembly, and don't easily translate to if - else statements directly unless you know what the assembly code is doing.

Anyone who wants to alter snes game code will need to learn assembly, there is no way around it.


(edited by MathOnNapkins on 05-17-05 12:09 PM)
HabsoluteFate

Red Paratroopa
Level: 23

Posts: 155/179
EXP: 58525
For next: 9198

Since: 03-15-04
From: Ottawa, Ontario, Canada

Since last post: 10 days
Last activity: 2 days
Posted on 05-18-05 05:27 AM Link | Quote
Originally posted by Smallhacker
What happened to the SMW Open Source Project, by the way?


Surprisingly enough lack of interest although it's somewhat become the Super Mario World Dev Environment.

I'm still working on that one but things have been crazy and i've had to put it aside for the last 3 weeks...I don't intend on giving up on it though...i have some bug fixes for the latest feature to take care of and a new version will be releases shortly afterwards....

i dont have a timeline as to when the next release will come out though...
blackhole89

LOLSEALS
Moderator of ROM hacking
EmuNET IRC network admin
Head GM of TwilightRO
Level: 47

Posts: 700/971
EXP: 739208
For next: 26995

Since: 03-15-04
From: Dresden/Germany

Since last post: 14 hours
Last activity: 12 hours
Posted on 05-18-05 12:41 PM Link | Quote
Originally posted by francoispress
Originally posted by FloBo
@darth mole: Uhm,... about tracing, I think there are quite many motivated hackers who just don't know how to trace efficiently.. me included. If I want to trace, I try something. And I don't succeed. Then again, I try, and nothing seems to work. When I finally get a Tracelog (like once D4S created for my Lufia-issues), I seem to be so confused that I can't get any idea on how to interpret what happens during that code-segment...

Are there no simple tutorials about how to trace data with geigers SNES-debugger?! I really do want to learn how to handle this.... But seems like I'm just too stupid...


Assembly is a bitch. That's why I never took to machine code. Has anyone disassembled
Super Mario World sucessfully? Is there anything in that code that looks like a subroutine?
I wonder if Nintendo's programmers used assembly when making Super Mario World. Do you think they also could have used C?


Yeah, there is. In fact, every time you see a JSR / JSL instruction, you know is a subroutine (unless, of course, you were unlucky and disassembled a piece of something that was no 65c816 machine code, like, graphics data).
Disassembling, tracing, writing your own assembly code etc. is the everyday work of an ambitioned SMW hacker, you know.
As for C, I am not sure. Chances there are they did, but even if it is the case, they used an extremely optimizing compiler so, in most cases, chances to recover C code are not present.
Yet, there actually are some places in the coede that look like they originally weren't written in assembly. A good example for this is the sprite handler sub-fork routine (noticed that, in mw reconfigurator, many entirely different sprites had the same handler routine pointer?). Every sane asm programmer would have placed a location table somewhere in ROM and done indirect jumps to the actual routines. However, this piece of code looks like this:

CMP #$12
BNE #$04
JSL $123456
CMP #$13
BNE #$04
JSL $789ABC
CMP #$14
BNE #$04
...

or, transscripted as it would look like in C:

if(sprite_id==0x12) HandlerRoutine12h();
else if(sprite_id==0x13) HandlerRoutine13h();
else if(sprite_id==0x14) ...

Note that, in C code, this just looks like the work of a lazy programmer, while in assembler, the lazy programmer certainly would have chosen the pointer table variant (as it is significantly easier to code).

(This piece of code, actually, is one of the locations I am currently rewriting to make SMW capable of handling more sprites at a time. While d4s just patched most of the time-critical routines to FastROM (thus making the processor frequency the 65c816 runs at itself increase locally), I am (also) optimizing the actual SMW code by cleaning up useless process cycle wastes like this)

Geiger/Evil Peer's SNES9x tracer is mostly self-explaining. What you simply should do is:
- setting a "start address" and an "end address" in one of the dialog boxes of the "Trace Menu"
- pausing the game and clicking on "Trace" in the same menu when you reached the position you want to trace at
The tracer will wait until the 65c816 executes the code at the "start address" the first time, dump some few previously executed instructions and continue dumping every instruction executed until it reaches the "end address".

francois
Newcomer
Level: 5

Posts: 3/9
EXP: 350
For next: 179

Since: 05-18-05

Since last post: 167 days
Last activity: 159 days
Posted on 05-19-05 03:05 AM Link | Quote
Originally posted by Darth Mole
Originally posted by francoispress
Originally posted by FloBo
@darth mole: Uhm,... about tracing, I think there are quite many motivated hackers who just don't know how to trace efficiently.. me included. If I want to trace, I try something. And I don't succeed. Then again, I try, and nothing seems to work. When I finally get a Tracelog (like once D4S created for my Lufia-issues), I seem to be so confused that I can't get any idea on how to interpret what happens during that code-segment...

Are there no simple tutorials about how to trace data with geigers SNES-debugger?! I really do want to learn how to handle this.... But seems like I'm just too stupid...


Assembly is a bitch. That's why I never took to machine code. Has anyone disassembled
Super Mario World sucessfully? Is there anything in that code that looks like a subroutine?
I wonder if Nintendo's programmers used assembly when making Super Mario World. Do you think they also could have used C?


Yeah, there is. In fact, every time you see a JSR / JSL instruction, you know is a subroutine (unless, of course, you were unlucky and disassembled a piece of something that was no 65c816 machine code, like, graphics data).
Disassembling, tracing, writing your own assembly code etc. is the everyday work of an ambitioned SMW hacker, you know.
As for C, I am not sure. Chances there are they did, but even if it is the case, they used an extremely optimizing compiler so, in most cases, chances to recover C code are not present.
Yet, there actually are some places in the coede that look like they originally weren't written in assembly. A good example for this is the sprite handler sub-fork routine (noticed that, in mw reconfigurator, many entirely different sprites had the same handler routine pointer?). Every sane asm programmer would have placed a location table somewhere in ROM and done indirect jumps to the actual routines. However, this piece of code looks like this:

CMP #$12
BNE #$04
JSL $123456
CMP #$13
BNE #$04
JSL $789ABC
CMP #$14
BNE #$04
...

or, transscripted as it would look like in C:

if(sprite_id==0x12) HandlerRoutine12h();
else if(sprite_id==0x13) HandlerRoutine13h();
else if(sprite_id==0x14) ...

Note that, in C code, this just looks like the work of a lazy programmer, while in assembler, the lazy programmer certainly would have chosen the pointer table variant (as it is significantly easier to code).

(This piece of code, actually, is one of the locations I am currently rewriting to make SMW capable of handling more sprites at a time. While d4s just patched most of the time-critical routines to FastROM (thus making the processor frequency the 65c816 runs at itself increase locally), I am (also) optimizing the actual SMW code by cleaning up useless process cycle wastes like this)

Geiger/Evil Peer's SNES9x tracer is mostly self-explaining. What you simply should do is:
- setting a "start address" and an "end address" in one of the dialog boxes of the "Trace Menu"
- pausing the game and clicking on "Trace" in the same menu when you reached the position you want to trace at
The tracer will wait until the 65c816 executes the code at the "start address" the first time, dump some few previously executed instructions and continue dumping every instruction executed until it reaches the "end address".




Hmm... I did think that Super Mario World was written in C. Who in their right mind would write a game like that solely in assembly?
knuck

Hinox
Banned until 19-58-5815: trolling, flaming, spamming, being a general fucktard...
Level: 62

Posts: 1264/1818
EXP: 1894574
For next: 90112

Since: 03-15-04

Since last post: 14 hours
Last activity: 9 hours
Posted on 05-19-05 03:40 AM Link | Quote
Uh, most if not all NES games were written in pure assembly. I think that most SNES games were too.
Alastor the Stylish
Hey! I made a cool game! It's called "I poisoned half the food, so if you eat you might die!" Have a taco.


Level: 114

Posts: 6485/7620
EXP: 16258468
For next: 51099

Since: 03-15-04
From: Oregon, US

Since last post: 2 hours
Last activity: 2 hours
Posted on 05-19-05 03:57 AM Link | Quote
Yeh. They didn't start writing in higher-level languages until the N64.
francois
Newcomer
Level: 5

Posts: 7/9
EXP: 350
For next: 179

Since: 05-18-05

Since last post: 167 days
Last activity: 159 days
Posted on 05-19-05 06:45 AM Link | Quote
Originally posted by Kyouji Craw
Yeh. They didn't start writing in higher-level languages until the N64.


That's interesting! So to make a game like Super Mario World in assembly would have been quite a task, right? I guess because of the slowness of both the NES and SNES I guess C would have been too slow. Is it even possible to make assembly programming feel like object-oriented programming? Would object-oriented programming even be necessary for a game like Super Mario World?
blackhole89

LOLSEALS
Moderator of ROM hacking
EmuNET IRC network admin
Head GM of TwilightRO
Level: 47

Posts: 701/971
EXP: 739208
For next: 26995

Since: 03-15-04
From: Dresden/Germany

Since last post: 14 hours
Last activity: 12 hours
Posted on 05-19-05 02:13 PM Link | Quote
Actually, assembler programming isn't all that hard if you have a proper macro assembler which supports labels and stuff. The most annoying twist about assembler coding as we know it is that, if we want to insert anything to already present code, we either have to build hooks or recalculate tons of pointers with unpredictable results.
Back in DOS ages, people used to write even rather large projects in MASM or TASM, as program size and speed mattered a lot more by then.
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Super Mario World hacking - Subroutines in Super Mario World | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.019 seconds.