Register - Login
Views: 95816521
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - Stats - Latest Posts - Color Chart - Smilies
11-20-18 06:28:49 AM

Jul - Game Development/Mod Projects - Super Mario Bros. 2 disassembly New poll - New thread - New reply
Next newer thread
Xkeeper

Level: 250


Posts: 23358/24696
EXP: 250258272
For next: 270739

Since: 07-03-07

Pronouns: they/them, she/her, etc.

Since last post: 17 hours
Last activity: 3 hours

Posted on 03-05-18 02:31:35 PM Link | Quote
I've been working on this for a while.

Now you can turn it back into a ROM.

Still a lot of work to go. If you have any suggestions on new labels or names for things, please let me know; I can update the main disassembly file.
lion

Level: 14


Posts: 49/74
EXP: 11007
For next: 2064

Since: 01-25-18

Pronouns: he/him
From: Portugal

Since last post: 89 days
Last activity: 89 days

Posted on 03-05-18 03:50:00 PM Link | Quote
Lookin' good!
Xenesis
Actually a Doctor
Level: 94


Posts: 2460/2543
EXP: 8244439
For next: 112218

Since: 07-28-07

Pronouns: he/him
From: The Land of Kangaroos and Drop Bears

Since last post: 15 days
Last activity: 4 hours

Posted on 03-06-18 07:40:31 AM Link | Quote
Truly amazing - a complete disasm is a hell of a lot of work.
Xkeeper

Level: 250


Posts: 23358/24696
EXP: 250258272
For next: 270739

Since: 07-03-07

Pronouns: they/them, she/her, etc.

Since last post: 17 hours
Last activity: 3 hours

Posted on 03-07-18 02:04:36 PM Link | Quote
It is not much. Most of the work is done automatically by just playing the game, using FCEUX to make a code and data log (to know what is what), and then poking some values here and there with some formatting.

It is a far cry from, say, the Mario 1 or Mario 3 disassemblies, which are for the most part well-documented and commentated. This is the beginning of that.
Xkeeper

Level: 250


Posts: 23358/24696
EXP: 250258272
For next: 270739

Since: 07-03-07

Pronouns: they/them, she/her, etc.

Since last post: 17 hours
Last activity: 3 hours

Posted on 03-08-18 04:39:23 AM Link | Quote
More updates today. The assembly is now byte-for-byte identical to the original game, by using .db xx xx xx for instructions that are not supported. (The correct instruction is added as a comment in the disassembly.) You can turn on the other behavior of using proper zero-page accesses by removing a flag from build.bat, namely -d_COMPATIBILITY_.

Also, the disassembly is now capable of building a byte-for-byte identical version of PRG1 / REV-A, too.
It is on a separate branch for now while I continue to work on the main pre-split assembly. Revision A mostly fixes a bug involving the Fryguy boss, where under certain conditions you can softlock the game. (There is also another small fix with PAL consoles that displayed only a blank screen for the bonus game.)

More updates to come...
Keitaro

Fire Snake
LOVELY ARRANGEMENT. VOLCANO BAKEMEAT
Level: 67


Posts: 1191/1191
EXP: 2508077
For next: 84795

Since: 09-09-08

From: California

Since last post: 252 days
Last activity: 137 days

Posted on 03-12-18 10:50:46 PM Link | Quote
wait, is it really that easy to make a disassembly of an NES ROM?? This...is good to know.
Xkeeper

Level: 250


Posts: 23358/24696
EXP: 250258272
For next: 270739

Since: 07-03-07

Pronouns: they/them, she/her, etc.

Since last post: 17 hours
Last activity: 3 hours

Posted on 03-12-18 10:54:02 PM Link | Quote
well, "easy", if you count having spent a few months on it i guess
Rena

Star Mario
Fennel
Level: 129


Posts: 5240/5258
EXP: 24528482
For next: 521172

Since: 07-22-07

Pronouns: he/him/whatever
From: RSP Segment 6

Since last post: 27 days
Last activity: 16 days

Posted on 03-15-18 08:46:59 PM Link | Quote
The hard part is going through the result, figuring out what everything does, and assigning names and nice macros to make it readable and editable. The output from just going through code/data logging won't have any names.
Xkeeper

Level: 250


Posts: 23358/24696
EXP: 250258272
For next: 270739

Since: 07-03-07

Pronouns: they/them, she/her, etc.

Since last post: 17 hours
Last activity: 3 hours

Posted on 03-16-18 12:50:38 PM (last edited by Xkeeper at 03-16-18 12:51:34 PM) Link | Quote
Yeah, and labeling everything, finding all the places where "$8137" should actually be a label and not a value, that sort of thing. Otherwise you run into a ton of issues if you rearrange code.

