Re: [stella] Odd Occurance in Program

Subject: Re: [stella] Odd Occurance in Program
From: "Chris Larkin" <clarkin@xxxxxxxxxxxxx>
Date: Thu, 9 Jan 2003 16:37:43 -0800
Yes I know using the missile adjusts timing a bit... and I have corrected
this kernel crashing problem... I don't know how I did it though :-)

I moved some things around, and saved some time with some optimisations, and
for the most part it's working again... So thanks for your help folks! :-)

--Chris

----- Original Message -----
From: "Erik Eid" <eeid@xxxxxxxxx>
To: <stella@xxxxxxxxxxx>
Sent: Thursday, January 09, 2003 3:21 PM
Subject: Re: [stella] Odd Occurance in Program


> I've attached some cycle counts to the code.  Hopefully the more expert
> programmers will swoop in and correct me.  :)
>
> Your comments indicate that the extra pixel from missle graphics
(indicated
> by $82) is disabled.  I'll assume that for this first section.  I will
also
> assume that PlusFive does not cross a page boundary and that neither does
> "BEQ Nope."
>
>      LDX #59 ;Used for debugging when X equates to this high, the kernel
> crashes. If below 50 the kernel functions fine.
> InCardLoop ;Loop 11 times, drawing card symbol and white box.
>      STA WSYNC
>      LDA PlusFive,X  ;  [0] +4, +5 if across a page boundary
>      STA GRP0        ;  [4] +3
>      LDA #%11100000  ;  [7] +2
>      STA PF2         ;  [9] +3
>      LDA $82         ; [12] +3
>              ;$82 is enabled if the symbol sprite requires an extra pixel
of
> data from the missle graphics. I have disabled this for testing.
>      BEQ Nope        ; [15] +3 if taken (assumed), +4 if across boundary
>      LDA PlusFive,X
>      STA ENAM0
>      JMP Laa
> Nope ;Delay to make all the symbols line up correctly
>      nop             ; [18] +2
>      nop             ; [20] +2
>      nop             ; [22] +2
>      nop             ; [24] +2
> Laa
>      nop             ; [26] +2
>      nop             ; [28] +2
>      nop             ; [30] +2
>      nop             ; [32] +2
>      LDA #%00110000  ; [34] +2
>      STA PF0         ; [36] +3
>      STA RESP0       ; [39] +3
>                ;Position Player graphic near middle of screen
>      STA RESM0       ; [42] +3
>      LDA #0          ; [45] +2
>      STA PF2         ; [47] +3
>      STA PF0         ; [50] +3
>      STA ENAM0       ; [53] +3
>      DEY             ; [56] +2
>          ;Y contains scan lines remaining on screen.
>      DEX             ; [58] +2
>          ;X contains card offset index
>      DEC $84         ; [60] +5
>          ;$84 contains how many scan lines remaining for this card
>      BNE InCardLoop  ; [65] +2 if not taken, +3 or 4 if taken
>
> This results in 67 cycles if no page boundaries are crossed by indexed
> addressing or branches.  Worst case, it's 71 cycles.
>
> What about if you do enable the missile?
>
>      LDX #59 ;Used for debugging when X equates to this high, the kernel
> crashes. If below 50 the kernel functions fine.
> InCardLoop ;Loop 11 times, drawing card symbol and white box.
>      STA WSYNC
>      LDA PlusFive,X  ;  [0] +4, +5 if across a page boundary
>      STA GRP0        ;  [4] +3
>      LDA #%11100000  ;  [7] +2
>      STA PF2         ;  [9] +3
>      LDA $82         ; [12] +3
>              ;$82 is enabled if the symbol sprite requires an extra pixel
of
> data from the missle graphics. I have disabled this for testing.
>      BEQ Nope        ; [15] +2
>      LDA PlusFive,X  ; [17] +4, +5 if across a page boundary
>      STA ENAM0       ; [21] +3
>      JMP Laa         ; [24] +3
> Nope ;Delay to make all the symbols line up correctly
>      nop
>      nop
>      nop
>      nop
> Laa
>      nop             ; [27] +2
>      nop             ; [29] +2
>      nop             ; [31] +2
>      nop             ; [33] +2
>      LDA #%00110000  ; [35] +2
>      STA PF0         ; [37] +3
>      STA RESP0       ; [41] +3
>                ;Position Player graphic near middle of screen
>      STA RESM0       ; [43] +3
>      LDA #0          ; [46] +2
>      STA PF2         ; [48] +3
>      STA PF0         ; [51] +3
>      STA ENAM0       ; [54] +3
>      DEY             ; [57] +2
>          ;Y contains scan lines remaining on screen.
>      DEX             ; [59] +2
>          ;X contains card offset index
>      DEC $84         ; [61] +5
>          ;$84 contains how many scan lines remaining for this card
>      BNE InCardLoop  ; [66] +2 if not taken, +3 or 4 if taken
>
> It's 68 cycles best-case and 72 worst-case.  However, do note that using
the
> missile is a bit more costly than not using it.
>
> Given this, I can't find something that screams out "I'm the problem."
Sorry!
> --------------------------------------------------------------------------
--------------------
> 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