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

⟦d70646f49⟧ TextFileVerbose

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

Derivation

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

TextFileVerbose

process com202out(var outsem : semaphore; level : integer);

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;
r_work      : reference;
i           : integer;

output      : output_type;
input       : input_type;

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

activecount : integer := 0;

begin
if reservech(chmsg,level,-1) = 0 then
begin

for i := 0 to 7 do
with port_table(i) do
begin
top := 0;
next := top + 1 (* next > top *)
end;

channel chmsg do
begin
wait(r_work,outsem);
repeat
if nil(r_work) then
begin

controlclr(start_scanner,chmsg);
inword(input,chmsg);
output.port := input.port;

with port_table(output.port) do
begin
if next < top then
begin
lock r as buffer : buffertype do
output.data_char := buffer.data(next);
outword(output,chmsg);
next := next + 1;
sensesem(r_work,outsem)
end
else
if next = top then
begin
return(r);
activecount := activecount - 1;
if activecount = 0 then
wait(r_work,outsem)
else
sensesem(r_work,outsem)
end
else
sensesem(r_work,outsem)
end
end
else
begin
activecount := activecount + 1;
output.port := r_work^.u3;
with port_table(output.port) do
begin
lock r_work as buffer : buffertype do
begin
next := buffer.first;
top := buffer.last + 1;
buffer.next := top; (* prepare return *)
output.data_char := buffer.data(next)
end;
outword(output,chmsg);
next := next + 1;
r_work :=: r
end;

sensesem(r_work,outsem)
end
until false
end
end
end
.
.

«eof»