[stella] Alpha Source

Subject: [stella] Alpha Source
From: Manuel Polik <manuel.polik@xxxxxxxxxxx>
Date: Fri, 05 Jan 2001 15:33:55 +0100
Hi there!

Ok, here comes the source of the Alpha Demo.

Some words first:

See it as my tribute to the stella list, maybe call it payback. In no
way I want to critisize the original work. This stuff made me learning
how to programm the VCS. Thank you.

There's two flaws in it, the 'Bira Bira' demo doesn't feature a working
single scanline kernel, which you might have noticed already and Piero
Cavinos demo appeared to be smoother in it's original form.

You'll find all credits and lots of comments at the beginning of the
source. (Stuff like which demo was choosen and which not and why...)

Feel free to try to correct the two *bugs* mentioned before, or to
crunch the demos further (There's still a lot space improvement possible
in the demos by Bob Colbert & Piero Cavino, I just stopped optimizing
when everything fitted in 2K :-)). I will update the demo with all fixes
& improvements sent in and eventually someday do a bigger 4K Megademo.

Please inform me, if I missed any stellalist demo earlier than May 97
which is not mentioned in the source, so that I can add it in the 4K

How it works:

I'll highlight some little pieces of the sourcecode, to give you an idea
how it works without analizing the whole source.

The first page is the key. Here is one *complete* kernel for every demo.
It looks like this:

    ORG     $F000

; This part is the Matt demo
Start               JMP MattReset       ; Reset everything for Matt
MattLoop            JSR VerticalSync    ; Common vertical
                    JSR VerticalBlank   ; Do-nothing vertical blank
                    JSR MattScreen      ; MattScreen does Overscan
                    BEQ MattLoop        ; Repeat

    ORG     $F010

; This part is the Robbie demo (There's no need to reset anything)
RobbieLoop          JSR VerticalSync    ; Common vertical
                    JSR VerticalBlank   ; Do-nothing vertical blank
                    JSR RobbieScreen    ; RobbieScreen does Overscan
                    BEQ RobbieLoop      ; Repeat

Notice that the space between two demos is always $10, we'll need that

Every demo can use any variable, except one of the first three, which
are strictly used as follows:

; Reserved Variables $80+$81 & $82
; (These cannot be used within the demos)
demoVector      = $80   ; vector used to skip to the next demo
switchesRead    = $82   ; stores the value of the switches 

Now comes the clue to the switching, which is done by the common
vertical sync routine, that _every_ demo uses:

VerticalSync        LDA #$02            ;
                    STA WSYNC           ; Finish current line
                    STA VSYNC           ; start vertical sync
                    LDA #$03            ;
                    STA TIM64T          ;
                    LDA SWCHB           ; Reset/Select button....
                    CMP switchesRead    ; same as last read?
                    BEQ WaitVSync       ; Y: Continue
                    STA switchesRead    ; N: Store new value
                    LSR                 ; Reset?
                    BCS NoReset         ; N: Continue
                    JMP Start           ; Y: Start over
NoReset             LSR                 ; Select?
                    BCS WaitVSync       ; N: Continue with vertical sync
                    LDA demoVector      ; Skip to next demo
                    ADC #$10            ;
                    STA demoVector      ;
                    LDX #$FF            ; 
                    TXS                 ; Restore Stack     
                    STA VSYNC           ; stop vertical sync
                    JMP (demoVector)    ; Jump to the next demo
WaitVSync           JMP WaitIntimReady  ; Wait until vertical sync

I hope the comments speak for itself.

This was the main idea behind it, but you might imagine, that a lot more
was needed to squeeze everything in 2K. Read the comments to get an idea
of what I did and check out the common subroutines located at the
beginning of the source. These are used by many of the demos and have
even different entry points for special situations...

Thats all for now,

Attachment: alpha.zip
Description: Zip compressed data

Current Thread
  • [stella] Alpha Source
    • Manuel Polik - Wed, 10 Jan 2001 00:53:35 -0500 (EST) <=
      • Erik Mooney - Tue, 16 Jan 2001 11:46:02 -0500 (EST)
        • Rob - Wed, 17 Jan 2001 01:01:45 -0500 (EST)
      • <Possible follow-ups>
      • Kurt . Woloch - Wed, 10 Jan 2001 02:29:56 -0500 (EST)