MMC1 and cc65

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

Post Reply
na_th_an
Posts: 558
Joined: Mon May 27, 2013 9:40 am

MMC1 and cc65

Post by na_th_an »

I have produced a working MMC1 (SNROM) implementation of Shiru's neslib which works great in any configuration, but there's something which it lacks: Some MMC1 revisions won't guarantee a definite state on powerup so it is advised to add vectors and initialization code to all banks.

Well, I could do this manually by copypasting, but is there a better way to instruct cc65 to copy the same bit to all banks, via some kind of macro or whatever? Otherwise I will end up with a big, cumbersome .cfg file and an even bigger cr0.s ...
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: MMC1 and cc65

Post by tepples »

Here are the linker configuration file, the init code, and the MMC1 support code in the same directory from my SNROM project template for assembly language programs. The latter makes a macro containing a jump to the last bank and puts it in sixteen different segments, the same method used by Barbie. I guess I could use .repeat and .sprintf to form the segment name to push not repeating myself even further.


EDIT: I missed a link
na_th_an
Posts: 558
Joined: Mon May 27, 2013 9:40 am

Re: MMC1 and cc65

Post by na_th_an »

Thanks. But I don't quite get it. I notice that you have created a STUBxx segment for each copy of the reset handler, which I guess will include the vectors... But I can't see where or how you use that afterwards, at least in the two files you have provided.

EDIT: Ok, I see, it was elsewhere. Thanks, that's a start. Let me figure out how to repeat the vectors as well and I'm done.

EDIT EDIT: Now I see. It's everything in there. You counted the bytes.

Thank you :)
Post Reply