home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
BEEHIVE
/
BBS
/
AMSTRAD.ARC
/
PCW8512.MCH
next >
Wrap
Text File
|
1987-10-31
|
5KB
|
157 lines
{ ROSMCH.INC - Remote Operating System Machine Dependent Routines }
{** System routines ** PCW8512 has a bigger screen (90x31) }
{ Routines for 2400 bps are for later use... }
procedure system_init;
{ Initialization to be done once when ROS first starts }
begin { system_init }
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 = 31; { Last line on screen }
var i : integer;
begin
Write(#27#101);
GotoXY(1, status_line);
ClrEol;
LowVideo;
write(st);
for i := 1 to (90-length(st)) do write(' ');
HighVideo;
GotoXY(1, last_line)
end;
{** Remote channel routines **}
const
{ Port locations / AMSTRAD PCW 8512 has different RX/TX-Rate }
DataPort = $E0; { Data port }
StatusPort = $E1; { Status port }
(* RatePort_T = $E5; Data rate (bps) port
RatePort_R = $E4;
RatePort = $E7; not nessecary because of the XBIOS... *)
{ 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 = $44; { 16x, 1 stop bit, no parity }
DTROFF = $00; { 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 = $08; { 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 }
BDSET = $47; { First Byte of CTC Command }
BD300 = 128; { 300 bps }
BD1200 = 32; { 1200 bps }
(* BD2400 = 16; { 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 / see DMV's "JOYCE Sonderheft"-magazin 1/87 S. 79f. }
begin
rate := r;
{ port[RatePort_T] := BDSET; }
case rate of
300: inline ($21/$06/$06/$cd/$5a/$fc/$b9/$00);
1200: inline ($21/$08/$08/$cd/$5a/$fc/$b9/$00);
(* 2400: inline ($21/$0a/$0a/$cd/$5a/$fc/$b9/$00) *)
end
end;
: inline ($21/$08/$08/