Skip to content
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

Trying to define a smaller MMC3 ROM results in a wrong sized output #261

Closed
wendelscardua opened this issue Dec 8, 2023 · 1 comment
Closed
Labels
bug Something isn't working p1

Comments

@wendelscardua
Copy link

I'm making a MMC3 ROM with mostly C++, and if I compile it along a config.s with these definitions:

        .global __chr_rom_size
        .global __prg_rom_size
        .global __prg_ram_size
        .global __four_screen
        .global __mirroring

                                ; Kilobytes
        __prg_rom_size = 64
        __chr_rom_size = 8
        __prg_ram_size = 8

                                ; Flags
        __four_screen = 0
        __mirroring = 1 ; horizontal mirroring

I get a ROM with 81936 bytes instead of 73744 (16 header + 65536 PRG + 8129 CHR)

(for now I'm omitting the _prg_rom_size part and living with a mostly empty 500K+ ROM)

@mysterymath
Copy link
Member

This was an off by one in the MMC3 linker script; depending on the bank layout, the fixed region may use take either 2 or 3 banks. The default setup uses 3 but neglects to subtract out a swappable bank for any size other than the max. I've added regression tests for this behavior for all of the supported size boundaries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p1
Projects
None yet
Development

No branches or pull requests

2 participants