Smidge Posted November 19, 2021 Share Posted November 19, 2021 I've been writing a 2600 emulator from scratch and using Stella's debugger mode to help track down some timing issues, and I noticed something odd with how Stella handles the RIOT timer after it is initialized. In the game Dolphin, TIM64T is initialized to $30, and after the next instruction (LDY SWCHA, 4 cycles), the timer immediately decrements to $2f instead of holding the value $30 for 64 cycles. After that the timer is decremented every 64 cycles as expected. This I identified as the reason my emulator started drawing the first non-garbage frame of Dolphin one scan line later than Stella. I tend to trust that Stella is doing everything correctly, but is this actually the right behavior? To add more background, here is the relevant segment of code from Dolphin: f647 LDA #$30 ;2 cycles f649 STA WSYNC ;3 cycles f64b STA TIM64T ;4 cycles f64e LDY SWCHA ;4 cycles Immediately after STA TIM64T (scan cycle = 4), Stella sets TIM64T and INTIM to $30 and resets TIMINT and Total Clks to 0. INTIM Clks is unchanged from its previous value of 1. Immediately after LDY SWCHA (scan cycle = 8), Stella decrements INTIM to $2f. TIMINT remains at 0. Total Clks is now 4, and INTIM Clks in $3d. I checked another game (Adventure) and observed the same behavior. So who's right, me or Stella? (Okay obviously Stella's right, but why?) Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.