Questions tagged [cc65]

The cc65 C compiler and toolchain, including ca65 (Assembler), cl65, ar65, etc.

Filter by
Sorted by
Tagged with
11 votes
2 answers
1k views

Putting code into two different memory areas with cc65/ca65

According to cc65 / ca65 documentation, the .org directive does not affect the placement of the code unlike with other 6502 assemblers. The docs suggest defining a memory segment with the intended ...
2 votes
1 answer
133 views

CC65 ignores request to correctly offset memory areas in output files

I'm trying to segment my C code into two distinct memory areas, one which will be flashed to a ROM chip and another which will end up somewhere else. Here is what I have in sbc.cfg (I was originally ...
4 votes
1 answer
252 views

How to assign code to different PRG-ROM banks on an NES ROM using ca65/ld65

A similar question was asked here but I read it and didn't really understand the solution. What I'm trying to do here is make an NES ROM that uses Mapper 24, aka Konami VRC6 Version 1 (the one used by ...
3 votes
1 answer
283 views

Is there a way to have the ca65 assembler only expand macros?

I would like to convert an assembly program in ca65 with macros into assembly code with resolved macros in order to carry out manual or automatic optimizations with the resulting code. Then, the ...
5 votes
2 answers
372 views

Macro for counted string accepting multiple arguments?

Using ca65 assembler, I'd like to use a macro to encode a string as a pascal style string or FORTH counted string with a leading length byte. In ca65 documentation there is this example: ....
1 vote
1 answer
86 views

Is there a way to use .ident or * (PC) in numeric macro variables (using .set)?

I'm trying to write a macro to create "headers" in a linked list fashion. In each header the first 2 bytes should be the address of the previous header starting address (0000 in the first ...
9 votes
1 answer
580 views

Different handling of ASCII interpretation between ca65 and cl65

I stumbled upon a divergence in the ASCII upper case/lower case handling when using assembler and linker of the cc65 suite separately (I used cc65 V2.15 on Win10). For a test I made the following ...
7 votes
2 answers
664 views

Labels in cc65 inline assembler with #define macro

In general, it is possible to use inline assembler statements within C macros, for example #define toscreencode(C) (__AX__ = (C), \ asm("cmp #$60"),\ ...
1 vote
1 answer
368 views

Defining a C function with given address in cc65

I have a function that should be callable with the following syntax: void __fastcall__ initSIDplayer1(uint8_t a); The __fastcall__ modifier here means that the argument is passed in the Accu instead ...
4 votes
1 answer
276 views

Commodore 64 CC65 - I need help with config set up for using a data segment in Bank 3

I'm developing a game for C64 using CC65 to compile my C code to ASM. To get started quickly, I have been defining the data for my sprites in C arrays and then copying the data in those arrays to the ...
3 votes
2 answers
245 views

Printing German umlauts with cc65

I want to print German texts with umlauts with a compiled C program on the C64. I'm aware that these characters are not in the charset and that I will have to change the character set. However, it ...
5 votes
1 answer
525 views

Adding control characters to string constants in ca65 assembler

According to the cc65 documentation, a string constant in assembler programs can be defined with the .ASCIIZ command. However, I could not manage to sneak control commands in, for example, the ...
3 votes
1 answer
152 views

How to pass a value to an inline assembler script in a #define macro in cc65

I'm trying to add a compact #define macro in a cc65 program for performing various low-level tasks efficiently. For some of the macros, I need to pass a non-constant value to the assembler part. I ...
4 votes
3 answers
254 views

ca65 vs tass syntax: converting a hex address to decimal?

Most of the tass example programs start with a header like this, which places BASIC code at the beginning of the file that has an appropriate SYS instruction to run the rest of the application: * ...
3 votes
1 answer
522 views

How to read disk files using CBM specific functions in cc65 with proper error checking

TL:DR What is the reason my kernel_read() function ignoring file errors? I'm trying to understand how to work with files in cc65 using CBM specific functions. My target is Commodore 64 with 1541 ...
11 votes
1 answer
849 views

cprintf printing invisible characters in C program on VIC 20

I want to compile and run a Hello World program in C with the cc65 compiler for an unexpanded VIC-20 model. For printing I'm using the conio.h function cprintf, since the conio implementation requires ...