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

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2011-01-24 14:37:51
Hi!

On Mon, Jan 24, 2011 at 12:46:43PM +0100, Oliver Schmidt wrote:
> My question is if you think it is appropriate to call that function
> execl() / execv() or if a proprietary name would be preferable.

If we can find a behaviour that is portable across all (or at least several)
major 6502 platforms, I would call it "exec", otherwise I would prefer to call
it platform_exec or similar. 

At least for the CBMs I doubt that something like exec() is doable without
nasty 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 don't see keeping any file descriptors open on cc65 targets - do you?

I don't think this is a good idea for the CBMs, since "file descriptors" are
not a concept of the kernal, but of the running program. Which would mean that
the running program has to pass information to the following one somehow.

> Does this really make sense? But at least the cc65 desctructors need
> to be called. Otherwise there would be i.e. dengling interrupt vectors
> pointing to nowhere - wouldn't they?

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.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Jan 24 14:37:58 2011

This archive was generated by hypermail 2.1.8 : 2011-01-24 14:38:01 CET