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

Gameboy Color Support #17

Open
sreuter opened this issue May 24, 2019 · 3 comments
Open

Gameboy Color Support #17

sreuter opened this issue May 24, 2019 · 3 comments

Comments

@sreuter
Copy link

sreuter commented May 24, 2019

Lddc supports setting the -Wl-yp0x143=0x80 flag to set things as Gameboy Color compatible. Is there an equivalent way for doing this with gbdk-n / sdcc?

@sreuter
Copy link
Author

sreuter commented May 24, 2019

Ok, here comes something awesome. I thought I was stuck here and would need to go back to gbdk / lcc... Luckily, with a bit of more googling I stumbled upon this post: http://gbdev.gg8.se/forums/viewtopic.php?id=463

@DonaldHays, as part of his work on his game, build a great, much more versatile tool for the linking part... conveniently for me, in node :)

node ihx2gb/ihx2gb.js --help

  Usage: ihx2gb [options] <in_file> <out_file>

  Options:

    -h, --help                 output usage information
    -n, --name [value]         The name in the header. Default: "MY GAME"
    -m, --manufacturer [code]  The manufacturer code. Default: ""
    -c, --cgb [flag]           The decimal Game Boy Color support flag. 128 for CGB+GB, 192 for CGB-only. Default: 0
    -l, --licensee [code]      The ASCII licensee code. Default: "00"
    -s, --sgb [flag]           The decimal Super Game Boy support flag. 3 to enable. Default: 0
    -t, --cartridge [type]     The decimal cartridge type. Default: 0
    -r, --rom [code]           The decimal ROM size code. File will be 32KB << value, except for 82, 83, and 84. Default: 0
    -a, --ram [code]           The decimal external RAM size code. Default: 0
    -d, --destination [code]   The destination code. 0 for Japan, 1 for international. Default: 1
    --oldlicensee [code]       The decimal old licensee code. 51 to use new licensee code. SGB will not work if != 51. Default: 51
    -v, --version [version]    The ROM version. Default: 0

Go to http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header for header details, including values for Cartridge Type, ROM Size, and RAM Size. That site lists codes in hex, but must be provided here in decimal.

I'd highly recommend you two to catch up on how to get this in a the default tool for gbdk-n.. or, at the very least, add a note to the README.md.

Anyway, I'm most delighted. Thanks folks!

@DonaldHays
Copy link

Indeed I did make that tool! I've also gone into some detail about it on this very repository on issue #5 at #5 (comment) .

Notably, while it works, and I have banking working on it, banking support has a serious asterisk, in that it depends on behavior in SDCC that's consistent in my experience, but unspecified, and so may change at any time.

If you don't need banking, I think the tool works perfectly fine. If you do need banking, then I think you need to understand the unspecified behavior risk before using it, and I think that qualification makes it difficult to recommend the tool for the general case.

(I have lately been doing some experiments with writing a full linker for SDCC to Game Boy, which would replace this tool, and not rely on unspecified behavior. It's a larger project than IHX2GB, but it would be an easier recommendation for a default tool).

@basxto
Copy link

basxto commented Mar 25, 2020

Just use makebin -Z -yc or add the -yc flag to gbdk-n-make-rom.sh
gbdk-n-make-rom.sh -yc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants