{$M 4000, 0, 0} program ATOM046C { tests access to $40:$6c } {$IFNDEF MSDOS} Fail {$ENDIF} ; uses Dos ; var head : word absolute $40:$1A ; tail : word absolute $40:$1C ; procedure FlushKB ; begin head := tail end { TSFAQP #16 } ; function KeyPressed : boolean { without Crt } ; begin KeyPressed := head<>tail end ; procedure TestProc ; var N, S, T : longint ; Timer : longint absolute $40:$6C ; begin N := 0 ; S := 0 ; repeat Inc(S) ; Timer := $0000FFFF ; repeat if KeyPressed then EXIT ; Inc(N) ; T := Timer ; if (T<>$0000FFFF) and (T<>$00010000) then Writeln('Loop # ', N, ', Ticks tested ', S, ', Timer read ', T, ' = fail') ; until T<>$0000FFFF ; until false ; end {TestProc} ; BEGIN Writeln('ATOM046C.PAS www.merlyn.demon.co.uk >= 2000/02/26') ; Writeln(' See http://www.merlyn.demon.co.uk/pas-time.htm') ; Writeln(' Not intended for use in a Window.') ; Writeln(' Press any key to terminate test :') ; TestProc ; FlushKB ; SwapVectors ; Exec(GetEnv('COMSPEC'), '/C TIME') ; SwapVectors ; { This reads $40:$6C non-atomically when compiled with BP7 (as Borland compiles longint access as two word accesses), as shown by the readings of 131071; but not shown in TP5. } END.