home *** CD-ROM | disk | FTP | other *** search
- {
-
- T P R O N U M B E R 6
-
- The following is a set of procedures that we have been used in
- various commercial programs. Feel free to use them for commercial
- and noncomercial uses. We claim no responsibility to the outcome of
- the use of these procedures. You are using them at your own risk.
- Enough of the legalities. If you find these routines useful, we
- would greatly appreciate any small donation.
-
-
-
-
- Soft-Touch Computers
- James Billmeyer
- 7716 Balboa Blvd, Unit D
- Van Nuys, Ca 91406
- }
-
- program get_put_test;
-
-
- (*****************************************************************)
- (* This program demonstrates the getascii/putascii procedures. *)
- (* These procedures are used in the same manner as the get/put *)
- (* procedures described on page 173,174 of the Turbo Pascal *)
- (* 3.0 manual. These procedures are designed to only work in *)
- (* the text mode of the graphics card or the monochrome card. *)
- (* The variable buffer size is determined by the equation: *)
- (* buffer size = ((abs(x1 - x2) * abs(y1 - y2)) + 2 *)
- (* The first two bytes store the height and width information *)
- (* on the object or screen image "gotten". *)
- (* If speed is more important than screen flash, then change *)
- (* the following lines: *)
- (* repeat until (port[$3DA] and $8) > 0; *)
- (* to ^^ *)
- (* repeat until (port[$3DA] and $9) > 0; *)
- (* ^^ *)
- (*****************************************************************)
-
- type
- buf_type = array[1..296] of integer;
-
- var
- buffer1,
- buffer2 : buf_type;
- calcscr : file of buf_type;
- i : integer;
-
-
- procedure putascii(buffer: buf_type; x1,y1: integer);
-
- (**************************************************)
- (* This procedure is an ascii equivilant to the *)
- (* putpic procedure. *)
- (**************************************************)
-
- const
- segment = $B000;
- offset = $8000; (* this constant would be $0000 for monochrome *)
-
- var
- counter,
- row,j,
- bytes : integer;
- screen : array[1..4096] of integer absolute segment:offset;
-
- begin
- counter := 3;
- bytes := (buffer[1] + 1) * 2;
- for row := y1 to (y1 + buffer[2]) do
- begin
- j := ((row - 1) * 80) + x1;
- repeat until (port[$3DA] and $8) > 0;
- port[$3D8] := 33;
- move(buffer[counter],screen[j],bytes);
- port[$3D8] := 41;
- counter := counter + buffer[1] + 1;
- end;
- end;
-
-
-
- procedure getascii(var buffer: buf_type; x1,y1,x2,y2: integer);
-
- (**************************************************)
- (* This procedure is an ascii equivilant to the *)
- (* getpic procedure. *)
- (**************************************************)
-
- const
- segment = $B000;
- offset = $8000; (* this constant would be $0000 for monochrome *)
-
- var
- counter,
- row,col,
- j,i,bytes : integer;
- screen : array[1..4096] of integer absolute segment:offset;
-
- begin
- counter := 3;
- buffer[1] := abs(x1 - x2);
- buffer[2] := abs(y1 - y2);
- col := x1;
- bytes := (buffer[1] + 1) shl 2;
- for row := y1 to y2 do
- begin
- j := ((row - 1) * 80) + x1;
- repeat until (port[$3DA] and $8) > 0;
- port[$3D8] := 33;
- move(screen[j],buffer[counter],bytes);
- port[$3D8] := 41;
- counter := counter + buffer[1] + 1;
- end;
- end;
-
-
-
- begin
- clrscr;
-
- (* I am reading in a predefined screen symbol here to display later *)
-
- assign(calcscr,'calc.scr');
- reset(calcscr);
- read(calcscr,buffer1);
- close(calcscr);
-
- writeln('This is a test of the ascii get and put operations.');
- writeln('This is a test of the ascii get and put operations.');
- writeln('This is a test of the ascii get and put operations.');
- writeln('This is a test of the ascii get and put operations.');
- writeln('This is a test of the ascii get and put operations.');
- writeln('This is a test of the ascii get and put operations.');
- writeln('This is a test of the ascii get and put operations.');
- writeln('This is a test of the ascii get and put operations.');
- for i := 1 to 12 do
- begin
- if i <> 1 then
- putascii(buffer2,(i - 1),(i - 1));
- getascii(buffer2,i,i,(i + 20),(i + 13));
- putascii(buffer1,i,i);
- end;
- end.
-
- er2,(i - 1),(i - 1));
- getascii(buffer