Currently you still can in a lot of places, but you should be able to just build most of it without too much trouble. I'm slowly fixing the places that falls apart, but some of it will require a lot of work to figure out a good format for, like the music (which has a main pointer, then a bunch of relative one-byte addresses to the data within)

Anyway, I'm working on making a debug menu that can jump to different parts of the game, to help testing (so we stop having to make a bunch of savestates everywhere )

Right now it's still very much a work in progress. The menu will load and show text, but you can't actually do anything. I'm still trying to figure out how it should work under the hood and what variables are safe to overwrite, since you can call this from anywhere... even though you can't really go back afterwards



Most of the code for this right now lives in this file on the "debug" branch, but in true to how I want to do this you can still build this version with the debug components optional. When it's closer to being done I'll probably merge it into the main branch.
Rena

Star Mario
Fennel
Level: 129


Posts: 5241/5258
EXP: 24528482
For next: 521172

Since: 07-22-07

Pronouns: he/him/whatever
From: RSP Segment 6

Since last post: 27 days
Last activity: 16 days

Posted on 03-16-18 01:16:02 PM Link | Quote
I recently implemented a similar menu in Pokemon Crystal. It's a lot of work but the way I ended up designing it is:


  • Each item has:

    • A type

    • A pointer to text

    • A pointer to a RAM address

    • A pointer to an "activate" method (called when you press A)

    • A pointer to an "adjust" method (called when you press left/right)

    • A pointer to a "draw" method (called whenever the item is drawn)


    Any of the pointers can be null to use a suitable default.

  • Types are:


    • Text only

    • n-byte variable displayed as decimal (n=1 to 4)

    • n-byte variable displayed as hex

    • 1-byte variable displayed as Pokemon ID and name

    • etc for items, moves...




The default "adjust" method for all types except "text only" increments/decrements the variable pointed to (if it's not null). The default "draw" method draws the text followed by the variable. The default "activate" method does nothing. Left/Right call the adjust method with -1/+1 as parameter, or -16/+16 if Select is held. Start does nothing, B exits the menu.

It's complex, and it's tedious to adjust large values (something I should fix), but it makes nested menus really simple, and macros help with defining items:

DebugMenu_Warp:
ld hl, .menuItems
jp DebugMenu_Main

.menuItems:
debug_menu_hex_item 1, .textBank, wMapGroup, .doWarp
debug_menu_hex_item 1, .textMap, wMapNumber, .doWarp
debug_menu_hex_item 1, .textWarp, wWarpNumber, .doWarp
debug_menu_end

.textBank:
db "BANK@"
.textMap:
db "MAP @"
.textWarp:
db "WARP@"

.doWarp:
ld de, SFX_WARP_TO
call PlaySFX
ld a, -1
ld [wDefaultSpawnpoint], a
ld a, MAPSETUP_WARP
ld [hMapEntryMethod], a
ld a, 1
ld [wDebugMenuForceClose],a
call LoadMapStatus
scf
ccf ; return carry=0 from activate method to close the menu
ret
Xkeeper

Level: 250


Posts: 23358/24696
EXP: 250258272
For next: 270739

Since: 07-03-07

Pronouns: they/them, she/her, etc.

Since last post: 17 hours
Last activity: 3 hours

Posted on 03-16-18 02:06:29 PM Link | Quote
I was planning on doing something similar, but not quite exactly the same. The current option would be a number, which would index into a list of pointers to the main "run the menu code", and those would handle their own button presses. Basically:


- Blink cursor
- Handle up/down to move
- JSR PointersToOptionCode[MenuOption]


PointersToOptionCode:
- Option1
- Option2
- Option3
...


Option1:
- Handle left/right to change value
- Handle displaying update to values
- Do something if you push A or w/e

Not quite as complex, but I don't think this needs to be for now; worst case I create a new submenu in the same style.
Xkeeper

Level: 250


Posts: 23358/24696
EXP: 250258272
For next: 270739

Since: 07-03-07

Pronouns: they/them, she/her, etc.

Since last post: 17 hours
Last activity: 3 hours

Posted on 03-16-18 02:11:59 PM Link | Quote
Also I should mention, I made a video showing how the music engine reads its data:



Kind of neat! Still plenty to go on making my own music, though.
Next newer thread
Jul - Game Development/Mod Projects - Super Mario Bros. 2 disassembly New poll - New thread - New reply




Rusted Logic

Acmlmboard - commit 220d144 [2018-11-04]
©2000-2018 Acmlm, Xkeeper, Inuyasha, et al.

30 database queries, 1 query cache hits.
Query execution time: 0.155176 seconds
Script execution time: 0.020030 seconds
Total render time: 0.175206 seconds