How to use redefined characters in CC65

You need an actual VIC.

Moderator: Moderators

User avatar
beamrider
Vic 20 Nerd
Posts: 833
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: How to use redefined characters in CC65

Postby beamrider » Tue Aug 22, 2017 3:24 pm

I didn't forget RAM1 but had nothing to put in it..

You will need to split your code between MAIN and RAM1 (as the UDCs sit in between).

Move some of your functions into another file and specify the segment at the top, eg

Code: Select all

#pragma codeseg ("RAM1CODE")

then add it to the cfg file in the SEGMENTS secion..

Code: Select all

RAM1CODE:     load = RAM1,     type = ro;


of course you will need to compile and link it which would be better done with a MAKE file, but that's another topic...

User avatar
plbyrd
Vic 20 Hobbyist
Posts: 118
Joined: Tue Jun 01, 2010 9:32 pm
Website: http://thesharp.ninja
Location: Clarksville, TN
Occupation: Software Engineer

Re: How to use redefined characters in CC65

Postby plbyrd » Tue Aug 22, 2017 4:00 pm

Oliver Schmidt's universal makefile for cc65 is just about perfection.

https://github.com/cc65/wiki/wiki/Bigger-Projects

Linzino
Vic 20 Drifter
Posts: 37
Joined: Fri Nov 06, 2015 4:13 pm
Website: http://retrocomputingarchive.blogspot.fr/
Location: France

Re: How to use redefined characters in CC65

Postby Linzino » Tue Aug 22, 2017 4:03 pm

Thanks a lot!
I am trying to understand more now how the CFG works.

I did not know that one should use pragmas to specify the segment.
I thought it was done automatically by the linker.

So, I need to figure out which part of the code should go to which segment.
I guess I can do this by looking at the size of the object files.

User avatar
plbyrd
Vic 20 Hobbyist
Posts: 118
Joined: Tue Jun 01, 2010 9:32 pm
Website: http://thesharp.ninja
Location: Clarksville, TN
Occupation: Software Engineer

Re: How to use redefined characters in CC65

Postby plbyrd » Tue Aug 22, 2017 4:06 pm

Linzino wrote:Thanks a lot!
I am trying to understand more now how the CFG works.

I did not know that one should use pragmas to specify the segment.
I thought it was done automatically by the linker.

So, I need to figure out which part of the code should go to which segment.
I guess I can do this by looking at the size of the object files.


Well, the linker is pretty good at that. The reason to put code in a specific spot is for applications that do banking. Putting concise, shared pieces of code in an appropriately sized chunk of RAM is a big help and one of the great features of the linker in cc65.

Linzino
Vic 20 Drifter
Posts: 37
Joined: Fri Nov 06, 2015 4:13 pm
Website: http://retrocomputingarchive.blogspot.fr/
Location: France

Re: How to use redefined characters in CC65

Postby Linzino » Tue Aug 22, 2017 5:28 pm

The goal of my personal project is to write a little fun game for nearly all 8 bit computers (+ TI/994a which technically is 16 bit)

Whatever makefile solution I decide to use,
should work with CC65 (6502), SDCC (Z80), ZSDCC (Z80), SCCZ80 (Z80) and CMOC (6809), GCC for TI (TMS9900), C99C (TMS9900).

For the moment I am only compiling with CC65 (6502), ZSDCC (Z80), SCCZ80 (Z80).

User avatar
plbyrd
Vic 20 Hobbyist
Posts: 118
Joined: Tue Jun 01, 2010 9:32 pm
Website: http://thesharp.ninja
Location: Clarksville, TN
Occupation: Software Engineer

Re: How to use redefined characters in CC65

Postby plbyrd » Tue Aug 22, 2017 6:01 pm

Linzino wrote:The goal of my personal project is to write a little fun game for nearly all 8 bit computers (+ TI/994a which technically is 16 bit)

Whatever makefile solution I decide to use,
should work with CC65 (6502), SDCC (Z80), ZSDCC (Z80), SCCZ80 (Z80) and CMOC (6809), GCC for TI (TMS9900), C99C (TMS9900).

For the moment I am only compiling with CC65 (6502), ZSDCC (Z80), SCCZ80 (Z80).


I don't think you'll find an out-of-the-box Makefile, but you can definitely make one. (see what I did there?)

User avatar
beamrider
Vic 20 Nerd
Posts: 833
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: How to use redefined characters in CC65

Postby beamrider » Wed Aug 23, 2017 12:20 am

Linzino wrote: The reason to put code in a specific spot is for applications that do banking. Putting concise, shared pieces of code in an appropriately sized chunk of RAM is a big help and one of the great features of the linker in cc65.


Not only banking, but anywhere a non-contiguous memory layout is required or where specific segments must reside at specific memory locations (i.e. vic-20).


Linzino wrote:So, I need to figure out which part of the code should go to which segment.
I guess I can do this by looking at the size of the object files.


The linker will tell you if you overflow and by how much. You can look at the segment list in the .map file to see segments which can be rearranged to fill any gaps

Code: Select all

Segment list:
-------------
Name                   Start     End    Size  Align
----------------------------------------------------
ZEROPAGE              000002  00001B  00001A  00001
LOADADDR              0011FF  001200  000002  00001
EXEHDR                001201  00120C  00000C  00001
STARTUP               00120D  001246  00003A  00001
ONCE                  001247  001252  00000C  00001
CODE                  001253  0013FB  0001A9  00001
RODATA                0013FC  00140F  000014  00001
DATA                  001410  001438  000029  00001
INIT                  001439  001452  00001A  00001
BSS                   001453  001453  000001  00001
UDCCHAR               001C00  001C17  000018  00001


Return to “Emulation and Cross Development”

Who is online

Users browsing this forum: No registered users and 1 guest