home *** CD-ROM | disk | FTP | other *** search
- { ROS.MCH - Remote Operating System Machine Dependent Routines }
-
- { File: ROSAMPRO.MCH
- Description: This driver set is designed to support the Ampro "Little Board".
- Date: 7-Jan-86
- Author: Charles Blanchard
-
- Modified from BB2.MCH for the Ferguson BigBoard II
- written by Steve Fox 03-Aug-85.
-
- Hardware supported :
- AMPRO "Little Board"
- DART I/O and CTC timer 2.000 MHz
- This version is for the AMPRO "Little Board" using channel "B" of the
- Z80 DART. The Z80-CTC is used as the baud rate generator.
-
- The AMPRO computer does not implement DTR or DCD
- (CTS and RTS are used instead - however they take
- the CTS to the AMPRO pin 20!)
-
- Make up a RS232 cable per the instructions below:
-
- Modem Ampro
- ----- -----
- pin 2 - pin 3
- pin 3 - pin 2
- pin 7 - pin 7
- pin 8 - pin 20
- pin 20 - pin 5
-
- Note: These pin assignments assume that your Little Board RS232 female
- connector is wired the same as the Ampro assembled computers.
-
- }
-
- {** 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 = 24; { Last line on screen }
- begin
- GotoXY(1, status_line);
- ClrEol;
- LowVideo;
- write(st);
- HighVideo;
- GotoXY(1, last_line)
- end;
-
- {** Remote channel routines **}
-
- const
-
- { Port locations for a modem connected to the channel "B" of }
- { the Z80 DART }
-
- DataPort = $88; { Data port }
- StatusPort = $8C; { Status port }
-
- CTCrate = $50; { CTC rate }
-
- { StatusPort commands }
-
- RESSTA = $10; { Reset ext/status }
- RESCHN = $18; { Reset channel }
- RESERR = $30; { Reset error }
- WRREG1 = $00; { Value to write to register 1 }
- WRREG3 = $C1; { 8 bits/char, RX enable }
- WRREG4 = $84; { 32x, 1 stop bit, no parity }
- DTROFF = $68; { DTR off, RTS off }
- DTRON = $EA; { DTR on, 8 bits/char, TX enable, RTS on }
-
- { StatusPort 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 = $70; { Parity, overrun and framing error }
-
- { Rate setting commands }
-
- MODEW = $47;
- BD300 = $D0; { 300 bps }
- BD1200 = $34; { 1200 bps }
- BD2400 = $1A; { 2400 bps }
-
- procedure ch_init;
- { Initialize the remote channel }
- const
- sio_init: array[1..8] of byte =
- (0, RESCHN, 4, WRREG4, 1, WRREG1, 3, WRREG3);
- var
- i: integer;
- begin
- for i := 1 to 8 do
- port[StatusPort] := sio_init[i]
- 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 }
- var speed : integer;
- begin
- rate := r;
- case rate of
- 300: speed := BD300;
- 1200: speed := BD1200;
- 2400: speed := BD2400
- end;
- port[CTCrate] := MODEW;
- port[CTCrate] := speed;
- end;
-