[fpc-pascal] converting a TP/BP library to FPC

waldo kitty wkitty42 at windstream.net
Thu Dec 6 15:11:58 CET 2012


On 12/5/2012 23:53, Chad Berchek wrote:
> Perhaps it would be sufficient to supply the time value from another source
> converted to the units the other code is expecting to see. Assuming the
> frequency for the BIOS timer is about 18.2 Hz:
>
> function TimeCounter: LongInt;
> begin
> Result := LongInt(Round(GetTickCount * 18.2065 / 1000));
> end;
>
> wherein GetTickCount is a function returning a value in milliseconds.

this is pretty much what i have thought about doing...

> However you'd have to be careful of the overflow wrap around and see if the
> old code can handle it.

that routine follows... it doesn't seem to be all that fancy, though...

Function TimeOut(Time:LongInt):Boolean;
   Var
     TimeDiff: LongInt;

   Begin
   TimeDiff := Time - TimeCounter;
   If TimeDiff < 0 Then
     TimeOut := True
   Else
     Begin
     If (TimeDiff > 780000) Then
     Dec(TimeDiff, 1572480);
     If TimeDiff < 0 Then
       TimeOut := True
     Else
       TimeOut := False;
     End;
   End;


>
> On 12/5/2012 6:25 PM, waldo kitty wrote:
>>
>> Var
>> TimeCounter: LongInt Absolute $40:$6C;
>>
>> FPC tells me the following...
>>
>> MKDOS.PAS(14,36) Fatal: Syntax error, ";" expected but ":" found
>>
>> i know this is using direct access to the timer ticker from the BIOS but
>> at this time, i don't know how to best handle it in FPC...
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>




More information about the fpc-pascal mailing list