create-nes-game - ca65/cc65 config generation & more

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

cppchriscpp
Posts: 102
Joined: Fri Dec 27, 2013 4:28 pm

create-nes-game - ca65/cc65 config generation & more

Post by cppchriscpp »

-----

UPDATE: The tool I described is now live! Check it out on github: create-nes-game

It's almost exactly what I described below, and a bit more. It can also build your game, so no need to stumble over getting cc65 on your path (or compiling it on linux)

It should lower the barrier of entry for newbies, and hopefully also reduce frustration for those of us who know how to do things, but don't care to argue with it.


Original post:

After writing about integration testing on the NES in another topic, I started thinking about other tools the NES ecosystem doesn't have, like code generators.

Spinning up a new ca65/cc65 project is a bit of a pain. There are a lot of examples out there, but they're a little disjointed, and I often end up slapping something together from 3-4 different sources. This has to be a headache for newbies. (I know I struggled, but I also know it's gotten better since then!)

In the javascript ecosystem, this has gotten to be enough of a problem that tools have been made for it. For example in React, there's a tool called `create-react-app` - you run it, you answer some questions, and it gives you a full starter project, with all tools installed. What if we did this for the NES - would anyone use it?

-----

Proposal

create-nes-game - a cross-platform binary that sets up a basic nes project for you.

When you run it, it would ask a series of questions, such as:
  • Choose a location to create it
  • Choose your mapper from a known list (eg NROM, mmc1, mmc3, unrom, etc)
  • Choose # of chr/prg banks based on mapper (128k, 256, etc etc)
  • Choose whether to add cc65 support (this would add crt0.asm and a main.c instead of just an assembly hello world)
  • If you hit yes to above, it would ask to choose whether to include a library combination such as neslib+famitone2, neslib+famitracker, etc
  • Would you like to install an emulator? (mesen, fceux, nintendulatordx?)
  • Would you like to create configuration for a CI tool? (circleci, no thanks)
It would then generate:
  • ca65 configs
  • source files for hello world in chosen language (no libraries required)
  • a copy of ca65/cc65 in a local directory.
  • a build script compatible with your operating system, (windows or linux to start - with no additional requirements like make or cygwin or w/e)
  • Any other things required by your choices above

-----

Would you use a tool like this? What features would you want to see? I'm not promising I'll write it, but it sounds like kind of a fun project.

First proof of concept on youtube: https://www.youtube.com/watch?v=3Bm4tVwh8t8

Mapper picker: https://mapper.nes.science

This is a very rough video, but basically shows me booting up a kubuntu vm from a livecd, installing the tool and building a game with some tweaks.
Last edited by cppchriscpp on Fri Jan 26, 2024 9:50 pm, edited 5 times in total.
User avatar
nesrocks
Posts: 563
Joined: Thu Aug 13, 2015 4:40 pm
Location: Rio de Janeiro - Brazil
Contact:

Re: Idea: create-nes-game - ca65/cc65 config generation & more

Post by nesrocks »

It would be a godsend.
Feature request would be that on top of directly selecting a mapper, the user would mark desired features and the list of available mappers would narrow down accordingly.
https://twitter.com/bitinkstudios <- Follow me on twitter! Thanks!
https://www.patreon.com/bitinkstudios <- Support me on Patreon!
cppchriscpp
Posts: 102
Joined: Fri Dec 27, 2013 4:28 pm

Re: Idea: create-nes-game - ca65/cc65 config generation & more

Post by cppchriscpp »

I'm still playing around with this idea a lot locally - I have something that works in a few cases right now - I may show a video of what I've got so far at some point soon. It can create and assemble games on both windows and linux with minimal effort now.

-----
nesrocks wrote: Fri Jan 21, 2022 7:38 pm It would be a godsend.
Feature request would be that on top of directly selecting a mapper, the user would mark desired features and the list of available mappers would narrow down accordingly.
I thought a lot about your feature request, and I don't think I could easily and usefully implement it in the context of a terminal application.

