home *** CD-ROM | disk | FTP | other *** search
- { DUMBTERM/POSTLOAD
- Plain vanilla comm program to demonstrate SUPERCOM.PAS
- In addition, demonstrates how to postload SUPER.COM from
- Turbo Pascal}
- {
- (C) Copyright 1986, Doctor Debug/Steel City Software
- All Rights Reserved
-
- SUPER.COM must be loaded for this program to function correctly
-
- Do not run this program from the Turbo environment! Compile to a COM
- file first! Be sure to set the Maximum Free Dynamic Memory (in the
- Turbo Options menu) to 1000H or less. (400 is enough).
-
- To exit program, type Ctrl-Z
- }
-
- {$ISupercom.Pas} {Bring in Comm library}
- {$iExec.Pas} {Routines to execute another program from Turbo}
-
- Var
- x:LString; {255 byte string - defined in SUPERCOM library}
- a,a1:char;
- i,b,c:integer;
- FilVar: Text;
- FileName: String[14];
- Code: integer;
- KeyCode: byte; {needed for GetChar to work}
-
- {$iGetChar} {Function to read a character}
-
- Begin {Main Program}
- code := ExecCommand('Super /X');
- {code will have error code is it didn't load}
- If (code <> 0) then
- Begin
- Writeln('Unable to Post-Load SUPERCOM.');
- Halt;
- End;
- If not(SuperComPresent) then
- Begin
- Writeln('Unable to Post-Load SUPERCOM.');
- Halt;
- End;
-
- (* Now we can procede normally *)
-
- writeln ('Opening Supercom Port');
- InitPort(1,1200,Even,7,1); {opens port 1}
- ClearBuff; {make sure buffer empty}
- FileName := 'TEXT.TXT';
- Assign(FilVar,FileName); {open file for capture}
- Rewrite(FilVar); {write from beginning}
- a := ' ';
- while a <> Chr(26) {26 = end of file char}
- Begin
- if keypressed then {this loop if key was pressed}
- begin
- a := GetChar; {get keypress}
- If a <> chr(26) then {control Z? (signifies end)}
- XmitCh(a); {no, send character}
- end;
- c := rlen; {# of chars in input buffer}
- If c <> 0 then {this loop if there are chars}
- begin
- if abs(c) > 255 then {only get blocks of 255}
- c := 255;
- recblk(c,x); {input data into x array}
- Write(x);
- Write(FilVar,x);
- end; {if}
- end; {while}
- Close(FilVar); {close output file}
- KillPort; {close Supercom port and remove from memory}
- end. {Done!}