home *** CD-ROM | disk | FTP | other *** search
/ PC Underground / UNDERGROUND.ISO / ports / par_test.pas < prev    next >
Pascal/Delphi Source File  |  1995-07-28  |  941b  |  30 lines

  1. Const Base=$378;                {base address of parallel port}
  2.  
  3. Procedure PutChar_Par(z:Char);
  4. {outputs a character to parallel port (base address in "Base")}
  5. Begin
  6.   While Port[Base+1] and 128 = 0 Do;
  7.                                 {wait for end of Busy}
  8.   Port[Base]:=Ord(z);           {place character on port}
  9.  
  10.   Port[Base+2]:=Port[Base+2] or 1;
  11.                                 {send strobe}
  12.   Port[Base+2]:=Port[Base+2] and not 1;
  13.  
  14.   While Port[Base+1] and 64 = 1 do;
  15.                                 {wait for Ack}
  16. End;
  17.  
  18. Procedure PutString_Par(s:String);
  19. {outputs string to parallel port, uses PutChar_Par)}
  20. Var i:Integer;                  {character counter}
  21. Begin
  22.   For i:=1 to Length(s) do      {each character}
  23.     PutChar_Par(s[i]);          {send to parallel port}
  24. End;
  25.  
  26. Begin
  27.   PutString_Par('Hello, Abacus Printer Test'#13#10);
  28.   PutString_Par('abcdefghijklmnopqrstuvwxyz0123456789'#13#10);
  29. End.
  30.