home *** CD-ROM | disk | FTP | other *** search
- { ROS.MCH - Remote Operating System Machine Dependent Routines }
-
- { File: SBC-I.MCH
- Description: This driver set is designed to support the Teletek SBC-I.
- Date: 8/27/85
- Author: Steve Davis - Sysop Dragon RCP/M (505)344-3171
-
- Description: Comment update and code cleanup.
- Date: 9/7/85
- Author: Steve Fox
- }
-
- {** 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
- end;
-
- procedure putstat(st: StrStd);
- { Display 'st' on status line }
- const
- status_line = 1; { Line used for system status }
- last_line = 25; { Last line on screen }
- begin
- GotoXY(1, status_line);
- ClrEol;
- LowVideo;
- write(st);
- HighVideo;
- GotoXY(1, last_line)
- end;
-
- {** Remote channel routines **}
-
- const
- { Machine specific constants }
-
- DataPort = $00; { Data port }
- StatusPort = $01; { Status port }
- RatePort = $08; { Data rate (bps) port }
-
- RESCHN = $18; { reset channel }
- RESSTA = $14; { reset ext/status }
- WRREG1 = $00; { value to write to register 1 }
- WRREG3 = $C1; { 8 bits/char, rx enable }
- WRREG4 = $44; { 16x, 1 stop bit, no parity }
- DTROFF = $68; { dtr off, rts off }
- DTRON = $EA; { dtr on, 8 bits/char, tx enable, rts on }
- RESERR = $30; { error reset }
-
- { StatusPort status masks }
-
- DAV = $01; { data available }
- TRDY = $04; { transmit buffer empty }
- DCD = $20; { data carrier detect }
- PE = $10; { parity error }
- OE = $20; { overrun error }
- FE = $40; { framing error }
- ERR = $60; { parity, overrun and framing error }
-
- { Rate setting commands }
- BDSET300 = 7;
- BD300 = 52; { 300 bps }
- BDSET1200 = 71;
- BD1200 = 64; { 1200 bps }
-
- procedure ch_init;
- { Initialize the remote channel }
- Const
- sio_init: array[1..9] of byte = (RESCHN, 4, WRREG4, 1, WRREG1, 3, WRREG3, 5, DTROFF);
- var
- i: integer;
- begin
- for i := 1 to 9 do
- port[StatusPort] := sio_init[i]; { initialize the SIO channel }
- end;
-
- procedure ch_on;
- { Turn on remote channel (usually by enabling DTR) }
- begin
- port[StatusPort] := 5;
- port[StatusPort] := DTRON
- end;
-
- procedure ch_off;
- { Turn on remote channel (usually by disabling DTR) }
- begin
- port[StatusPort] := 5;
- port[StatusPort] := DTROFF
- end;
-
- function ch_carck: boolean;
- { Check to see if carrier is present }
- begin
- port[StatusPort] := 0;
- port[StatusPort] := RESSTA;
- ch_carck := ((DCD and port[StatusPort]) <> 0)
- end;
-
- function ch_inprdy: boolean;
- { Check for ready to input from port }
- var
- bt: byte;
- begin
- if (DAV and port[StatusPort]) <> 0
- then
- begin
- port[StatusPort] := 1;
- if (ERR and port[StatusPort]) <> 0
- then
- begin
- port[StatusPort] := RESERR;
- bt := port[DataPort];
- ch_inprdy := FALSE
- end
- else ch_inprdy := TRUE
- end
- else ch_inprdy := FALSE
- end;
-
- function ch_inp: byte;
- { Input a byte from port - no wait - assumed ready }
- begin
- ch_inp := port[DataPort]
- end;
-
- procedure ch_out(bt: byte);
- { Output a byte to port - wait until ready }
- begin
- repeat
- until ((TRDY and port[StatusPort]) <> 0);
- port[DataPort] := bt
- end;
-
- procedure ch_set(r: integer);
- { Set the bps rate }
- begin
- rate := r;
- case rate of
- 300: begin
- port[RatePort] := BDSET300;
- port[RatePort] := BD300
- end;
- 1200: begin
- port[RatePort] := BDSET1200;
- port[RatePort] := BD1200
- end
- end
- end;
-