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

From: Karri Kaksonen <>
Date: 2011-01-24 13:03:03
On 01/24/2011 01:46 PM, Oliver Schmidt wrote:
> Hi,
> I guess several cc65 targets allow one way or another to replace the
> currently running program with another one without manual user
> intervention.

The Lynx has the loading address in the file descriptor so we already 
have a special command

void __fastcall__ lynx_exec (int fileno);
/* Load a file into ram and execute it. */

This will actually do:

open("filenr_in_ascii", O_RDONLY);
read(fd, FileEntry.Address, FileEntry.size)
jmp FileEntry.Address

This is very nice for compilation carts where the binary executables are 
not created by cc65. In this way I can build a main menu from choosing 
what to run and turn over the Lynx to the loaded game in a single command.

The Lynx can only have one file descriptor open at any time because we 
have only one counter for the streamed cart. So I would not want to keep 
any file descriptor open after the exec. Voting for a separate method 
for every platform.

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

This archive was generated by hypermail 2.1.8 : 2011-01-24 13:03:15 CET