Announcement

Collapse
No announcement yet.

Pascal to PB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pascal to PB

    Could somebody help me to translate to power basic this code portion written in pascal?
    It would be of great help for my, thank you.

    Code:
    {$IFDEF NewInt08}
    {$F+}
    var
      LI          : Longint;
    
    CONST
      Inside      : Boolean = False;
      ClockInt    : BYTE = $08;
      Smooth      : Boolean = True;
    
    procedure NewTimer(Flags, CS, IP, AX, BX, CX, DX, SI, DI, DS, ES, BP: WORD);
    interrupt;
    begin
      IF Inside = True THEN
      begin
        IF Smooth THEN
        ASM
          pushf
          CALL OldTimer;
          sti
        END;
        ASM iret end;
      END;
      Inside := True;
      Driver_IO;
      ASM
        pushf
        CALL OldTimer;
        sti
      END;
      Inside := False;
    END;
    
    procedure NewExitProc; far;
    var
      SaveExitProc: POINTER;
    begin
     { ExitProc := @SaveExitProc;}
      SetIntVec(ClockInt, @OldTimer);
      SaveExitProc:=ExitProc;
    END;
    {$F-}
    {$ENDIF}
    
    begin
      IF Driver_Init THEN
      begin
       {$IFDEF NewInt08}
        SaveExitProc := ExitProc;
        ExitProc := @NewExitProc;
        GetIntVec(ClockInt, @OldTimer);
        SetIntVec(ClockInt, ADDR(NewTimer));
       {$ENDIF}
      END;
    end.


    ------------------
    Gustavo Asplanatti
    [email protected]
    Gustavo Asplanatti
    gustavoa at computecsrl.com.ar

  • #2
    I am consumed with the desire to say the whole thing converts to:

    POPUP TIMER

    (If this is a piece of an MS-DOS TSR program, I know this is correct).


    MCM
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Yes, POPUP TIMER or POPUP INTERRUPT might be the right answer. It
      looks like this code needs to run on every tick, though, so the overhead
      may turn out to be excessive. If that proves to be the case, the interrupt
      handler will need to be written entirely in inline assembly language.

      Try POPUP TIMER first.

      ------------------
      Tom Hanlin
      PowerBASIC Staff

      Comment


      • #4
        -d

        [This message has been edited by Karl Lessmann (edited August 06, 2004).]

        Comment


        • #5
          The code modifies the time interruption DOS so that
          TRUMPET (Copyright 1992 by Peter R. Tattam) can manage
          the packages sent by my code regularly.
          I have already solved it, adding the capacity to manage
          UDP in the librery of Gerhard Zugarek TCPABI.INC, totally
          written in assembler.
          Of the other side receipt the packages sent under a program
          in Windows with PB Win 7.02.

          I thank your help and to be sincere I had also planned to
          use POPUP TIMER it was a simpler way to solve this.




          ------------------
          Gustavo Asplanatti
          [email protected]
          Gustavo Asplanatti
          gustavoa at computecsrl.com.ar

          Comment

          Working...
          X