Harvest Moon SNES

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Harvest Moon SNES

Post by Oziphantom »

So I started digging into the "Holy Grail" Tokimeki Memorial but found the tools lacking, so I've gone back to Harvest Moon which I have done a fair amount of digging in before to get my base line tools up and working before tackling TM. However going from TM to HM is a hell of a drop in code quality. At first I just blamed it on MACRO hell, but I'm starting to think that they just use a really bad compiler. Any body know an info on if they or other games by the dev have been reported as using some compiled language?
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: Harvest Moon SNES

Post by Oziphantom »

for example

Code: Select all

                  ****************************************
                  *              SUBROUTINE              *
                  ****************************************
                  SUB_858bb0                     XREF[1] 8584d4(c)  
    858bb0 C2 30     REP    #$0x30                          A16  XY16 
    858bb2 48        PHA
    858bb3 A5 9F     LDA    <$offset DAT_7e009f            = ??
    858bb5 29 40     AND    #$0x40
           00
    858bb8 F0 14     BEQ    $LAB_858bce
    858bba 80 08     BRA    $LAB_858bc4
                  ****************************************
                  *              SUBROUTINE              *
                  ****************************************
                  SUB_858bbc                     XREF[1] 8584f5(c)  
    858bbc 48        PHA
    858bbd A5 9F     LDA    <$offset DAT_7e009f            = ??
    858bbf 29 80     AND    #$0x80
           00
    858bc2 F0 0A     BEQ    $LAB_858bce
                  LAB_858bc4                     XREF[1] 858bba(j)  
    858bc4 68        PLA
    858bc5 49 FF     EOR    #$0xffff
           FF
    858bc8 1A        INC
    858bc9 18        CLC
    858bca 69 F0     ADC    #$0xfff0
           FF
    858bcd 60        RTS
                  LAB_858bce                     XREF[2] 858bb8(j), 
                                                         858bc2(j)  
    858bce 68        PLA
    858bcf 60        RTS
beq'ing to a seperate code chunk that does a pla rts rather than

Code: Select all

BNE $LAB_858bc4
PLA
RTS
sounds to me, something following what "C" does to the letter rather than coder making logic in ASM.
User avatar
jeffythedragonslayer
Posts: 344
Joined: Thu Dec 09, 2021 12:29 pm

Re: Harvest Moon SNES

Post by jeffythedragonslayer »

What tools were you using for TM and what limitations were bothering you?

re: BEQ'ing to a separate chunk, I'm less familiar with vanilla C than C++, but yes I think that has more to do with the complier's optimization settings than following the C standard to the letter. C++ has an as-if rule:

https://en.cppreference.com/w/cpp/language/as_if
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: Harvest Moon SNES

Post by Oziphantom »

Ghidra.
TM uses lots of DP, Stack and Data bank changes which make it more intense to reverse.
User avatar
jeffythedragonslayer
Posts: 344
Joined: Thu Dec 09, 2021 12:29 pm

Re: Harvest Moon SNES

Post by jeffythedragonslayer »

This compiler you're thinking of reminds me of a dog in one of the harvest moon games that you show to this girl over and over again and she just says "doesn't seem too clever."

In what order have those three 65816 features - direct page, stack, or data bank changes - been in difficulty to reverse engineer?
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: Harvest Moon SNES

Post by Oziphantom »

Best Girl Karen : Harvest Moon 64

DP is the hardest, as now you now can't just let the auto analysis and my fix up scripts run, because a function can be called with 5 different DP locations so you then have to make all 5 manually. Because other code will then call one of them ABS.

Data bank, like wise, a function is called and it looks up the same labels in 85 and 87 and 90 etc but those tend to be a lot less and quite easy to map as you are pointing into data banks, so once you work out one and all the addresses align, you just update the data in the others and don't really worry about making the code point to it properly. While the DP is variables which get used a lot.

Stack movements are minor, either its just moving to stack for a threading system or it just doing a fast write for sprite allocations, but you need to map the push and/or pulls to the addresses to know what it is actually reading or writing as it goes, and it does it backwards. Since there is no direct address you sort of have to "bench run" the code to keep track of where it is actually referencing for comments.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Harvest Moon SNES

Post by Pokun »

It was probably a bug, they forgot to make that dialog only happen once per day when you show the dog so you can raise affection infinitely in zero time.
I prefer Elli though.
Post Reply