NESDev and Strangulation Records messageboards
Forum Index | FAQ | New User | Login | Search

Previous ThreadView All ThreadsNext ThreadShow in Flat Mode*


SubjectRe: Disassembling Mario  
Posted byreapersms
Posted on6/27/03 10:55 PM
From IP66.153.56.194  



I made an attempt at this a while back, first disassembling by hand, then with the aid of a homegrown disassembler.

Unless your disassembler is extremely intelligent, it's most likely screwed up the jumptables. SMB (and a number of other nintendo titles) do something like this for jumptables:

LDA #$03
JSR do_jumptable
DW $A020, $8002, etc

do_jumptable:
ASL A ; adjust index into table
TAY
PLA ; grab high byte
STA $01
PLA ; grab low byte
STA $00
INY ; point at the low byte of the entry
LDA ($00), Y
STA $03
INY
LDA ($00), Y
STA $02
JMP ($0002)

Their version is probably a little bit shorter, as that was from memory. That pops the return address off the stack, and uses it as the base address for a jumptable indexed by A. The RTS at the end of whatever bit of code that entry points at will return to the first function's caller.

Nintendo likes to nest these, I think I remember seeing a set that was 4 tables deep in SMB1 somewhere.



-
Entire Thread
Subject  Posted byPosted On
*Disassembling Mario   orlot6/27/03 7:41 PM
.*Re: Disassembling Mario   loopy6/29/03 05:44 AM
..*Re: Disassembling Mario   Memblers6/29/03 06:50 AM
...*Re: Disassembling Mario   loopy6/29/03 11:05 AM
....*Re: Disassembling Mario   orlot6/30/03 02:58 AM
.....*Mario Disassembled!  orlot7/4/03 4:32 PM
......*Re: Mario Disassembled!  beneficii7/6/03 07:29 AM
.......*Re: mapper 1 and mario  orlot7/6/03 10:20 AM
........*Re: mapper 1 and mario  Memblers7/6/03 12:03 PM
.........*Re: mapper 1 and mario  orlot7/6/03 5:01 PM
..Re: Disassembling Mario   reapersms6/27/03 10:55 PM
..*Re: Disassembling Mario   orlot6/28/03 07:31 AM
.*Re: Disassembling Mario   philtulju6/27/03 8:55 PM
Jump to

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo