Aw: [stella] 6 Digit Routine Cont.

Subject: Aw: [stella] 6 Digit Routine Cont.
From: cybergoth@xxxxxxxx
Date: Wed, 10 Sep 2003 10:20:43 +0200 (CEST)
Hi there!

> ^ How can this always produce the same amount of cycles?
> ^ Why arent all the instruction cycles counted in comments?
> ^ This code is obviously not needed for me, however I'm not sure how
> ^many other cycles exactly I have to replace it with.

These cycles don't matter. They're not the same amount either.
 
>     sta     COLUP0              ; 3
>     sta     COLUP1              ; 3 = 10 <-- When I count, I get much more
> than 10?
> 
>     ldy     MsgTab,x            ; 4
> ^??????? Totally lost here |Load height of graphic?

I'd assume it displays different messages, so depending on the message he has to display different letters. X is the message ID and the table contains the letters.
 
>     lda     LetterPtrTab,y      ; 4
>     sta     digitPtr            ; 3
> ^LetterPtrTab,Y = Address of first 8x8 Graphic?

I'd think so.
 
>     lda     LetterPtrTab+1,y    ; 4
> ^Here is where I get lost? I don't understand how this gets compiled
> ^If LetterPtrTab = $1200 and Y is $05, then this returns $1200 + 1 + 5?
> ($1206)???

It returns the content at the address $1206.

> ^Shouldn't this get the last byte of the second graphic? I'm confused how it
> does this?

the 6 digitPtr are loaded with the adresses of the chars to display.
 
>     sta     digitPtr+2          ; 3
> ^digitPtr is in Zero Page... So the graphic data is loaded into RAM...

No, just the pointer is set.
 
>     lda     LetterPtrTab+2,y    ; 4
>     sta     digitPtr+4          ; 3
>     lda     LetterPtrTab+3,y    ; 4
>     sta     digitPtr+6          ; 3
>     lda     LetterPtrTab+4,y    ; 4
>     sta     digitPtr+8          ; 3
>     lda     LetterPtrTab+5,y    ; 4
>     sta     digitPtr+10         ; 3 = 46
> 
> 
> 
>     ldy     #5                  ; 2
> ;    ldy     MsgHeightTab-1,x
>     txa                         ; 2         don't change C!
>     eor     #MSG_C_2000         ; 2
>     bne     .msgLoop            ; 2³
>     ldy     #7                  ; 2 = 7/8
> .msgLoop:
> 
> ^ All graphics are 5 height, except Copyright which is 7...
> ^ These are all wasted cycles for me... in order for this to work for me
> however, 
> ^ I have to get this exact cycle count?

Again, no, since the code below kicks in with a WSYNC. Just load Y with your height.
 
>     dey                         ; 2     61
>     sty     tmpVar              ; 3     64
>     lda     (digitPtr+$8),y     ; 5     69
>     tax                         ; 2     71
>     sta     WSYNC               ; 3 --- 76 ---
>     lda     (digitPtr),y        ; 5      5
>     sta     GRP0                ; 3      8
>     lda     (digitPtr+$2),y     ; 5     13
>     sta     GRP1                ; 3     16
>     lda     (digitPtr+$4),y     ; 5     21
>     sta     GRP0                ; 3     24
>     lda     (digitPtr+$6),y     ; 5     29
>     sta     tmpVar2             ; 3     32
>     lda     (digitPtr+$a),y     ; 5     37
>     ldy.w   tmpVar2             ; 4     41
>     sty     GRP1                ; 3     44
>     stx     GRP0                ; 3     47
>     sta     GRP1                ; 3     50
>     sta     GRP0                ; 3     53
>     ldy     tmpVar              ; 3     56
>     bne     .msgLoop            ; 2³    59
> 
> ^This all makes sense

Sure? :-)

>     sty     GRP0
>     sty     GRP1
>     sty     GRP0
> ^Why is GRP0 cleared twice?
>     rts 

Both sprites are VDEL'd, so one write is only *preloaded* until triggered by the next.

> So assuming my graphics data is as follows, How do I get this subroutine to
> draw it correctly?
     
>     ORG $1200
> Graphic0    .byte $00,$00,$00,$00,$00,$00,$00,$00
> Graphic1    .byte $00,$00,$00,$00,$00,$00,$00,$00
> Graphic2    .byte $00,$00,$00,$00,$00,$00,$00,$00
> Graphic3    .byte $00,$00,$00,$00,$00,$00,$00,$00
> Graphic4    .byte $00,$00,$00,$00,$00,$00,$00,$00
> Graphic5    .byte $00,$00,$00,$00,$00,$00,$00,$00

Set up LetterPtrTab like this:

LetterPtrTab .word Graphic0, Graphic1, Graphic2, Graphic3, Graphic4, Graphic5

Greetings,
Manuel


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


Current Thread