;allocate and clear a TMTask record on the stack
;setting tmAddr := 0 means no task
moveq.l #(tmQSize/2)-1,d0 ;set up loop counter
; to clear TMTask
@clear clr.w -(sp) [TOKEN:15357]and clear TMTask record
dbra d0,@clear [TOKEN:15203]lear it a word at a time
move.l #60*1000*1000,d7 ;D7 := delay in microseconds
; (1 minute)
movea.l sp,a0 [TOKEN:15169]0 points to TMTask
_InsTime [TOKEN:15357]the task
move.l d7,d6 [TOKEN:15172]6 := copy of initial delay
move.l d7,d0 [TOKEN:15172]0 := delay time
neg.l d0 [TOKEN:15214]egate it for microseconds
_PrimeTime [TOKEN:15219]tart the timer
_RmvTime ;immediately stop it
;unused time will be returned in negated microseconds,
; so adding is really subtracting
add.l tmCount(a0),d7 ;D7 := initial delay -
; time remaining
;D7 now contains the overhead in microseconds of _PrimeTime and _RmvTime
movea.l sp,a0 [TOKEN:15169]0 points to TMTask record
_InsTime [TOKEN:15357]the task
move.l d6,d0 [TOKEN:15172]0 := delay time
neg.l d0 [TOKEN:15214]egate it for microseconds
_PrimeTime [TOKEN:15219]tart the timer
;beginning of code to be timed
; (in this example, a TimeDBRA loop)
move.w TimeDBRA,d0 ;number of DBRAs per millisecond
@dbraLoop dbra d0,@dbraLoop;waste a millisecond
;end of code to be timed
_RmvTime ;stop the timer
add.l tmCount(a0),d6 ;D6 := time used in microseconds
sub.l d7,d6 [TOKEN:15219]ubtract the Time Mgr overhead
adda.w #tmQSize,sp [TOKEN:15204]eallocate TMTask record
;register D6 now contains the number of microseconds
; used by the timed code