Subject: RE: [stella] Math riddle : Loading TIM64T with 43 burns only 36scanlines (not 37) From: "Erik Mooney" <erik@xxxxxxxxxx> Date: Mon, 10 May 2004 12:53:24 -0500 |
Christian Bogey <khryssun@xxxxxxxx> wrote: > Using the following code burns only 36 scanlines > instead of 37 (?!?) : > > LDA #43 > STA TIM64T > > Wait_VBLANK_End > LDA INTIM > BNE Wait_VBLANK_End > STA WSYNC > > But I don't understand why !!! indeed : > - Storing 43 into TIM64T burns 43*64 = 2752 cycles Not exactly. Based on a quick test in PCAEWin's debugger, when you store 43 into TIM64T, it *immediately* decrements to 42, then waits 64 cycles before decrementing to 41, 40, and so on. Storing 43 to TIM64T actually makes INTTIM reach 0 at 1+42*64 = 2689 cycles later, or only 35.38 scanlines later. Either store 44 instead of 43 to TIM64T (which is how the sample code from Nick Bensema's original "How To Draw A Playfield" does it, although the comments are misleading), or use BPL instead of BNE (which will make it wait an extra 64 cycles until the 0 in INTTIM decrements to $FF.) (At least I believe this is the answer, although I could be wrong. :) ) ---------------------------------------------------------------------------------------------- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] Math riddle : Loading , Christian Bogey | Thread | RE: [stella] Math riddle : Loading , Christian Bogey |
RE: [stella] Stack pointer. Some qu, Christopher Tumber | Date | RE: [stella] Math riddle : Loading , Christian Bogey |
Month |