jeffry Posted June 13, 2018 Share Posted June 13, 2018 Can Batari Basic read the cycle counts? What I would like is to run 2 subroutines then display a 1 or 2 depending on which one is faster and also display the differnce in the score. Then I could paste code into the 2 subroutines and compare them. So is something like this possible? and if so how do I read the cycles? Quote Link to comment https://forums.atariage.com/topic/279699-cycle-count-batari-basic/ Share on other sites More sharing options...
ZackAttack Posted June 14, 2018 Share Posted June 14, 2018 You don't need to write any code for this. Just use the stella debugger. Set a break point before and after the section of code you want to profile and take note of the "F. Cycle" value at each breakpoint. Of course, this will only tell you how many cycles a routine takes for whichever code path is executed. It may not necessarily reflect the worst case scenario or the average. You'd really need to analyze the generated assembly listing to determine that. Quote Link to comment https://forums.atariage.com/topic/279699-cycle-count-batari-basic/#findComment-4048474 Share on other sites More sharing options...
jeffry Posted June 15, 2018 Author Share Posted June 15, 2018 Thanks ! Now, how do I go about setting the breakpoint? Quote Link to comment https://forums.atariage.com/topic/279699-cycle-count-batari-basic/#findComment-4049291 Share on other sites More sharing options...
ZackAttack Posted June 15, 2018 Share Posted June 15, 2018 Now, how do I go about setting the breakpoint? This post should help. Quote Link to comment https://forums.atariage.com/topic/279699-cycle-count-batari-basic/#findComment-4049399 Share on other sites More sharing options...
+Gemintronic Posted July 23, 2018 Share Posted July 23, 2018 Actually, it would be nice to be able to count cycles within batari BASIC. I have tried various uneducated ways to measure the difference between PAL and NTSC performance so I can automatically switch between PAL and NTSC colors upon starting my games. Needless to say I've failed so far. Quote Link to comment https://forums.atariage.com/topic/279699-cycle-count-batari-basic/#findComment-4077451 Share on other sites More sharing options...
+Karl G Posted July 24, 2018 Share Posted July 24, 2018 I don't follow how counting cycles would be able to detect the difference between NTSC and PAL consoles? If you are thinking frames/second, then that is a function of how the frames are generated by the programmer, not by the hardware itself. If you mean the very slight difference in clock speed, you would need a point of reference to be able to compare speeds. I believe some games on Melody boards use a timing chip to achieve the latter, but I don't know the details of how it works. 1 Quote Link to comment https://forums.atariage.com/topic/279699-cycle-count-batari-basic/#findComment-4077987 Share on other sites More sharing options...
+Gemintronic Posted July 24, 2018 Share Posted July 24, 2018 I don't follow how counting cycles would be able to detect the difference between NTSC and PAL consoles? If you are thinking frames/second, then that is a function of how the frames are generated by the programmer, not by the hardware itself. If you mean the very slight difference in clock speed, you would need a point of reference to be able to compare speeds. I believe some games on Melody boards use a timing chip to achieve the latter, but I don't know the details of how it works. I always figured I could increment a counter per frame and end up with a different amount when running in PAL or NTSC mode. I've tried putting this counter in the main loop and also tried when the vblank is triggered. Maybe that's my fatal logical flaw UPDATE: I just read up on set debug cyclescore. Thought it might be useful for counting cycles. For my purposes the cycle count DOES change when you "set tv ntsc" or "set tv pal". I guess this also brings up the fact that any code is gonna fail with PAL60 as the timings are NTSC. http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#debug Quote Link to comment https://forums.atariage.com/topic/279699-cycle-count-batari-basic/#findComment-4078160 Share on other sites More sharing options...
+Karl G Posted July 24, 2018 Share Posted July 24, 2018 Well, you can determine if bB is running in NTSC or PAL50 mode, I suppose - but you already know that because you set it yourself. More generally, on the assembly side, the number of cycle per frame depends on the number of scanlines, and that is determined solely by how many you, the programmer generate, not by the underlay console type. 1 Quote Link to comment https://forums.atariage.com/topic/279699-cycle-count-batari-basic/#findComment-4078217 Share on other sites More sharing options...
+Gemintronic Posted July 24, 2018 Share Posted July 24, 2018 I guess I should post my code that I used since it seems to directly address the original posters question The for next loop is just and example piece of code. You'd of course want to replace that with the routine you want to test for cycles used. set debug cyclescore set romsize 4k main rem //** RUN YOUR CODE TO TEST HERE **// for a = 0 to 64 next drawscreen goto main Quote Link to comment https://forums.atariage.com/topic/279699-cycle-count-batari-basic/#findComment-4078233 Share on other sites More sharing options...
TwentySixHundred Posted December 3, 2018 Share Posted December 3, 2018 Ok im going to dig this thread up rather then starting a new one. Wondering if anyone knows if "set debug cyclescore" works with the DPC+ Kernel? I have no issues with the standard Kernel and haven't tried the others. But having no luck with DPC+. Im thinking bankswitching could be the problem but even moving the command to the bank the mainloop is within is still not giving any results Quote Link to comment https://forums.atariage.com/topic/279699-cycle-count-batari-basic/#findComment-4169177 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.