Re: [cc65] loading and running another program on Atari

Date view Thread view Subject view

From: Shawn Jefferson (sjefferson_at_sd62.bc.ca)
Date: 2003-04-26 00:06:26


>
>I am attempting to access the binary load and run command in MyDOS (XIO command #39) 
>but everything I've attempted so far has failed miserably.
>Basically what I want to do is be able to have one cc65 program load
>and execute another cc65 program.  I don't care if the original 
>program is wiped out from memory.
>
>Does anyone have any example code on how to do this?  It doesn't have
>to be MyDOS specific, I just want to be able to run another program.

This got me curious and I tried it in SpartaDOS using CIO command #40 (load and run)  It works.  Here's the code, a little messy and the IOCB is hardcoded, but that probably doesn't matter:

; void loadrun (char *filename);

        .export         _loadrun
        .import         popax
        .include        "atari.inc"
        .importzp      ptr1

_loadrun:
        jsr popax           ; pop filename pointer
        sta ptr1            ; lo
        stx ptr1+1          ; hi

        ldx #$20

        lda ptr1
        sta ICBAL,x
        lda ptr1+1
        sta ICBAH,x

        lda #40
        sta ICCOM,x

        lda #4
        sta ICAX1,x

        lda #0
        sta ICAX2,x

        jsr CIOV
        rts


¯
Shawn Jefferson


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-04-26 00:09:16 CEST