+xucaen Posted August 8, 2005 Share Posted August 8, 2005 Hi, I'm seeing examples of code that use TIM64T and INTIM. I'm reading page 12 of the Stella's Programming Guide. I'm not sure I understand what it all means. It sounds like any number you move into one of the interval timers gets multiplied by that interval and starts counting down to zero. So, page 12 says if I load #100 to TIM64T, then the timer would start counting down from 6400 clocks to zero. I'm confused about what a "clock" is. Is a clock one cpu cycle? So loading #100 to TIM64T would be 6400 CPU cycles? Another thing I am not clear on is, when the timer reaches zero, the Guide says "It holds that count for one interval". Is an interval one cpu cycle or is it 64 cpu cycles? Jim Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted August 8, 2005 Share Posted August 8, 2005 So loading #100 to TIM64T would be 6400 CPU cycles? Yup. Is an interval one cpu cycle or is it 64 cpu cycles? Yes, for TIM64T it is 64 cycles. Quote Link to comment Share on other sites More sharing options...
+xucaen Posted August 8, 2005 Author Share Posted August 8, 2005 Great! So I'm thinking that after the last WSYNC of Vblank, if I load the correct number into TIM64T, then that will count down through all the cpu cycles of the visible 192 scanlines. 192 * 76 cycles is 14592 / 64 = 228. or because loading TIM64 will take (I think) 5 cycles, I should load in 213. sample code might look like this? sta WSYNC;last wsync of the vertical blank ;in this example I think lda takes 2 cycles and sta takes 3 cycles ;so I have to subtract 5 from 76 to get 71 cycles. ;71 * 192 = 13632 ;13632 / 64 = 213 lda #213 sta TIM64T LOOP ;do some stuff lda INTIM bne LOOP ;we should be at the last visible scanline OverScan Does this look right? jim Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted August 8, 2005 Share Posted August 8, 2005 192 * 76 cycles is 14592 / 64 = 228.or because loading TIM64 will take (I think) 5 cycles, I should load in 213. No, you should still load 228, by using 213 you will loose about 4 scanlines (5*64 = ~4*76). And finally do one WSYNC do hit the exact end of the last scanline. BTW: Since the timer will go from 218 to 217 immediately, you will actually only wait for 217 timer loops. Quote Link to comment Share on other sites More sharing options...
+xucaen Posted August 8, 2005 Author Share Posted August 8, 2005 BTW: Since the timer will go from 218 to 217 immediately, you will actually only wait for 217 timer loops. Where did you get 218 or did you mean 228? Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted August 8, 2005 Share Posted August 8, 2005 Where did you get 218...? Where you got the 213: By mistake! 228 is correct. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.