home *** CD-ROM | disk | FTP | other *** search
- { ROS.MCH - Remote Operating System Machine Dependent Routines }
-
- { File: COMPUPRO.MCH
- Description: This driver set is designed to support the CompuPro Interfacer-4
- Date: 9/16/85
- Author: Paul Traina
- }
-
- {** System routines **}
-
- procedure system_init;
- { Initialization to be done once when ROS first starts }
- begin
- end;
-
- procedure system_de_init;
- { De-initialization to be done once when ROS terminates }
- begin
- write(esc,'h');
- end;
-
- procedure putstat(st: StrStd);
- { Display 'st' on status line }
- begin
- write(esc,'f',^S,st,cr,esc,'g');
- end;
-
- {** Remote channel routines **}
-
- { Port locations }
-
- const
- DataPort = $10; { Data port }
- StatusPort = $11; { Status port }
- ModePort = $12; { Mode port }
- CtrlPort = $13; { Control port }
- UserPort = $17; { Chip select port }
- Chip = 6; { Chip to send to for modem }
-
- { ModePort commands }
-
- B8NO1 = $4E; { 8 data bits, no parity, 1 stop bit }
- B8NO2 = $EE; { 8 data bits, no parity, 2 stop bits }
- BD110 = $32; { 110 baud }
- BD300 = $35; { 300 baud }
- BD600 = $36; { 600 baud }
- BD1200 = $37; { 1200 baud }
- BD2400 = $3A; { 2400 baud }
-
- { ControlPort commands }
-
- MDMON = $27; { Turn on DTR & RTS }
- RESERR = $30; { Reset error condition }
- MDMOFF = $00; { Turn off everything }
-
- { StatusPort status masks }
-
- TBMT = $01; { transmit buffer empty }
- DAV = $02; { data available }
- PE = $08; { parity error }
- OE = $10; { overrun error }
- FE = $20; { framing error }
- ERR = $38; { PE + OE + FE }
- DCD = $80; { data carrier detect (using DSR line) }
-
- {----------------------------------------------------------------}
-
- procedure ch_init;
- { Initialize the remote channel }
- begin
- end;
-
- procedure ch_on;
- { Turn on remote channel (usually by enabling DTR) }
- begin
- port[UserPort] := Chip;
- port[CtrlPort] := MDMON
- end;
-
- procedure ch_off;
- { Turn on remote channel (usually by disabling DTR) }
- begin
- port[UserPort] := Chip;
- port[CtrlPort] := MDMOFF
- end;
-
- function ch_carck: boolean;
- { Check to see if carrier is present }
- begin
- port[UserPort] := Chip;
- ch_carck := (DCD and port[StatusPort]) <> 0
- end;
-
- function ch_inprdy: boolean;
- { Check for ready to input from port }
- var
- bt: byte;
- begin
- port[UserPort] := Chip;
- ch_inprdy := (DAV and port[StatusPort]) <> 0
- end;
-
- function ch_inp: byte;
- { Input a byte from port - no wait - assumed ready }
- begin
- port[UserPort] := Chip;
- ch_inp := port[DataPort]
- end;
-
- procedure ch_out(bt: byte);
- { Output a byte to port - wait until ready }
- var ok : boolean;
- xx : byte;
- begin
- repeat
- port[UserPort] := Chip;
- until (port[StatusPort] and TBMT) <>0;
- port[DataPort] := bt
- end;
-
- procedure ch_set(rate: integer);
- { Set the bps rate }
- var
- dummy : byte;
- begin
- port[UserPort] := Chip;
- dummy := port[CtrlPort];
- if rate = 110
- then port[ModePort] := B8NO2
- else port[ModePort] := B8NO1;
- case rate of
- 110: port[ModePort] := BD110;
- 300: port[ModePort] := BD300;
- 600: port[ModePort] := BD600;
- 1200: port[ModePort] := BD1200;
- 2400: port[ModePort] := BD2400
- end
- end;