Re: [cc65] Calling another program: exec() ?

From: <>
Date: 2011-01-24 15:34:26
On 2011-01-24, at 14:37, Ullrich von Bassewitz wrote:

> At least for the CBMs I doubt that something like exec() is doable without
> nasty tricks.

Depends how we define "nasty" ;-) My definition would apply if we would like to account for _every_ possible combination of load addresses/starting methods. If we come up with sensible convention for the external prgs to be started, it could fit into "reasonable" pool of tricks.

> Assuming that the program to load is a BASIC program, or has a
> BASIC header, it must be loaded to the BASIC start and started by a call to
> BASIC. Since for the C64 the BASIC ROM is switched off, and the memory in
> question is occupied by the running program, an implementation would have to
> copy a small loader stub somewhere. Problem is that there is no safe
> "somewhere". Maybe someone has a good idea but all I can think of may collide
> with some sort of other program, customized kernal ROMs or whatever.

I recall we were doing this sort of stuff using page two and three locations, back in the days. Now - since I didn't find it - it must be in the docs somewhere, but I am not the first time missing a sort of mem usage map of standard cc65 targets configurations. Are all the "typical" page two/three locations used by default config/runtime already?

> The best idea would probably be to actually terminate the running program and
> run a new one instead, eventually passing some arguments as if they were
> passed on the "command line". This is the easiest and cleanest solution.

This seem to fit into the same place as the stub-loader you mentioned. Get into "safe" place then exit the caller plus load'n run the callee. All in one chunk seems to be the least "nasty" approach.

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Jan 24 15:41:15 2011

This archive was generated by hypermail 2.1.8 : 2011-01-24 15:41:18 CET