Re: [stella] Qb/playfield timing

Subject: Re: [stella] Qb/playfield timing
From: "Andrew Davie" <adavie@xxxxxxxxxxxxx>
Date: Tue, 6 Feb 2001 16:38:53 +1100
> I took a look at Qb and I'm trying to understand the cycle count
notations.

I use the following notation in my code (and please don't rely on my timing
in previously submitted code.  I've only just tightened it up, and fixing up
the comments)...  but as I said, to help ME during coding, I use the
following notation

    instruction  ;cycles ->ends@time    < must_start_before (now_starting@)

Sooo,

    sta PF0        ; 3 ->45     <49 (@42)

Tells ME that the instruction starts at cycle 42, SHOULD start before cycle
49 (it does), and that it ends at cycle 45 (being 3 cycles long).  It's just
a sort of shorthand that I use to check that I'm doing everything allright.
Here's the first line of my current kernal, with correct timing notation...

MTargetArea

     ; LINE 1 -------------------------------

        sta WSYNC               ; 3                             wait for
start of hblank

        lda #%00000000          ; 2
        sta PF0                 ; 3 ->8         < ? (@5)
        lda playfield,x         ; 4
        sta PF1                 ; 3 ->15        < 28 (@12)
        lda playfield+1,x       ; 4
        sta PF2                 ; 3 ->22        < 39 (@19)

        inc Sprite0Line         ; 4

    ; right pf

        lda playfield+2,x       ; 4
        and #$7f                ; 2
        sta PF0                 ; 3 ->35        < 49 (@32)

        ldy YFudge,x            ; 3
        lda TargetDisplayL,y    ; 4
        sta temp                ; 3
        and temp+3              ; 3
        sta PF1                 ; 3 ->51        < 55 (@48)
        lda TargetDisplayR,y    ; 4
        sta temp+1              ; 3
        and temp+3              ; 3
        sta PF2                 ; 3 ->64        < 66 (@61)

        ldy Sprite0Line         ; 3                             THE FIRST
SPRITE INDEX
        lda SpriteRedirect,y    ; 4
        tay                     ; 2

        lda (Sprite0),y         ; 6
        sta GRP0                ; 3 ->82 (6 OVER)               GRAPHICS FOR
SPRITE 0

     ; LINE 2 -------------------------------

        ; OVERSCANNED BY 6 CYCLES (OK)

...etc

I'm pretty sure the exact range values for legal writes of PF0-PF2 have
already been mentioned;  this is almost certainly where I got the values I
am using!

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

----- Original Message -----
From: "Glenn Saunders" <cybpunks@xxxxxxxxxxxx>
To: <stella@xxxxxxxxxxx>
Sent: Tuesday, February 06, 2001 3:36 PM
Subject: [stella] Qb/playfield timing


> For the record, what is the right cycle count after WSYNC to rewrite the
> playfield registers for the right half of the screen?
>
> I took a look at Qb and I'm trying to understand the cycle count
notations.
>
>          ; right pf
>          lda playfield+2,x       ; 4
>          sta PF0                 ; 3             < 49 (now@42)
>          lda TargetDisplayL,y    ; 3
>          sta PF1                 ; 3             < 55 (now@48)
>          lda TargetDisplayR,y    ; 3
>          sta PF2                 ; 3             < 66 (now@54)
>
> Does this mean that
> PF0 must be rewritten somewhere around cycle count 42-49,
> PF1 between cycle count 43-55, and
> PF2 somewhere between 54 and 66?
>
> I'm just wondering what the exact min-max cyclecounts for each write so I
> can maximize time for inserting the sprite register routines in my game.
>
> I can surely experiment, and probably will, but I was hoping this was
> documented somewhere already.
>
> Also, I am having trouble digging up the INV sources from the
> archives.  Could someone point me in the right direction?
>
>
>
>
> -
> 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