home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / VIDEO_IO.ZIP / VIDEO_IO.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1985-09-03  |  3.6 KB  |  108 lines

  1. {
  2.   These procedures perform direct I/O with the color/graphics adapter.
  3.  
  4.   video_signal  - turns the video signal on / off to prevent "snow"
  5.                   during I/O operations: "true" parameter means "on"
  6.                   "false" parameter is "off".
  7.  
  8.   video_cursor  - moves the cursor to a given row and column, sets
  9.                   cursor display on/off, and modifies cursor type to
  10.                   one of three preset formats: 0=standard, 1=block,
  11.                   2=underscore.
  12.  
  13.   video_putstr  - writes a character string directly to the video RAM,
  14.                   beginning at a specified row and column.  Note that
  15.                   output will not wrap to the next row if the string is
  16.                   too long.
  17.  
  18.   video_setattr - sets the attribute bytes directly in the video RAM,
  19.                   beginning at a specified row and column for a given
  20.                   length.
  21.  
  22.   video_write   - writes the current video page to the screen file.
  23.                   Each page in the file is numbered from 0 to the
  24.                   maximum stored (depends on disk space, 4K per page).
  25.                   It is the user's responsibility to ensure pages are
  26.                   sequential on the file, i.e., that page numbers are
  27.                   not skipped when the file is written-to; otherwise
  28.                   errors will occur.
  29.  
  30.   video_read    - reads a page from the screen file into the current
  31.                   video page.  It is the user's responsibility to
  32.                   ensure that the page number requested has, in fact,
  33.                   been written to the file.
  34.  
  35.   The user must also open and close the video_file.
  36.  
  37.   Written and placed in the public domain by
  38.                  Glen F. Marshall
  39.                  1006 Gwilym Circle
  40.                  Berwyn, PA 19312
  41. }
  42. type
  43.   video_byte = array[0..1] of byte;
  44.   video_col  = array[1..80] of video_byte;
  45.   video_row  = array[1..25] of video_col;
  46.   video_page = array[0..3] of video_row;
  47.  
  48. var
  49.   video_file: file;
  50.   video_base: integer absolute $0000:$0463;
  51.   video_mode: byte absolute $0000:$0465;
  52.   video_ram:  video_page absolute $B800:0000;
  53.  
  54. procedure video_signal(sw:boolean);
  55.   begin
  56.     case sw of
  57.       true:  port[video_base+4] := video_mode;
  58.       false: port[video_base+4] := video_mode and $F7;
  59.     end;
  60.   end; {video_signal}
  61.  
  62. procedure video_cursor(var row, col: byte; sw: boolean; form: byte);
  63.   var
  64.     cursor_1, cursor_2: byte;
  65.   begin
  66.     gotoxy(col,row);
  67.     case sw of
  68.       true:  begin
  69.                case form of
  70.                  1:   cursor_1 := $00;
  71.                  2:   cursor_1 := $07;
  72.                  else cursor_1 := $06;
  73.                end;
  74.                cursor_2 := $07;
  75.              end;
  76.       false: begin
  77.                cursor_1 := $20;
  78.                cursor_2 := $00;
  79.              end;
  80.     end;
  81.     port[video_base] := $0A;
  82.     port[video_base+1] := cursor_1;
  83.     port[video_base] := $0B;
  84.     port[video_base+1] := cursor_2;
  85.   end; {video_cursor}
  86.  
  87. procedure video_putstr(var row, col: byte; var str; var attr: byte);
  88.           external 'video_io.bin';
  89.  
  90. procedure video_setattr(var row, col, len, attr: byte);
  91.           external video_putstr[3];
  92.  
  93. procedure video_write(var page_no: byte);
  94.   begin
  95.     seek(video_file,page_no shl 5);
  96.     video_signal(false);
  97.     blockwrite(video_file,video_ram,32);
  98.     video_signal(true);
  99.   end; {video_write}
  100.  
  101. procedure video_read(var page_no: byte);
  102.   begin
  103.     seek(video_file,page_no shl 5);
  104.     video_signal(false);
  105.     blockread(video_file,video_ram,32);
  106.     video_signal(true);
  107.   end; {video_read}
  108.