[Coco] Writing a program for a cartridge

Barry Nelson barry.nelson at amobiledevice.com
Mon Jan 25 16:51:36 EST 2016


Ok, I updated my program and it now it works as expected. Thanks everyone!

        ORG        $C000
START   ORCC       #$50   Disable interrupts
        LEAX       TORAM,PCR
        LDY        #$3000
LOOP    CMPX       #ENDRT
        BGT        EXIT
        LDA        ,X+
        STA        ,Y+
        BRA        LOOP
EXIT    JMP        $3000
TORAM   ORCC       #$50   Disable interrupts
        CLRA
        STA        >$0071  Clear flag to indicate cold start
        STA        $FF58   Clear cart interupt flag
        STA        $FF5A   Clear bank # high bits
        LDA        #4
        STA        $FF59   Set bank # to 4
        STA        $FFDE   Turn on the ROM in the memory map
        ANDCC      #$AF   Enable interrupts
        JMP        [$FFFE] Do restart
ENDRT   EQU        *
        END        START


On Jan 25, 2016, at 11:43 AM, "Barry Nelson" <Barry.Nelson at amobiledevice.com> wrote:

> Oops! Drat! Darn it! I should have caught that!
>  
> >        William Astle lost at l-w.ca 
> Mon Jan 25 11:02:33 EST 2016
>  
> >        You have a problem with your asm code. You're not actually copying the
> >         code to $3000. You're copying it to whatever address is *stored at* 
> >         $3000. You want immediate mode on the LDY instruction (#$3000).
>  
> >         Similarly, you want immediate mode for the CMPX instruction. Otherwise, 
> >         you're comparing the end of the copy with whatever 16 bit value is 
> >         stored at ENDRT, which will, of course, depend what's in your ROM at 
> >         that point.



More information about the Coco mailing list