(*----------------------------------------------------------------*) procedure send_char(character : integer); (* This procedure sends a character out of the port specified by the default condition or set by 'set port' command. The currently supported ports are reader/punch and UC1:. The output to the reader punch port is via the bios call to punch out. This is to (hopefully) be able to output 8 bit data so binary files can be transfered directly. The output to UC1: is done by changing the IOBYTE so the CON: port is UC1: and using a bios call. Notes: 1. The Digital Research manual specifies that input and output to the console and reader punch port is done with the high order bit set to 0. I have heard from reliable sources that this is not necessarily so, but it could cause a problem on some systems. Input : integer value of character to be sent. Output : none. Variables affected: none; *) begin case port_type_var of comm : bios(5, character); uc1 : begin iobyte := port_iobyte; (* use current port *) bios(3, character); iobyte := base_iobyte; (* return to original port for console *) end; end; (* case *) end; (*---------------------------------------------------------------*) procedure term; (* virtual terminal mode *) (* Term is the virtual terminal mode. Anything typed at the terminal is sent to the currently selected port, and anything the port receives is sent to the terminal. The terminal is port CON: and the default port is RDR:/PUN:. ^\C aborts the virtual terminal mode. Cleanup is done by deleting all cahracters in the input buffer at the time the connection is opened. All I/O is done via bios calls. No parity checking/stripping is done. Note: If I/O using read() and write() is done during port status checking, some incoming characters may be lost. I'm not sure why but it can hang you up totally. Input: none. Output : none. Variables affected: none. *) var letter, temp : integer; connect_exit : boolean; begin (* term *) connect_exit := false; temp := 0; writeln('Connected to remote host. Type Control-backslash c to return'); writeln('to local Kermit.'); iobyte := port_iobyte; while (bios(1) <> 0) do (* clear the input buffer *) bios(2); repeat iobyte := port_iobyte; if bios(1) <> 0 then begin if port_type_var = comm then letter := bios(6) else letter := bios(2); iobyte := base_iobyte; bios(3, letter); if printing then bios(4, letter); end; iobyte := base_iobyte; (* make sure we're back at console *) if bios(1) <> 0 then begin letter := bios(2); case letter of (* check for escape sequence *) escape_char : begin if temp = escape_char then send_char(escape_char) else temp := escape_char; end; $43, $63 : begin (* handle upper and lower case 'C' *) if temp = escape_char then connect_exit := true else send_char(letter); temp := 0; end; else begin if temp = escape_char then begin send_char(escape_char); write(con, bell); end; send_char(letter); temp := 0; end; end; (* case *) end; until connect_exit; iobyte := base_iobyte; (* make sure we're back at CON: *) end; (* term *)