Questions tagged [cc65]
The cc65 C compiler and toolchain, including ca65 (Assembler), cl65, ar65, etc.
17
questions
7
votes
1
answer
700
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 ...
2
votes
3
answers
906
views
Efficiently defining a C function by 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 ...
2
votes
2
answers
255
views
How do I save data from a program with CC65 [closed]
I wanted to have a calculator program be able to save a set of answers on a floppy disk or tape but I have no idea what I should do.
I am aware that the "cbm.h" library can be used to load ...
11
votes
2
answers
2k
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 ...
3
votes
1
answer
191
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 ...
5
votes
1
answer
551
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
432
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 ...
6
votes
2
answers
445
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
96
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
693
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
890
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"),\
...
4
votes
1
answer
365
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
325
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 ...
3
votes
1
answer
183
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
343
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
643
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
1k
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 ...