DIRECTORY Commander, IO, Real, RealFns, Rope, U255; U255TableImpl: PROGRAM IMPORTS Commander, IO, Real, RealFns, U255 = { OPEN U255; Main: Commander.CommandProc = TRUSTED { ENABLE ABORTED => GOTO Quit; out: IO.STREAM; wt: REF WTab; name: Rope.ROPE; res: BOOL; l: NAT; out _ cmd.out; out.PutF["\nu255Tables running at %t\n", IO.time[]]; name _ "SilenceTable1.table"; out.PutF["Writing %g ... ", IO.rope[name]]; wt _ MakeSilenceTable[]; res _ WriteBitsFile[name: name, data: wt]; out.PutF[IF res THEN "OK.\n" ELSE "Failed!\n"]; FOR i: NAT IN [0..10] DO l _ i*5; name _ IO.PutFR["LossTable%02d.table", IO.int[l]]; out.PutF["Writing %g ... ", IO.rope[name]]; wt _ MakeReturnLossTable[dBToLoss[l]]; res _ WriteBitsFile[name: name, data: wt]; out.PutF[IF res THEN "OK.\n" ELSE "Failed!\n"]; ENDLOOP; FOR i: NAT IN [0..10] DO l _ i*5; name _ IO.PutFR["HybridTable%02d.table", IO.int[l]]; out.PutF["Writing %g ... ", IO.rope[name]]; wt _ MakeHybridTable[dBToLoss[l]]; res _ WriteBitsFile[name: name, data: wt]; out.PutF[IF res THEN "OK.\n" ELSE "Failed!\n"]; ENDLOOP; name _ "HybridTable09.table"; out.PutF["Writing %g ... ", IO.rope[name]]; wt _ MakeHybridTable[0.0]; res _ WriteBitsFile[name: name, data: wt]; out.PutF[IF res THEN "OK.\n" ELSE "Failed!\n"]; name _ "LinearTable0.bcpl"; out.PutF["Writing %g ... ", IO.rope[name]]; wt _ MakeLinearTable[]; res _ WriteTableFile[name: name, data: wt]; out.PutF[IF res THEN "OK.\n" ELSE "Failed!\n"]; out.PutF["\nu255Tables finished at %t\n", IO.time[]]; out.Flush[]; EXITS Quit => NULL; }; MakeLinearTable: PROC RETURNS [t: REF WTab] = { t _ NEW[WTab[256]]; FOR i: CARDINAL IN [0..256) DO t[i] _ U255.Decode[LOOPHOLE[i]]; ENDLOOP; }; MakeHybridTable: PROC [loss: REAL] RETURNS [t: REF WTab] = { x: REAL; j: INTEGER; t _ NEW[WTab[256]]; FOR i: CARDINAL IN [0..256) DO j _ U255.Decode[LOOPHOLE[i, INTEGER]]; x _ j; x _ x*loss; j _ Real.RoundI[x]; t[i] _ IntToRJInt[j]; ENDLOOP; }; MakeSilenceTable: PROC RETURNS [t: REF WTab] = { iv: INTEGER; -- the un-offset version of the address t _ NEW[WTab[4096]]; FOR i: CARDINAL IN [0..4096) DO iv _ OffToInt[i]; t[i] _ And[U255.Encode[iv], 0177B]; ENDLOOP; }; MakeReturnLossTable: PROC [loss: REAL] RETURNS [t: REF WTab] = { iv: INTEGER; -- the un-offset version of the address t _ NEW[WTab[4096]]; FOR i: CARDINAL IN [0..4096) DO iv _ OffToInt[i]; t[i] _ U255.Encode[Real.RoundI[iv*loss]]; ENDLOOP; }; dBToLoss: PROC [dBloss: REAL] RETURNS [loss:REAL] = { RETURN [RealFns.Power[base: 10.0, exponent: -dBloss/20.0]]; }; Init: PROC = {Commander.Register[key: "u255Tables.~", proc: Main, doc: "Program to write tables for Lark Slave CPU"]; }; Init[]; }. June 12, 1983 3:25 pm, L. Stewart, Cedar 4.2 December 22, 1983 3:06 pm, L. Stewart, Cedar 5  U255TableImpl.mesa Last modified: Stewart, December 22, 1983 3:06 pm Constructs a 256 x 16 bit table Address = u-255 value Value = left justified 16 bit two's complement Constructs a 256 x 16 bit table Address = u-255 value Value = right justified 12 bit offset two's complement attenuated according to loss. (value is multiplied by loss, loss < 1) (Values are IN [0..4095]) Constructs a 4096 x 16 table Address = right justified 12 bit offset two's complement Value = silence value to be added to silence register Constructs a 4096 x 16 table Address = right justified 12 bit offset two's complement Value = right justified u-255, attenuated by loss Main program Ê]˜Jšœ™Jšœ™Jšœ#™#J˜šÏk ˜ J˜ Jšœ˜J˜J˜J˜J˜J˜—Jšœœœ œ˜EJšœ˜ J˜šœœ˜'Jšœœœ˜J˜Jšœœ˜Jšœœ˜ Jšœ œ˜Jšœœ˜ Jšœœ˜J˜J˜J˜Jšœ)œ ˜4J˜J˜Jšœœ ˜+J˜J˜*Jšœ œœ œ˜/J˜šœœœ ˜J˜Jšœœœ ˜2Jšœœ ˜+J˜&J˜*Jšœ œœ œ˜/Jšœ˜J˜—šœœœ ˜J˜Jšœœ œ ˜4Jšœœ ˜+J˜"J˜*Jšœ œœ œ˜/Jšœ˜J˜—J˜Jšœœ ˜+J˜J˜*Jšœ œœ œ˜/J˜J˜Jšœœ ˜+J˜J˜+Jšœ œœ œ˜/J˜Jšœ*œ ˜5J˜ Jš˜Jšœœ˜ J˜J˜—Jšœ™Jšœ™Jšœ.™.šÏnœœœœ ˜/Jšœœ ˜šœœœ ˜Jšœœ˜ Jšœ˜—J˜J˜—Jšœ™Jšœ™JšœA™AJšœ;™;Jšœ™š žœœœœœ ˜