Re: [cc65] ca65 for stand-alone asm projects

From: Oliver Schmidt <>
Date: 2010-11-12 23:16:07
Hi Chris,

>> If I understand the above correctly then that's something done on the
>> Apple2 too. However the user needs to explicitly make us of it by
>> placing code in a HIGHCODE segment. See here:
>> So there are actually two segments copied by the Apple2 crt0.s:
>> - The INIT segment is copied in the heap/stack
>> - The HIGHCODE segment is copied under the ROM
> I didn't find it in a quick browse over the manual, so you could
> still hit me with the RTFM-Hammer.

Hm, the link above contains the paragraph:

"Enabling the Language Card allows to use it as additional memory for
cc65 generated code. However code is never automatically placed there.
Rather code needs to be explicitly placed in the Language Card either
per file by compiling with --code-name HIGHCODE or per function by
enclosing in #pragma codeseg (push, "HIGHCODE") and #pragma codeseg
(pop). In either case the cc65 runtime system takes care of actually
moving the code into the Language Card."

That's basically all necessary to know from the user perspective...

> How is the enabling/disabling of the ROM done? If code running
> in regular memory calls a function in HIGHCODE, someone would need
> to disable the ROM so that the function can be called, and afterwards
> enable the ROM again.

The link above contains the sentence:

"While running main() the Language Card bank 2 is enabled for read access."

So the idea it *not* to disable the ROM, call HIGHCODE and enable ROM
again. Rather it's call HIGHCODE whenever you want - and enable ROM,
call ROM, disable ROM when dealing with ROM.

Here's the classic example - calling ROM to print a character (in cout.s):

	; Switch in ROM and call COUT
	bit	$C082
	jsr	$FDED		; Vector to user output routine

	; Switch in LC bank 2 for R/O and return
	bit	$C080

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Nov 12 23:16:56 2010

This archive was generated by hypermail 2.1.8 : 2010-11-12 23:16:58 CET