Re: [cc65] Newbie question, using cc65 for Apple II assembly

From: Oliver Schmidt <>
Date: 2015-11-15 14:29:47
Hi Mark,

[...] have been using Liza as my compiler.

Rather Lisa -

> [...] compile hello.c in the example on this intro page (
>, convert it to a disk image using
> Apple Commander, and brun the program successfully using AppleWin.


> However, I tried to use the hello program as a template and any assembly
> code I try to write myself does not work. Does anybody have any suggestions?

My first suggestion would be to go a totally different route. The idea to
use machine generate assembly code as starting point for own assembly code
is a bad idea(tm).

If you want to use the cc65 toolchain for assembly code then ignore the C

> I used the command cc65 -O -t apple2 hello.c to get a copy of the assembly
> source for the example program (hello.s), included below for quick
> reference.
> I tried modifying hello.s by deleting the assembly code between
> .segment CODE and .endproc, and adding my own code. I literally just added
> one line, lda #$20, keeping the format with columns, etc. as in the
> example. I also tried removing the .import statements, and various other
> modifications to the text above int_near_main but nothing worked.

"nothing worked" isn't an exactly precise problem description, is it?

> After making the changes to hello.s I used the ld65 tool to create the
> file for apple commander, just as in the example.

> My method for evaluating the results was, in AppleWin bload test, A$6000,
> enter the apple monitor (call -151), enter 6000L, and observe whether the
> machine instruction equivalent to my assembly code was there.

Ageneral thought about debugging: You had something working and now you
have something non-working. Then you have to do the changes you made
one-by-one and see when it starts breaking. From that you know which change
is the culprit. I bet that in your case adding the lda#$20 isn't the change
that breaks your thing.

From what you write above I'd that you linker the program to the default
address which is $803. Then you tried to run it from address $6000. This
can't work. 6502 assembly is in general not position-independent.


To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun, 15 Nov 2015 14:29:47 +0100

This archive was generated by hypermail 2.1.8 : 2015-11-15 14:29:57 CET