Option to set single step (debug) mode at subroutine level.
$Step[On | Off]
$StepOff switches off the insertion of single step code before each code line. The code affected can no longer be debugged using the debug icon in the tray. In addition Ctrl-Break is disabled as well. This setting only affects code running inside the IDE.
$StepOff is used at the procedure level. Once a procedure is fully tested and error free the $StepOff directive speeds up the execution time and reduces the size of the subroutine. It'll save 5 bytes before each code line and reduces the speed about 18 cycles per line.
$StepOn re-enables the insertion of debug code before each line.
$Step (without On or Off) enables a single insertion of debug code, without disturbing the global setting. This could be useful for guarding a loop, so that the program can be stopped using Ctrl-Break.
$StepOff
Print Trial(1750000)
$StepOn
Print Trial(1750000)
Function Trial(value%)
Dim i As Int, t As Double = Timer
For i = 0 To 2000000
If i = value% Then Return Timer - t
$Step
Next i
Return Timer - t
EndFunc
NOTE: As with any timed example, other background routines may distort the results. In general, the second time value shown should always be higher than the first.
When the program is compiled to an executable all $Step code is removed. This directive is of use only in the IDE.
Naked procedures have the $StepOff directive by default.
$AutoPost, $ArrayChk, $For, $Obj, Naked
{Created by Sjouke Hamstra; Last updated: 17/09/2014 by James Gaite}