[stella] Little Help Here

Subject: [stella] Little Help Here
From: "Tempest" <reicher6@xxxxxxxxxxxxx>
Date: Thu, 1 Mar 2001 16:55:56 -0500
Can someone post some easy to follow code for some displaying some simple
playfield and player graphics that are stored in a table?  I'm having
trouble retrieving and displaying them when they're stored in a table.

At the moment my Major Havoc type game does some simple joystick reading and
changes color depending on the direction you push.  It's not much but its a
start.  Now I need a background and a movable player sprite.

I've been tossing around some names for the game and I've settled on
Galactic Tactic.  I don't think Spectravision would mind...

Tempest



-----Original Message-----
From: owner-stella@xxxxxxxxxxx [mailto:owner-stella@xxxxxxxxxxx]On
Behalf Of Andrew Davie
Sent: Thursday, March 01, 2001 4:14 AM
To: stella@xxxxxxxxxxx
Subject: Re: [stella] Qb: v1.01 TITLE SCREEN!



> Cool, I like that title screen!
>
> You should also put your name on it, if there's enough space left. And
maybe center the whole thing verticaly a bit.
>
> I'll definitely have a look at your code, to find out, how you managed
that ;-)

Naaah, I'm not planning to put my name on the cart/code.  I've centered it a
bit (the calls to MB4).

Code follows.  The routines VBPreliminary and VBFinal were not included in
the byte-count, as they were already used for the other kernal display -
they've been re-used for the title screen.   That is, there was no
title-screen-related cost in using them.  This is the preliminary
(not-very-much-optimised) title routine, and as you can see its pretty
simple.  The best bit is how I packed almost full-screen graphics into just
4 bytes/line, just 6o bytes for the total screen graphics (I'll optimise-out
those trailing 0's later).  Total is about 180 bytes.



;---------------------------------------------------------------------------
---


QbTitle

        .byte %00000011
        .byte %00001111
        .byte %00011111
        .byte %00111110
        .byte %01111100
        .byte %01111000
        .byte %01111000
        .byte %01111000
        .byte %01111000
        .byte %01111000
        .byte %01111100
        .byte %00111110
        .byte %00011111
        .byte %00001111
        .byte %00000011
        .byte 0

QbTitle1

        .byte %00011111
        .byte %01111111
        .byte %11111111
        .byte %11110000
        .byte %11100000
        .byte %11000000
        .byte %11000000
        .byte %11000000
        .byte %11000000
        .byte %01111100
        .byte %11111110
        .byte %11111010
        .byte %11001111
        .byte %11011111
        .byte %10001111
        .byte 0

QbTitle2

        .byte %11100000
        .byte %11000000
        .byte %10000000
        .byte %10010000
        .byte %10110000
        .byte %10110011
        .byte %10110111
        .byte %10111111
        .byte %10111110
        .byte %10111110
        .byte %10101110
        .byte %11011110
        .byte %10110111
        .byte %01110011
        .byte %11110001
        .byte 0

QbTitle3

        .byte %10000000
        .byte %11000000
        .byte %11100000
        .byte %11100000
        .byte %11100000
        .byte %11110111
        .byte %11111111
        .byte %11111000
        .byte %11100000
        .byte %11100000
        .byte %11100000
        .byte %11100000
        .byte %00011001
        .byte %11011111
        .byte %10111111
        .byte 0


TitleScreen

        lda #0
        sta level
        sta COLUBK

TitleScreen2


        jsr VBPreliminary

        jsr MB4
        jsr MB4


                ; "2001"
        ldx #0
        stx S0
        stx S1
        inx
        stx S3
        stx S4
        inx
        stx S5
        inx
        stx S2


        lda level
        lsr
        cmp #8
        bcc l92
        lda #8
l92     sta playfield

        jsr VBFinal

        IF COMPILE_VERSION = PAL
        lda #60                 ; 30+ scan lines of overscan
        ELSE
        lda #41                 ; NTSC
        ENDIF

        sta TIM64T

        ldx #0
        ldy #0

Title   lda playfield
        sta AI_temp

ALine   sta WSYNC

        lda #0
        sta PF0
        lda QbTitle,x
        sta PF1
        lda QbTitle1,x
        sta PF2

        iny
        sty COLUPF
        nop

        lda QbTitle2,x
        sta PF0
        lda QbTitle3,x
        sta PF1
        lda QbTitle2,x
        and #$0f
        sta PF2

        dec AI_temp
        bpl ALine

        inx
        cpx #16
        bcc Title

        jsr ScoreLine


ThankES2
        lda INTIM
        bne ThankES2

        inc level
        beq GoWarm

        lda SWCHB
        and #3
        cmp #3
        beq TitleScreen2                           ; user intervention for
restart

GoWarm  rts

;---------------------------------------------------------------------------
---

VBPreliminary

        lda #D1+D6
        sta VBLANK              ; start with tia disabled

    ; require 3 VSYNC lines at start of frame
    ; ref: spg pp.1

        lda #D1
        sta WSYNC
        sta VSYNC               ; start vertical synch

        sta WSYNC               ; 1st
        sta WSYNC               ; 2nd   TV SYNCH (2 tested OK on PAL, 1
FAILED)
        sta WSYNC               ; 3rd, to satisfy ES :)

        IF COMPILE_VERSION = PAL
        lda #72                 ; PAL
        ELSE
        lda #31                 ; NTSC
        ENDIF

        sta TIM64T              ; 40/48 scan lines -2 (above)


        lda #0
        sta VSYNC               ; stop vertical synch
        rts


;---------------------------------------------------------------------------
---

VBFinal


endvb   lda INTIM
        bne endvb

        sta WSYNC
        sta VBLANK              ; end vblank period
;        sta WSYNC

        rts


--
 _  _  _| _ _        _| _    * _                               _  ,
(_|| )(_|( (/_\/\/  (_|(_|\/(_(/_                           ,~' L_|\
                                                         ,-'        \
see my Museum of Soviet Calculators at                  (            \
http://www.taswegian.com/MOSCOW/soviet.html              \    __     /
                                                          L,~'  "\__/
                                                              @--> v



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


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

Current Thread