danwinslow Posted October 13, 2014 Share Posted October 13, 2014 (edited) I'd like to find out how many CPU cycles my deferred VBI is taking. Are there ways to do that semi-accurately on real hardware? Maybe by finding out where the raster is? Also, I figure its possible on altirra, but I would also appreciate a clue or two on how to do that. Edited October 13, 2014 by danwinslow Quote Link to comment Share on other sites More sharing options...
Rybags Posted October 13, 2014 Share Posted October 13, 2014 You could take VCOUNT readings at the start and end. Possible chance it could wraparound so you'd need to consider that as well as Pal/NTSC difference - Pal less likely to wraparound in a shortish routine. Alternatively you could use one of the PADDLE registers on Pokey. They should reset to 0 during VBLANK and conveniently count up by exactly 1 per scanline. By the time your routine starts they could well be nonzero already. Such methods could be inaccurate to near 2 scanlines (paddles) or 4 for VCount. In Altirra, probably easiest to use a memory access breakpoint or two. Either set to that part of the program or (easier) put an instruction in that does some unique access and use it as a trigger. Favourite one for me is just put a STA $D700 - most configs have the D7 page not in use so it's a dummy write which you can trap and be 100% sure nothing else will trigger. Put a store instruction at the start and end of your routine, when it trips Altirra should give output in the debug window with PC/register states as well as the scanline and cycle on the line where the stop occurred. 1 Quote Link to comment Share on other sites More sharing options...
Xuel Posted October 13, 2014 Share Posted October 13, 2014 In Altirra: Debug -> Profile... -> Profile View In Profile View window click on pull down and select Call graph sampling Click on play button, wait for a few seconds, click on stop button Top-level tree items will be Main, IRQ, NMI (DLI) and NMI (VBI) For example: This is for X:8 which doesn't happen to use VBI interrupts, but if it did there would be a non-zero number of cycles and percentage on that row. You can expand the tree to see how much CPU time each of your functions takes. 3 Quote Link to comment Share on other sites More sharing options...
danwinslow Posted October 13, 2014 Author Share Posted October 13, 2014 nice, thanks guys. Quote Link to comment Share on other sites More sharing options...
phaeron Posted October 13, 2014 Share Posted October 13, 2014 In Altirra, the history pane can also be used for this. Right-click, change timestamp mode to unhalted cycles, then right-click again on the start of your routine and set timestamp origin. Delta cycles from the start will then be displayed, not counting DMA cycles. 5 Quote Link to comment Share on other sites More sharing options...
snicklin Posted October 15, 2014 Share Posted October 15, 2014 In Altirra: Debug -> Profile... -> Profile View ... Oh FFS!!!! The more I read about Altirra the better that it gets!!! I probably use 10% of the debugging functionality and the more I get to know, I realise more and more what power it has. The only frustrating thing is that I didn't learn all of this functionality before! Quote Link to comment Share on other sites More sharing options...
snicklin Posted October 15, 2014 Share Posted October 15, 2014 In Altirra, the history pane can also be used for this. Right-click, change timestamp mode to unhalted cycles, then right-click again on the start of your routine and set timestamp origin. Delta cycles from the start will then be displayed, not counting DMA cycles. I've just used this and ... it is truly amazing. How this is all done in real-time I do not know. Quote Link to comment Share on other sites More sharing options...
danwinslow Posted October 16, 2014 Author Share Posted October 16, 2014 I've just used this and ... it is truly amazing. How this is all done in real-time I do not know. I'm telling ya, Altirra is the single most valuable piece of debugging equipment I've ever seen. It's done in real time because he emulates everything, every single instruction cycle, so it's relatively trivial to record them and then provide reports and so forth. The hard part was getting the emulation to be so exact in the first place, and he's really done an amazing job. 3 Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted October 16, 2014 Share Posted October 16, 2014 yup... for upcoming projects I am using Altirra's debugger and single step functionality to check cycles, flags and registers... I love to step breakpoints in Eclipse source... jump into debugger... single step... run/skip subroutines which are needed by hitting one key... then single step again... history view is cool, too to see where code is getting interrupted which then can have a hint, wenn interrupt going mad or vice verser... and all at source code label level... only pain is...when assembling passing code back to an already running Altirra... it runs in monitor view... but all my code has console key checks at the beginning (to have a "real random number" in 53770)... I did not managed to press START with F2... so not sure how to get the console keys in debug window... ah... and by accident I realised (always missing Atari800win's F9 = Warp mode)... that F1 is the Warp mode as long as press the key... RTFM Quote Link to comment Share on other sites More sharing options...
MaPa Posted October 16, 2014 Share Posted October 16, 2014 You need to activate emulator window (the console windows has focus) by pressing Alt+1 or clicking into it with mouse, then it accepts input keys and joystick. 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.