[Coco] Writing a program for a cartridge

Arthur Flexser flexser at fiu.edu
Mon Jan 25 05:03:19 EST 2016


I'm wondering if the STA $FF58 is the appropriate instruction.  Aren't
interrupt flags cleared by loading from an address rather than storing to
it?

You might check if the routine has been properly transferred to $3000 by
examining memory there after the cold start.  The cold start shouldn't
touch memory at that location.

Art

On Mon, Jan 25, 2016 at 4:32 AM, Barry Nelson <
barry.nelson at amobiledevice.com> wrote:

>  Ok, I'm trying to write a program that will manipulate some hardware
> registers in a cartridge and change the rom that is mapped at $C000 and
> then cold start the computer once the new rom is mapped in. This is what is
> haveā€¦
>
>         ORG        $C000
> START   ORCC       #$50   Disable interrupts
>         LEAX       TORAM,PCR
>         LDY        $3000
> LOOP    CMPX       ENDRT  Copy code at TORAM into ram
>         BEQ        EXIT
>         LDA        ,X+
>         STA        ,Y+
>         BRA        LOOP
> EXIT    JMP        $3000  Jump to copied code
> TORAM   ORCC       #$50   Disable interrupts
>         CLRA
>         STA        >$0071  Clear flag to indicate cold start
>         STA        $FF58   Clear cart interrupt flag, This disables the
> CART line
>         STA        $FF5A   Clear bank # high bits for selecting the rom
> bank #
>         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
>
> If I disable the cartridge autostart and type the commands below from
> basic it works, but the above code does not.
>
> POKE &HFF58,0:POKE &HFF59,4:POKE &HFF5A,0:POKE &HFFDE,0:POKE &H71,0:EXEC
> PEEK(&HFFFE)*256+PEEK(&HFFFF)
>
> > msmcdoug msmcdoug at iinet.net.au
> > Mon Jan 25 03:46:15 EST 2016
> >
> > Might be easier if you described the issues you're having.
> >
> >
> > Sent from my Samsung device
> >
> > -------- Original message --------
> > From: Barry Nelson <barry.nelson at amobiledevice.com>
> > Date: 25/01/2016  6:59 pm  (GMT+10:00)
> > To: coco at maltedmedia.com
> > Subject: [Coco] Writing a program for a cartridge
> >
> > I am trying to write a cartridge based program and I am having some
> issues. I want to make sure I understand the cartridge startup sequence. As
> I understand it, if the cart pin is enabled, the code in the cartridge is
> executed starting at $C000. Is that correct? Is there anything else I
> should know about writing code to run from a cartridge?
> >
> > --
> > Coco mailing list
> > Coco at maltedmedia.com
> > https://pairlist5.pair.net/mailman/listinfo/coco
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list