So, I went ahead and tried making a web-based version instead -- let me know what you think!

https://mapper.nes.science

I've had trouble picking a mapper quite a few times, and I always wanted something more interactive like this. It's a bit simple, but if people start using it I'm very open to modifying it. (It's also open source, PRs are more than welcome!)
User avatar
gauauu
Posts: 779
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re: Idea: create-nes-game - ca65/cc65 config generation & more

Post by gauauu »

That's really nice. I like the "don't care" option which makes it easy to ignore factors.

Might be worth including BNROM also. Despite being a historically rare mapper, it's occasionally handy to target specifically because it's very similar to GTROM but has wider emulator support.
cppchriscpp
Posts: 102
Joined: Fri Dec 27, 2013 4:28 pm

Re: Idea: create-nes-game - ca65/cc65 config generation & more

Post by cppchriscpp »

So funny enough you’re the 3rd or 4th person to ask for that! I’ll be adding it in when I can.
User avatar
nesrocks
Posts: 563
Joined: Thu Aug 13, 2015 4:40 pm
Location: Rio de Janeiro - Brazil
Contact:

Re: Idea: create-nes-game - ca65/cc65 config generation & more

Post by nesrocks »

Awesomesauce!!!!
When selecting CHR granularity shouldn't it say % of a "pattern table" instead of a "nametable"?

FYI: for some reason, facebook messenger (browser) didn't like me sending the link "https://mapper.nes.science/" to someone. It said "couldn't send" on multiple attempts. So I linked to this thread. On discord the link was sent just fine.
https://twitter.com/bitinkstudios <- Follow me on twitter! Thanks!
https://www.patreon.com/bitinkstudios <- Support me on Patreon!
cppchriscpp
Posts: 102
Joined: Fri Dec 27, 2013 4:28 pm

Re: Idea: create-nes-game - ca65/cc65 config generation & more

Post by cppchriscpp »

