Questions tagged [ca65]

ca65 is a powerful macro assembler for the 6502, 65C02 and 65816 CPUs.

ca65 is a powerful macro assembler for the 6502, 65C02 and 65816 CPUs. It is used as a companion assembler for the cc65 crosscompiler, but it may also be used as a standalone assembler.

15 questions
9
votes
2 answers

C64 Assembly Rendering a Sprite

I have written a short program in 6502 assembler for the Commodore 64 using the ca65 assembler and ld65 linker. The program should render a solid square sprite somewhere near the center of the display, but I don't see anything being rendered. This…
Woodrow Barlow
  • 8,477
  • 3
  • 48
  • 86
7
votes
1 answer

Change color of text without color memory in C64/Assembly

I have a code like below, and it works fine. It clears the screen, puts some color in color memory of first 12 characters on screen, and prints a text on the screen. jsr $e544 ldx #$00 lda #3 loopclr: sta $d800,x …
user4516901
7
votes
2 answers

Example of removing side borders on C64

I know that it's possible to remove top and bottom borders in C64 using assembly, and I've found example codes for that. But I can't find any example code for removing the side borders (which was invented by 1001 Crew.) Anybody know any examples of…
user4516901
5
votes
1 answer

ca65: Include Guard generates "Error: Identifier expected"

Trying to learn how to use the ca65 assembler, I've been battling with making include guards work. Googling and reading the ca65 Users Guide didn't help. Here's a minimal example that produces the error. $ ls -l total 16 -rw-r--r-- 1 me staff 60…
Quester
  • 81
  • 7
3
votes
1 answer

CA65 Segment Memory Map issue

I am working a 6502 project in CA65, and I am having trouble understanding some of the directives. What I want to do is have a segment defined as though it is in another part of memory, so that all of the addressing of that code is as though it was…
Speckpgh
  • 3,332
  • 1
  • 28
  • 46
3
votes
1 answer

CC65: Four lines bad, two lines good?

I'm trying to do IO using stdio.h on a Commodore 64, but I'm having with even the following program: #include void main(void) { printf("Foo\n"); printf("Bar\n"); /* printf("Foo\n"); */ /* printf("Bar\n"); */ } The problem…
Cactus
  • 27,075
  • 9
  • 69
  • 149
3
votes
2 answers

CA65: 'Range error' from 16-bit computed address

Given the following CA65 code: foo = $82 .scope LDA #$ff STA foo*$40 .endscope I get this error message: foo.s(5): Error: Range error (8320 not in [0..255]) Interestingly, the following version works as expected: foo = $82 …
Cactus
  • 27,075
  • 9
  • 69
  • 149
2
votes
1 answer

What is the difference between a regular label and procedure?

Recently I have started making code on 6502-based systems, and I have used the ca65 macro assembler. However I found out that it supports procedures using .proc . So I have been wondering what is the difference between these blocks of…
2
votes
1 answer

CL65 doesn't adjust addresses when using .align

I'm trying write an asm program that uses the .align directive to ensure data doesn't cross page boundaries. However, while the data is in the correct place in memory, the compiled code doesn't not use the correct address. According to the docs (…
BJury
  • 2,526
  • 3
  • 16
  • 27
2
votes
2 answers

Automatic padding to assemble certain instructions into predetermined addresses

I'd like to use CA65 to assemble a 6502 ROM that needs to run on its own, i.e. no other kernal available. I would like my program to start at $C000. But this means I'll also need to put $00 $C0 into the reset vector at $FFFC. Is there a way to have…
Cactus
  • 27,075
  • 9
  • 69
  • 149
1
vote
1 answer

How to get code to correctly run on an Apple ii

I've written a small piece of code (add.asm, shown below) in 6502 assembly but are having some problems to get it to run correctly on an apple ii emulator. Using the config file below, and ca65 and ld65, I can get a binary to compile. Then, using…
Andrew
  • 539
  • 5
  • 20
1
vote
2 answers

Compiling a simple program using ca65

I am beginning to learn 6502 assembly using Rodney Zaks' book Programming the 6502. In it there is example code, I would like to be able to run it on my macbook. I am hoping that the code will be able to run in the form it is presented in the book,…
Andrew
  • 539
  • 5
  • 20
0
votes
1 answer

CA65 NES issue with INY STY

I am new to CA65 and am trying to transfer a NESASM project over to it. I translated everything and it builds. When I run I get nothing. Just a black screen. Diving deeper I have an infinite loop. It seems to be having an issue with increasing…
theBrilliance
  • 61
  • 1
  • 7
0
votes
0 answers

How can "beq [label]" produce an out of range error?

I am trying to compile this code snippet, and can't for the life of me understand the assembler error: [...] .macro collflag flags RW_forced a8i16 lda EXRAM, x and flags RW_forced a16i16 .endmac [...] col_r: RW_forced a16i16 …
Lake
  • 4,072
  • 26
  • 36
0
votes
1 answer

Ensure data doesn't cross page boundary

I'm trying to create a switch statement as below, which works well until something crosses a page. The switch destination is auto generated, which is why its in another file. 'structure, x' holds the offset (the case switch). In the case below, it…
BJury
  • 2,526
  • 3
  • 16
  • 27