Re: Re[2]: [stella] Bank-switching

Subject: Re: Re[2]: [stella] Bank-switching
From: "Andy Mucho" <andy@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 2 Aug 2003 10:07:58 +0100
Vlad Pylin wrote:

> I want a cartridge 256K with 128 banks of 2K each.
> I know that the upper 2K of the address space is the last 2K of the ROM
and
> the lower 2K is the selectable bank. Writing to 003Fh selects this bank.
It
> is possible to access the TIA at 0040-007fh though (instead of the usual
> 0000-003fh).
>
> Please, write me how can I use it in my code and compile with DASM,
because
> I don't find that in the archives.
>

    processor 6502
    include "VCS3F.h"

    ;;
    ;;    This lives in Bank 0..
    ;;
    SEG
    ORG $00000        ;    < Bank starts at  0k in ROM
    RORG $F000
somedata:
    .byte 1,2,3,4,5,6,7,8

    ;;    This lives in Bank 2..
    SEG
    ORG $00800        ;    < Bank starts at 2K in ROM
    RORG $F000
somecode:
    rts

    ;;
    ;;    This lives in Bank 64..
    ;;
    SEG
    ORG $20000    ;    < Bank start at 128K in ROM
    RORG $F000
somemorecode:
    inx
    stx COLUBK
    jmp somemorecode

    ;;
    ;;    This lives in Bank  96..
    ;;
    SEG
    ORG $30000    ;    < Bank start at 192K in ROM
    RORG $F000
somemorecode:
    inx
    stx COLUBK
    jmp somemorecode

    ;;
    ;;    The boot/constant bank at $F800 which lvies in Bank 127
    ;;
    SEG
    ORG $3F800
    RORG $F800
RESET:

    ;;
    ;;    Bank in bank 64 in $F000
    ;;
    lda #$20000/$0800
    sta $3F
    jsr somemorecode

    ;;
    ;;    Bank in Bank 1 into $F000
    ;;
    lda #$0800/$0800
    sta $3F
    lda SomeData from bank

    ORG $3FFFA
    .word RESET
    .word RESET
    .word RESET


That's just about the way ti works..

    SEG
    ORG $??000
    RORG $F000

Are your friends :)

andym

----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread