home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol069 / termio.lib < prev    next >
Text File  |  1984-04-29  |  2KB  |  73 lines

  1. procedure writes( strng: alpha );
  2. { writes writes a string of type alpha to the console
  3.   device. }
  4. var    ix: byte;
  5. begin
  6.   for ix:=1 to strng[0] do
  7.     write( chr(strng[ix]) );
  8. end{ of writes };
  9.  
  10.  
  11. Procedure gotoxy(x_coord, y_coord: integer);
  12. var    ix: byte;
  13.     x_pos: integer;
  14. begin
  15.   x_pos := x_coord + X_OFF;
  16.   IF ( XY=2 ) AND ( x_pos<31 ) THEN x_pos := x_pos + 96;
  17.   writes( CUR );
  18.   IF ( XY=1 ) OR ( XY=2 ) THEN
  19.     write( CHR(x_pos), CHR(y_coord+Y_OFF) )
  20.   ELSE
  21.     write( CHR(y_coord+Y_OFF), CHR(x_pos) );
  22.   for ix:=0 TO DELCUS do {};
  23. end;
  24.  
  25.  
  26. FUNCTION INITTERM: BOOLEAN;
  27. { RETURNS TRUE IF TERMINAL DATA FILE FOUND  }
  28. {      FALSE IF DATA FILE NOT FOUND!     }
  29. TYPE    BFILE = FILE OF BYTE;
  30. VAR    bx     : byte;
  31.     termio : BFILE;
  32.  
  33.    procedure gets( var fb: BFILE; var strng: alpha );
  34.    { gets a string of type alpha from the
  35.      specified file of type BFILE. }
  36.    var       ix: byte;
  37.    begin
  38.      read( fb, strng[0] );       { first byte is always length }
  39.      for ix:=1 to strng[0] do
  40.        read( fb, strng[ix] )
  41.    end{ of gets };
  42.  
  43. begin
  44.   { OPEN file TERMIO.FIL for READ assign TERMIO }
  45.   reset('TERMIO.FIL', termio);
  46.   if eof(termio) then { file does not exist }
  47.      INITTERM := FALSE
  48.   else begin
  49.     INITTERM := TRUE;
  50.     { first 5 bytes in this sequence }
  51.     { strings must be read back in same sequence as were written }
  52.     read( termio,
  53.           BX,     { length byte }
  54.           DELMIS, DELCUS, X_OFF, Y_OFF, XY );
  55.     gets( termio, CLRSCR );
  56.     gets( termio, CUR );
  57.     gets( termio, eraeos );
  58.     gets( termio, eraeol );
  59.     gets( termio, HOME );
  60.     gets( termio, LockKbd );
  61.     gets( termio, UnlockKbd );
  62.     gets( termio, LINDEL );
  63.     gets( termio, LININS );
  64.     gets( termio, INVON );
  65.     gets( termio, INVOFF );
  66.     gets( termio, CRSON );
  67.     gets( termio, CRSOFF );
  68.   end{else}
  69. end{ of INITTERM }{ CLOSE(termio); };
  70.  
  71.  
  72.  
  73.