begin "erx"
require "prom.sai" source!file;
$256;
define
carrier =[a0],
data =[a1],
shift =[a2],
word =[a3],
adrs =[a4],
enable =[a5],
state0 =[a6],
state1 =[a7],
init =[(enable)],
state =[((state1 + state0) div d6)],
idle =[(state=0)],
first—word =[(state=1)],
other—words =[(state=2)],
flush =[(state=3)],
event =[((shift + data) div d1)],
nil =[(event=0)],
collision =[(event=1)],
d—zero =[(event=2)],
d—one =[(event=3)],
datatr =[(carrier (d—zero d—one nil))],
visible =[(other—words ((carrier word) (carrier collision)))],
invisible =[(first—word ((carrier) (carrier collision)
(datatr word adrs)))],
end—idle =[(idle carrier word)],
lostsync =[(idle carrier collision)],
write =[(init ((first—word datatr word adrs)
(other—words datatr word)))],
endbit =[(init (visible (other—words carrier word)))],
abort =[(visible)],
clear =[(init idle carrier)],
crcclr =[(init flush carrier)],
fce =[(init first—word carrier (d—zero d—one))],
nextstate =[(if init then 3 else
if ( ! idle;
(idle carrier)
(idle carrier (collision end—idle))
(flush carrier)
) then 0 else
if ( ! first—word;
(first—word datatr word)
(end—idle)
) then 1 else
if ( ! other—words;
(first—word datatr word adrs)
(other—words datatr)
) then 2 else
if ( ! flush;
(flush carrier)
(lostsync)
(visible)
(invisible)
(other—words carrier word)
) then 3 else
error(cvs($$adrs)&": didn't assign any state!")
)];
prombegin
prom(0,d0, write);
prom(0,d1, endbit);
prom(0,d2, abort);
prom(0,d3, clear);
prom(0,d4, crcclr);
prom(0,d5, fce);
prom(0,d6, nextstate land d0);
prom(0,d7, nextstate land d1);
promend;
writeprom("erx",0);
end;