program GLASSTTY (input, output); {Dumb terminal program for the IBM PC. Please note that this is meant more as a test driver for COM_PKG1.ASM than as a reasonable way to use a PC as a terminal! Programmed by Richard Gillmann (GILLMANN@ISIB), 1983} {***INTERFACE TO THE COM_PKG1 ASYNCHRONOUS COMMUNICATIONS PACKAGE***} {initialize port and interrupt vector} procedure init_au(divisor:word); EXTERN; {turn off interrupts from the aux port} procedure close_a; EXTERN; {turn off dtr} procedure dtr_off; EXTERN; {turn on dtr} procedure dtr_on; EXTERN; {return number of characters in input buffer} function crcnt : word; EXTERN; {read next character in input buffer} function cread : byte; EXTERN; {return number of free bytes in output buffer} function cwcnt : word; EXTERN; {write a character to output buffer} procedure cwrit(ch:byte); EXTERN; {write a character to the input queue} procedure wlocal(ch:byte); EXTERN; {cause a break to be sent} procedure make_br; EXTERN; {***INTERFACE TO DOS***} function DOSXQQ(command, parameter: word): byte; EXTERN; var rate : word; divisor : word; ok : boolean; ch : byte; begin {Obtain baud rate from user} repeat ok := true; write('Baud rate = '); readln(rate); case rate of 300 : divisor := 384; 1200 : divisor := 96; 2400 : divisor := 48; 4800 : divisor := 24; 9600 : divisor := 12; otherwise begin writeln('Incorrect rate. Try again.'); ok := false; end {otherwise}; end {case}; until ok; writeln('Entering terminal mode...'); init_au(divisor); {terminal mode loop} while true do begin {infinite loop - exit with ctl/brk} if DOSXQQ(11,0) <> 0 then {character typed?} cwrit(DOSXQQ(8,0) and 127); {if so, strip parity & send} if crcnt <> 0 then begin {character received?} ch := cread and 127; {read port, strip parity} if ch <> 0 then {ignore NULs} ch := DOSXQQ(2, WRD(ch)); {if ok, display char} end {if}; end {while}; end.