Jump to content
IGNORED

cycle count & batari Basic


jeffry

Recommended Posts

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?

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

I guess I should post my code that I used since it seems to directly address the original posters question :P 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
Link to comment
Share on other sites

  • 4 months later...

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 :?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...