comprehensive SMB1 disassembly

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: short answer

Post by tokumaru »

Bohan wrote:You know MARIO?
Some time ago there was a widely known joke (a retarded one at that) here in Brazil that started with this exact question, but it makes no sense at all in english...

EDIT: Just to stay on topic: I think disassemblies are great to learn from (research), but I don't see the point in recoding the game...
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

The point in recoding the game from scratch piece by piece is to produce a Free game engine on which 100% legal homebrew NES side-scrollers can be built.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

I don't know, maybe it's just me, but I don't believe in the reuse of side-scrolling engines... If a person does not know how to make their own, I doubt they can adapt one. And if they do know how to make one... well... I am against using code that isn't mine, but I guess some people don't mind...
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

tokumaru wrote:I don't know, maybe it's just me, but I don't believe in the reuse of side-scrolling engines... If a person does not know how to make their own, I doubt they can adapt one.
Tell that to Lunar Magic users and their total conversions of Super Mario World.
doppelganger
Posts: 183
Joined: Tue Apr 05, 2005 7:30 pm

Post by doppelganger »

To each his own, as I always say. This comprehensive disassembly is only for those who might be interested in how Super Mario Bros. works. It isn't going to create interest in disinterested people, and I don't expect it to. And this modularization effort beneficii has put forth is just one of many possible things that could offshoot from it.
Be whatever the situation demands.
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

I 100& agree with Tokumaru. I'm against using any code by anyone else if you don't understand it, and if you understand this then make your own because you should be able to do it.
Also, I'm for game engines being optimized to the particular game they're written for. The only reason to re-use a game engine as it would be to make a similar sequel or a different version a game. Quake fans will say the opposite, but since I'm 100% against Quake-like games I'm still coherent in my own ideas.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Bregalad wrote:I'm against using any code by anyone else if you don't understand it, and if you understand this then make your own because you should be able to do it.
What operating system and what web browser have you written lately?
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

Stupid joke. I meant using code directly for your own project and without using it for learning purpose.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Heh, I guess Bregalad and I are a special case of "control freaks"... I'd never be able to call "mine" something I didn't know how it worked bit by bit. It's just not mine then. I'd like to be able to say in the end: "This is 100% mine".

It's like, I don't know, a person who decorates cakes, but can not bake one. If by any chance they are required to make a cake from the start, they'll not be able to. So they can't really say they know how to make cakes, although they may have finished many of them. Same thing happens with games, I guess.

Some people, however, are only interested in finishing games, and don't want to go through all the trouble of coding it all. I guess they are the target audience of such re-usable engines.

I don't think this is a bad thing, it's just not for me.
CKY-2K/Clay Man
Posts: 214
Joined: Sun Apr 01, 2007 2:10 pm

Post by CKY-2K/Clay Man »

How would I edit it so that the fireflower doesn't use h-flipping for the right half of the sprite?

I really want to know this and I think an example of how to change something would help me a little.
Image
Here to at least get an idea of how the NES works. I mean I know alot of the basic things, but this place'll help me grasp more how NES functions.
Major respect to NES developers.
User avatar
beneficii
Posts: 127
Joined: Tue Jul 12, 2005 4:37 pm

Post by beneficii »

doppelganger wrote:Oh, goddamnit. These things are coming out of the woodwork.

Yeah, I went ahead and fixed that. Then I ran a complete check on every branch and jump in the file, and could find no others. But anyway, thanks again for finding those bugs.

My methodology was simple: I ran a disassembler on the program rom, then started at the beginning (reset vector) and traced out all the code. The first version of this file I uploaded was full of gaping code and data holes.

Anyway, sometimes I would trace out more code, sometimes I would go over the code with both FCEU and my intuition to figure out what the code did, and sometimes I did both at the same time. I was able to expedite the process of figuring out the level data format by comparing notes with others who had done SMB1 hacking in the past, and I was able to actually verify that, for the most part, their own ideas were correct. Some other parts, like enemy data, I had sparse information on. For the rest of the code, however, I was for the most part completely on my own.

It became fully functional (meaning it could be assembled) sometime in February I believe. But although it was filled with comments, it was almost completely devoid of labels. So I went back and replaced all the memory locations with addresses. Some of the values which would have led to confusion I replaced with constants. This was the part I call the clean-up phase. Still, I'm only human, and even I overlooked some of them, apparently.

Anyway, that's pretty much how I did it. It's not something that anyone else with a lot of free time and a shitload of patience couldn't do.
Actually, I'm curious, what did you do to add the labels? Did you just work them in manually, or did you have a program that added as you disassembled the code?

Additionally, what do you think of using a code data logger to help disassemble?
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

tokumaru wrote:It's like, I don't know, a person who decorates cakes, but can not bake one. If by any chance they are required to make a cake from the start, they'll not be able to. So they can't really say they know how to make cakes, although they may have finished many of them. Same thing happens with games, I guess.
Yeah, but even someone who know to bake cakes needs some prior ingredients such as that poder made from cereals I have no idea how it's called in english, and you don't want to make your own each time you make a cake, because this would need your own field of weater and you'll have to cultivate it just to make poder from it to eventually bake cakes.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Powder made from grain/cereal is called flour, pronounced like "flower".
User avatar
commodorejohn
Posts: 193
Joined: Mon Sep 11, 2006 6:48 pm
Location: Moose Lake, Minnesota

Re: short answer

Post by commodorejohn »

tokumaru wrote:
Bohan wrote:You know MARIO?
Some time ago there was a widely known joke (a retarded one at that) here in Brazil that started with this exact question, but it makes no sense at all in english...

EDIT: Just to stay on topic: I think disassemblies are great to learn from (research), but I don't see the point in recoding the game...
Mind repeating it in Portuguese? I'm just curious.

Also, I agree with you about code reuse and calling it your work, although limited code pasting can help for educational purposes (my first NES programs had chunks lifted from the MagicKit demo code, then over time I used that as a reference to figure out how everything worked.)
[size=0]"There is only one basic human right, the right to do as you damn well please. And with it comes the only basic human duty, the duty to take the consequences."
- P.J. O'Rourke[/size]
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: short answer

Post by tokumaru »

commodorejohn wrote:Mind repeating it in Portuguese? I'm just curious.
It's too stupid... so, I ask that any other brazilian members around forgive me for propagating something so stupid...

It goes something like:
-Conhece o Mario?
-Que Mario?
-Aquele que te comeu atrás do armário!

Which translates to:
-Do you know Mario? (kids used to ask other kids this question)
-What Mario? (this was the most likely answer)
-The one that banged you behind the closet! (the first kid, feeling so smart, replied with this)

It only "makes sense" because "armário" rhymes with "Mario"... Just search Google Images for "Conhece o Mario?" for some graphical renderings of this "joke". Those are somewhat funny.
although limited code pasting can help for educational purposes
Sure, but I think people should understand exactly what goes on with a piece of code that was copied and pasted. If they don't, there might just be a case where this code misbehaves (when compared to their expectations) and they are just buying themselves some nasty bugs, while they could have coded something specifically tailored to their needs, and have no nasty surprises.
Post Reply