cc65 source for runtime.lib?

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
Mikey
Posts: 9
Joined: Thu Jan 05, 2023 12:35 pm

cc65 source for runtime.lib?

Post by Mikey »

I'm trying to learn more about using C with NES development, since it seems that some modern homebrew games do this.

But all the examples, including Shiru's stuff, that I can find are from ancient versions of cc65, and even after you fix all the syntax issues you end up with the included runtime.lib being for an incompatible (presumably ancient) version of the compiler...

I don't see any runtime.lib in the compiler's directory, there is an nes.lib, but that doesn't appear to be the right thing...

I did find this on github -- which might be the thing I need? -- https://github.com/clbr/neslib

But when I build it... there's no output lib files... and the documentation seems to be missing... and the examples repo that that user provides has the same issues where none of it really compiles as-is on a modern version of cc65.

Not really sure where to proceed from here; any advice or pointers would be helpful.
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: cc65 source for runtime.lib?

Post by calima »

runtime.lib is a renamed copy of cc65's nes.lib. Delete whatever old runtime.lib and use the nes.lib that comes with your cc65, then you know it's the correct version. You don't have to copy it to your project or mention it on build lines etc, just pass "-t nes" and it will be used.

My neslib is a set of useful functions that you will copy into your project.
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: cc65 source for runtime.lib?

Post by calima »

Oh, to add, nesdoug's tutorials are the most modern. However even they might not be updated to whatever the latest cc65 does, that's just how it goes.
Mikey
Posts: 9
Joined: Thu Jan 05, 2023 12:35 pm

Re: cc65 source for runtime.lib?

Post by Mikey »

This didn't work for Shiru's examples.

When I try to compile with nes.lib instead of the prepackaged runtime.lib.

The file sizes are wildly different also; with Shiru's nes.lib weighing in at around 100 KiB, and and nes.lib at 1.2 MiB... simply replacing it with that one still failed.

The error message appears to pop in at the linker stage complaining: `ld65: Error: Missing memory area assignment for segment 'ONCE'`.

This seems to indicate a cfg file issue, but there is no section in the cfg file named `ONCE`, or in any of the pragmas, etc. that I've seen.

Is this missing section being required by the newer nes.lib library somehow?
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: cc65 source for runtime.lib?

Post by calima »

Yes. IIRC they renamed INIT to ONCE, so to build with such newer cc65 you will need to edit your cfg file correspondingly.
Post Reply