Good eye, just fixed it. (You may have to hard refresh the page to get it to show up - I didn't do any cache busting with this project) BNROM is added, and I'm planning to split sunsoft fme-7 into two pieces when I have the mental capacity to understand the differences. (Very long day)

As for fb messenger, I've seen cases like that before. It doesn't like certain domains, and seems to think everything using them must be spam/a virus. There isn't much I can do unfortunately. You could also use something like tinyurl if you wanted.

I'm really glad people are finding this useful!
User avatar
pubby
Posts: 583
Joined: Thu Mar 31, 2016 11:15 am

Re: Idea: create-nes-game - ca65/cc65 config generation & more

Post by pubby »

Hey, this is pretty neat!

My one suggestion is to change the text color on the available mappers view. Black / blue on dark green / dark grey is hard to read.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Idea: create-nes-game - ca65/cc65 config generation & more

Post by lidnariq »

Every mapper should support CHR-RAM ... seems a little weird to filter out so many for it.
cppchriscpp
Posts: 102
Joined: Fri Dec 27, 2013 4:28 pm

Re: Idea: create-nes-game - ca65/cc65 config generation & more

Post by cppchriscpp »

Good point about the colors, I just updated them to be much more readable. I also split up fme-7/sunsoft 5a/5b, hopefully correctly.

About chr ram - yes, most mappers can be equipped with chr ram, but not all mappers traditionally did this, and some emulators might not handle it well. In addition, I kind of had in mind what pcbs are available off-the-shelf from people like InfiniteNesLives, Broke Studios, Muramasa, MouseBiteLabs, etc. (Though I'm sure they could do something custom/you could solder one on yourself)

It seems like useful information, even if some of those mappers technically can support it.
User avatar
gauauu
Posts: 779
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re: Idea: create-nes-game - ca65/cc65 config generation & more

Post by gauauu »

This is just spitballing suggestions, so take it or leave it. Another thing that might matter when picking a mapper is support for crappy clones, or ancient emulators. GTROM, for example, fails in both situations.
cppchriscpp
Posts: 102
Joined: Fri Dec 27, 2013 4:28 pm

Re: Idea: create-nes-game - ca65/cc65 config generation & more

Post by cppchriscpp »

I like it! Unfortunately that seems like one of those things that requires tribal knowledge, and I'm not sure I really have that. (This isn't something that's really on the wiki, or anywhere else I've seen)

If you or others could help me compile the information, I'd be happy to add it!

-----

Alternatively if anyone feels so inclined, adding it would require adding an entry here, describing the feature:
https://github.com/cppchriscpp/nes-mapp ... eatures.js (Note: renamed this from mapper-options.js after my original post)

Then add an entry for each mapper using the "field" name you picked above in this list:
https://github.com/cppchriscpp/nes-mapp ... er-list.js

If you want to test it, it's plain html so any web server will do. With python you can use "python -m SimpleHTTPServer" or "python3 -m http.server" -- or node has "npx http-server"
cppchriscpp
Posts: 102
Joined: Fri Dec 27, 2013 4:28 pm

Re: Idea: create-nes-game - ca65/cc65 config generation & more

Post by cppchriscpp »

Apologies for the double-post, but I've got a bit of an update on the tool I originally proposed - I've been building this thing up slowly - it's closed source for now, but I did create an extremely rough teaser video!

It shows the following with a fresh ubuntu vm over the course of 4 minutes (7 minutes in realtime - I sped up a few install steps):
  • Downloading & installing the new tool
  • Running a command to create a new game (which will optionally install dependencies for mesen if not present)
  • Building the new game's rom with the tool
  • Running the rom in mesen
  • (Not related, but took time) Installing visual studio code and cc65 plugin
  • Editing the assembly code to add a sprite on screen
  • Building the new rom and proving it works with mesen
(Note that the tool shows nrom and mmc1 as the only mappers supported, I plan to add more, don't worry!)

https://www.youtube.com/watch?v=3Bm4tVwh8t8
cppchriscpp
Posts: 102
Joined: Fri Dec 27, 2013 4:28 pm

Re: Idea: create-nes-game - ca65/cc65 config generation & more

Post by cppchriscpp »

Well, half a year later, I managed to get this thing released! I've tested it extensively myself, but I haven't shared it much yet, so expect there may be some bugs.

Here's the site with downloads/etc: https://create-nes-game.nes.science

It should be very newbie friendly, and those who get frustrated creating ca65/cc65 configs, headers, etc may appreciate it too. it'll give you a series of questions, then produce a codebase with a simple hello world. It can then be used to compile it and run it.

It's distributed as a single (windows/linux) binary, so no need for compiling cc65, fiddling with the path, creating one-off build scripts, etc. On linux it'll also prompt you to install the dependencies it needs.

I'll leave the site to explain the rest, but if you try it out let me know what you think! Bug reports/feature request always welcome too.
Last edited by cppchriscpp on Fri Jan 26, 2024 9:52 pm, edited 1 time in total.
Figbash
Posts: 1
Joined: Mon May 15, 2023 12:38 am

Re: create-nes-game - ca65/cc65 config generation & more

Post by Figbash »

Hi, I'm pretty new to NES development and was using your great tool here to set up an MMC3 project. It's very helpful, I really appreciate how comprehensive it is!

I was however a bit stuck trying to figure out how to switch CHR banks and I believe it's because there is a bug in mapper.asm in the generated code when choosing MMC3. You have:

Code: Select all

    mmc3_internal_set_bank:
        ora mmc3ChrInversionSetting
        stx MMC3_REG_BANK_SELECT
        sta MMC3_REG_BANK_DATA
        rts
Which is setting the inversion bit in bank_data, I think it needs to be something like this to work properly:

Code: Select all

    mmc3_internal_set_bank:
        tay
        txa
        ora mmc3ChrInversionSetting
        sta MMC3_REG_BANK_SELECT
        sty MMC3_REG_BANK_DATA
        rts
So the bit is set in bank_select.
Post Reply