New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExHiROM mod breaks some of the instructions #71

Closed
edale2 opened this Issue Mar 17, 2018 · 12 comments

Comments

Projects
None yet
3 participants
@edale2

edale2 commented Mar 17, 2018

This was posted by Madsiur over on the Qhimm Forums:

Nice work on advancing the Beta to an almost final stage!

I tested the mod on a FF6 ExHiROM mod (RotDS more specifically) and the ExHiROM mapping break some instructions more specifically the way you coded JMLs and such. As an example JML 18FA72 will work but an ExHiROM cart or ROM will require it to be JML D8FA72 in order to jump at the same place. I'm not sure if there is an advantage to use first notation but while it work on regular HiROM + FastROM carts and ROM, it breaks on ExHiROM carts / ROMs.

I got the mod working by changing all bank bytes of all problematic instructions, what is to check are JML, JSL, LDA XXXXXX, etc. In vanilla FF3us, all instructions use the HiROM notation for banks.

I'll try to fiddle with the fadeout NMI code soon, I know you tried stuff but I'll try a few things, somebody will get it right eventually! ;)

This is beyond what I know anything about, so passing it along.

@edale2

This comment has been minimized.

edale2 commented Mar 17, 2018

RotDS = http://rotds.webs.com/

I think.

@edale2

This comment has been minimized.

edale2 commented Mar 18, 2018

Basically using HiROM notation for long instructions (bank number + 0xC00000) will make the mod work on every FF6 carts and roms possible, regular FF6 ROM type (HiROM + FastROM) or expanded 6MB ROM type (ExHiROM). I don't fully understand the technicalities underlying the mapping differences between both rom types but I tested both versions on debugger emulator and made a fix after seeing the JML instruction not jumping where it should.

Since he coded this with an ASM file it could even be something not wanted in the first place but that was working with vanilla FF6 ROM type. As I said no instruction in FF6 use absolute bank notation, it's all in HiROM notation.

Still don't understand what he's talking about, lol. But more info!

@Insidious611

This comment has been minimized.

Owner

Insidious611 commented Mar 18, 2018

@DieKatzchen

This comment has been minimized.

DieKatzchen commented Mar 18, 2018

I'd be willing to test it on my hardware.

@edale2

This comment has been minimized.

edale2 commented Mar 19, 2018

Good news! To answer his concern, all ASM instructions in vanilla FF6 code use HiROM notation, as an example there is never something like JSL 186040 but always JSL D86040. Same goes for all instructions requiring a bank byte (3 bytes offset).

So sayeth Madsuir.

@Insidious611

This comment has been minimized.

Owner

Insidious611 commented Mar 20, 2018

Okay so, here's the problem I'm having ATM. The $18FA72 thing is not something I'm hardcoding, but something created by the way the wla-dx assembler works. Specifically, we're looking here:

.BANK 18
.ORG $FA72
.SECTION "MSU" SIZE 1422 OVERWRITE

Another problem is that it's not "$18FA72", it's "$12FA72", the bank number is in decimal.

So if I add C0 to that, we get D2 or decimal 210.

Which ends up with this:

$ make
Cleaning up...
Creating linker directives...
Assembling...
Pass 1...
ff3msu.asm:101: DIRECTIVE_ERROR: ROM banks == 48, selected bank 210.
ff3msu.asm:101: ERROR: Couldn't parse ".BANK".

If I were to instead use "D8", I get this:

Cleaning up...
Creating linker directives...
Assembling...
Pass 1...
ff3msu.asm:101: DIRECTIVE_ERROR: .BANK number must be zero or positive.
ff3msu.asm:101: ERROR: Couldn't parse ".BANK".
make: *** [Makefile:37: ff3msu.obj] Error 1

I'm sure there's something simple here I'm missing but I don't know of any way to actually make wla-dx use the kind of notation Madsiur is talking about.

@Insidious611

This comment has been minimized.

Owner

Insidious611 commented Mar 20, 2018

Ok, I figured it out.

What you do is at the beginning of the file, after you set up the ROM mapping, you do either .BASE $80 or .BASE $C0 to use fastrom/hirom notation. This adds that number to whatever banks you need.

So using ".BASE $C0" fixed my code afaict. Jumps are now going to $D2xxxx instead of $12xxxx in bsnes-plus.

If the people who want to test could please test the ff3msu.ips in commit 6b81b9d I'd be grateful.

Will make a Hotfix Three release once I'm sure this isn't breaking anything for anyone.

@DieKatzchen

This comment has been minimized.

DieKatzchen commented Mar 20, 2018

Will test on my sd2snes this week.

@edale2

This comment has been minimized.

edale2 commented Mar 20, 2018

Surprised you put this on the master branch, instead of creating a new one.

@Insidious611

This comment has been minimized.

Owner

Insidious611 commented Mar 20, 2018

Ehh, I was considering it but it's such a small change codewise that it's almost not worth the overhead of a new branch. It's easy as hell to revert if needbe.

@Insidious611

This comment has been minimized.

Owner

Insidious611 commented Apr 19, 2018

Any updates on testing of this fix?

@Insidious611

This comment has been minimized.

Owner

Insidious611 commented May 1, 2018

For now I'm closing this unless someone notices issues, as my own testing has shown this bug to be squashed without any negative consequences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment