rilden 2020-08-21 11:40
I wrote this small program to see how many cycles a piece of code takes.
To use it you need to replace the line "a=5" with your code.
Timo 2020-08-21 15:54
That looks very clever, I don't understand it yet completely ;)
rilden 2020-08-21 17:39
I use binary search to find out how many cycles are remaining after the test subprogram.
In the repeat until loop:
I wait for vblank to make sure I am at the start of the frame.
I call the test subprogram.
I call fill to spend m cycles.
I check the timer to see if I exceeded one frame of execution, then adjust the binary search window accordingly.
17547 cycles are remaining if the test subroutine is empty.
I subtract m from 17547 to find out how many cycles the tested code used.
Please ask if you have any other questions.
Timo 2020-08-21 19:25
Ah, I was wondering about the use of FILL, now I got it, good idea!
SP4CEBAR 2021-09-30 17:20
Nice workaround for the lower timer resolution