OK, starting 6502 work but really puzzled... need help.

Started by w7n, October 12, 2011, 10:58:08 AM

Previous topic - Next topic

w7n

Well, trying to work on Super Mario Bros. 1... Got 3 questions:
1. The 6502 asm is, of course, very different from languages such as C, Pascal, etc. Though I can understand the meanings of commands, I hardly know what the values in WRAM and others mean. What should I do if I want to know what a specific value mean? I'm completely all thumbs...
2. Well I just figured out that a nonsense series of 'commands' are usually data instead of commands. Of course I need some more experience, so anyone can share some?
3. I'm using a debugger called NO$NES, but I don't know if it's the best. My computer is a million years old, so it cannot survive the attack from FCEUX. Any good debuggers u know?

Thank you Mario, but our #1(How do you call it?) is in another country... So are there English mistakes in the words above? If yes, also tell me.

Lenophis

Quote from: w7n on October 12, 2011, 10:58:08 AM3. I'm using a debugger called NO$NES, but I don't know if it's the best. My computer is a million years old, so it cannot survive the attack from FCEUX. Any good debuggers u know?
Use FCEUXD instead, it doesn't have as much overhead as FCEUX. If you need a couple more features, you can try the other forked version instead.


https://ff6randomizer.codeplex.com/ - Randomize your FF6 experience!

Nightcrawler

Quote from: w7n on October 12, 2011, 10:58:08 AM
Well, trying to work on Super Mario Bros. 1... Got 3 questions:
1. The 6502 asm is, of course, very different from languages such as C, Pascal, etc. Though I can understand the meanings of commands, I hardly know what the values in WRAM and others mean. What should I do if I want to know what a specific value mean? I'm completely all thumbs...

WRAM is simply general RAM. So, it would be the same as data values in RAM for any C or Pascal program. The only way you're going to know what they mean is either by source code, documentation, or experimentation. :) In most cases, ROM hackers don't have any source code, but in this case we have a commented dis-assembly of SMB in our documents section. You can also check our wiki for a RAM map of SMB. Ultimately though, you figure it out through experimentation. Change some values and see what happens. Study some lines of code that use that memory location to help clue you in. These are the true skills of a ROM hacker and what you'd need for any game not already heavily documented like SMB. That's what the guys who made that documentation did. So, I'd recommend trying to figure it out yourself and using the documentation as a fallback to see if you are right or to lend a helping hand.

Quote2. Well I just figured out that a nonsense series of 'commands' are usually data instead of commands. Of course I need some more experience, so anyone can share some?

In terms of a ROM, everything is lumped together. You have code, graphics, sound, and other data all lumped together in no discernible organization. It can be tricky distinguishing what is what in a ROM file. You'd use a tile editor to scan for visible graphics as a start. Scan for text with a hex editor that uses a table file or a relative searching program. Using the debugger will greatly help you figure out what section of the ROM are. Also, if you're using a debugger, all commands being executed should definitely be valid code or you have a problem! There shouldn't be any 'nonsense' being executed unless there is a programming error.
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations

Klarth

Quote from: w7n on October 12, 2011, 10:58:08 AM
Well, trying to work on Super Mario Bros. 1... Got 3 questions:
Though I can understand the meanings of commands, I hardly know what the values in WRAM and others mean. What should I do if I want to know what a specific value mean?
Knowing 6502 isn't enough.  You need to learn the NES hardware (memory map and registers) and you'll discover that things like STA $2007 doesn't mean "store accumulator to $2007" at the system level.  On the NES, it more precisely means "store accumulator to current VRAM address".

w7n

Thanks guys above. With the SMB Memory List, everything is going on quite fine, and I've found some implementations for the Dr. Floppy's SMB1 music hacking guide. (Honestly saying, that guide needs to be updated...)

Gil Galad

Don't forget about SMBDis. Which is a disassembly of Super Mario Bros. 1. You can assemble the source code with the listed assembler and with a few minor modifications with ASM6. I've done it awhile back, so I know it works.

It may even be possible to make edits to the game. Although, ROM space will be a problem so you may have to use a mapper and then expand.

For NES in particular, there are two types of WRAM. Internal WRAM and cartridge WRAM.

$0 - $07FF - internal WRAM

$6000 - $7FFF - cartridge WRAM

Homepage of Gil Galad || New Forum

"I don't know half of you half as well as I should like; and I like less than half of you half as well as you deserve. "