DataMuseum.dk

Presents historical artifacts from the history of:

RC3500

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about RC3500

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦af3489829⟧ TextFileVerbose

    Length: 2304 (0x900)
    Types: TextFileVerbose
    Names: »tcom202in«

Derivation

└─⟦2c55ea56f⟧ Bits:30001844 SW-save af projekt 1000, Alarm-system
    └─⟦6b41451d2⟧ 
        └─⟦this⟧ »tcom202in« 

TextFileVerbose

process com202input(var sem : array(0..7) of semaphore; level : integer);

(*
interrupt , passive , passive
interrupt , passive , active            - block > 1 char
interrupt , passive , active , passive  - block = 1 char
interrupt , active  , passive
interrupt , active
*)

const

max = 100;

type

port_type = record
r : reference;
next : integer;
top : integer
end;

buffertype = record
next,first,last : integer;
data : array(1..max) of byte
end;

input_type = packed record
data_char : byte;
status : 0..31;
port : 0..7
end;

output_type = input_type;

control_type = packed record
data : byte;
unused : 0..3;
command : 0..7;
port : 0..7
end;

const

start_scanner = control_type(0,0,5,0);

procedure controlclr(control_word : control_type; var chmsg : reference);
external;

procedure inword(var input : input_type; var chmsg : reference);
external;

procedure outword(output : output_type; var chmsg : reference);
external;


var

chmsg      : reference;
input      : input_type;
i          : integer;

port_table : array(0..7) of port_type;

begin
if reservech(chmsg,level,-1) = 0 then
begin
(* inititalize ports *)
for i := 0 to 7 do
with port_table(i) do
begin
top := 0;
next := top + 1
end;

channel chmsg do
repeat
controlclr(start_scanner,chmsg);
inword(input,chmsg);

with port_table(input.port) do
if next > top then
begin
if open(sem(input.port)) then
begin
wait(r,sem(input.port));
lock r as buffer : buffertype do
begin (* unpack params *)
next := buffer.first;
top := buffer.last + 1;
buffer.next := top;
buffer.data(next) := input.data_char
end;

next := next + 1;

if next = top then
begin
next := top + 1;
return(r)
end
end
end
else
begin
lock r as buffer : buffertype do
buffer.data(next) := input.data_char;
next := next + 1;

if next = top then
begin
next := top + 1;
return(r)
end
end
until false
end
end
.

«eof»