[Coco] Writing a program for a cartridge

Robert Gault robert.gault at att.net
Mon Jan 25 09:03:03 EST 2016


Barry Nelson 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
>

Barry,

Why do you want to JMP [$FFFE] when you already have the correct rom bank 
addressed? Don't you want to JMP $C000 since the correct rom bank in the cart 
will now addressed at $C000?
Depending on what your actual rom intends, you may not want to reactivate cpu 
response to interrupts with the andcc #$af. That can wait until your intended 
rom does a setup of memory and any new interrupt routines.

Robert




More information about the Coco mailing list