Subject: [stella] 6 Digit Routine Cont. From: "Chris Larkin" <clarkin@xxxxxxxxxxxxx> Date: Tue, 9 Sep 2003 20:29:13 -0700 |
The Thrust source contains a plethera of great 6
digit routines... However the concept of how these routines work still eludes
me. It's only a few lines of code and I just don't get it!
Ugh.
The 6502 is by no means my forte'... I still kind
of just fumble my way through... Can someone help spell this out for
me?
To begin I have 6 seperate 8x8 graphics, is
there a maximum height for these graphics? I would assume the entire graphic
data has to fit on one page to keep cycle counts accurate? I
have questions in code.
*****************FROM THRUST SOURCE, ShowText
SUB************************
ShowText SUBROUTINE
ldy MsgDelayTab-1,x beq .skipWait .loopWait: sta WSYNC dey ; 2 bne .loopWait ; 2³ ^ Simple Enough
.skipWait: lda Planet and #~PLANETMASK bne .NTSCMsgCol lda MsgColTab_PAL,x ; 4 bne .contMsgCol DEBUG_BRK .NTSCMsgCol: lda MsgColTab,x ; 4 .contMsgCol: ^ 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.
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?
lda
LetterPtrTab,y ; 4
sta digitPtr ; 3 ^LetterPtrTab,Y = Address of first 8x8 Graphic? 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)??? ^Shouldn't this get the last byte of the second graphic? I'm confused how
it does this?
sta
digitPtr+2 ; 3
^digitPtr is in Zero Page... So the graphic data is loaded into
RAM...
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?
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
sty
GRP0
sty GRP1 sty GRP0 ^Why is GRP0 cleared
twice?
rts ******************************************************************************
The $10,000 question...
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 |
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] brother can you spare , Thomas Jentzsch | Thread | Re: [stella] 6 Digit Routine Cont., Thomas Jentzsch |
[stella] brother can you spare a ke, KirkIsrael | Date | Re: [stella] Starship 1 Proof of co, Glenn Saunders |
Month |