CDSilImpl.mesa
Copyright © 1983, 1985 by Xerox Corporation. All rights reserved.
by Ch. Jacobi August 11, 1983 3:56 pm
Last Edited by: Ch. Jacobi, March 19, 1986 5:10:29 pm PST
gbb August 5, 1986 12:04:13 pm PDT
DIRECTORY
CD USING [Design, Layer, NewLayer, Number, RegisterTechnology, Technology, backgroundLayer, errorLayer, shadeLayer],
CDColors USING [Brick, DefineColor, DefineIColor],
CDEnvironment USING [SetTipTable],
CDIO USING [MakeName],
CDOps USING [CreateDesign],
CDPanel USING [DefineIntEntry, DefineLayerEntry, DefineNewLine],
CDPanelFonts,
CDSil USING [],
CDValue USING [StoreInt],
CDViewer USING [CreateViewer],
ColorMaps USING [RegisterMenu],
Commander USING [CommandProc, Register],
FileNames USING [CurrentWorkingDirectory],
ImagerColor USING [ColorFromRGB],
IO USING [PutRope],
Rope USING [ROPE],
TerminalIO USING [WriteRope];
CDSilImpl: CEDAR PROGRAM
IMPORTS CD, CDColors, CDEnvironment, CDIO, CDOps, CDPanel, CDPanelFonts, CDValue, CDViewer, ColorMaps, Commander, FileNames, ImagerColor, IO, TerminalIO
EXPORTS CDSil =
BEGIN
lambda: CD.Number = 2;
cdsil: PUBLIC CD.Technology ~ CD.RegisterTechnology [$chipnsil, "chipnsil", lambda];
The colours are the same as on Alto Sil with the addition of blue.
xneutral: PUBLIC CD.Layer; -- 00
xred: PUBLIC CD.Layer;  -- 01
xyellow: PUBLIC CD.Layer; -- 02
xgreen: PUBLIC CD.Layer;  -- 03
xcyan: PUBLIC CD.Layer;  -- 04
xviolet: PUBLIC CD.Layer;  -- 05
xmagenta: PUBLIC CD.Layer; -- 06
xwhite: PUBLIC CD.Layer;  -- 07
xbrown: PUBLIC CD.Layer; -- 08
xorange: PUBLIC CD.Layer; -- 09
xlime: PUBLIC CD.Layer;  -- 10
xturquise: PUBLIC CD.Layer; -- 11
xaqua: PUBLIC CD.Layer;  -- 12
xultraviolet: PUBLIC CD.Layer; -- 13
xpink: PUBLIC CD.Layer;  -- 14
xsmoke: PUBLIC CD.Layer; -- 15
xblue: PUBLIC CD.Layer;  -- not a Sil color
tipTable: Rope.ROPENIL;
Load: Commander.CommandProc = BEGIN
cmd.out.PutRope ["ChipNSil loaded.\n"];
END;
NewSWorld: Commander.CommandProc = BEGIN
design: CD.Design ~ CDOps.CreateDesign [cdsil];
[] ← CDViewer.CreateViewer [design];
END;
Init: PROC [] = BEGIN
s1: CARDINAL = 1;
s2: CARDINAL = 16;
s3: CARDINAL = 16*16;
s4: CARDINAL = 16*16*16;
ss: CARDINAL = s1+s2+s3+s4;
Init8Patterns: PROC [] = BEGIN
red: CARDINAL = 1;
green: CARDINAL = 2;
blue: CARDINAL = 4;
cyan: CARDINAL = 8;
magenta: CARDINAL = 16;
yellow: CARDINAL = 32;
white: CARDINAL = 64;
fakeAqua: CARDINAL = green+cyan;  -- 10
fakeTurquoise: CARDINAL = blue + cyan; -- 12
fakeBrown: CARDINAL = green+magenta; -- 18
fakeViolet: CARDINAL = cyan+magenta; -- 24
fakeUltraviolet: CARDINAL = blue + cyan + magenta; -- 28
orange: CARDINAL = red+yellow; -- 33 this orange is better than the one used by Sil
fakeSmoke: CARDINAL = blue+yellow;  -- 36
fakeLime: CARDINAL = cyan+yellow;  -- 40
fakePink: CARDINAL = magenta + white; -- 80
fakeBlack: CARDINAL = white-1;
Pixels in a dither:
1 2
3 4
5 6
7 8
Each pixel has 8 bits, one for every element in the table cDefaults.
pixel1: CARDINAL = 1;
pixel3: CARDINAL = 256;
Mixture: PROC [col: CARDINAL] RETURNS [REF CDColors.Brick] ~ BEGIN
Full colour
RETURN [Dither1to1 [col, col]]
END;
Dither1to1: PROC [col1, col2: CARDINAL ← white] RETURNS [REF CDColors.Brick] ~ BEGIN
Dither 1 to 1
RETURN [NEW [CDColors.Brick ← [col1*pixel1+col2*pixel3, col2*pixel1+col1*pixel3, col1*pixel1+col2*pixel3, col2*pixel1+col1*pixel3]]]
END;
Lighten: PROC [l: CD.Layer, color: CARDINAL] = BEGIN
CDColors.DefineColor [l, Dither1to1[color], bit8, pushedOut]
END;
CDColors.DefineIColor [xneutral, ImagerColor.ColorFromRGB [rgb: [R: 0, G: 0, B: 0]], bit8];
CDColors.DefineIColor [xred, ImagerColor.ColorFromRGB [rgb: [R: 1, G: 0, B: 0]], bit8];
CDColors.DefineIColor [xyellow, ImagerColor.ColorFromRGB [rgb: [R: 1, G: 1, B: 0]], bit8];
CDColors.DefineIColor [xgreen, ImagerColor.ColorFromRGB [rgb: [R: 0, G: 1, B: 0]], bit8];
CDColors.DefineIColor [xcyan, ImagerColor.ColorFromRGB [rgb: [R: 0, G: 1, B: 1]], bit8];
CDColors.DefineIColor [xviolet, ImagerColor.ColorFromRGB [rgb: [R: 0.45, G: 0.25, B: 0.75]], bit8];
CDColors.DefineIColor [xmagenta, ImagerColor.ColorFromRGB [rgb: [R: 1, G: 0, B: 1]], bit8];
CDColors.DefineIColor [xwhite, ImagerColor.ColorFromRGB [rgb: [R: 1, G: 1, B: 1]], bit8];
CDColors.DefineIColor [xbrown, ImagerColor.ColorFromRGB [rgb: [R: 0.64, G: 0.2752, B: 0.16]], bit8];
CDColors.DefineIColor [xorange, ImagerColor.ColorFromRGB [rgb: [R: 0.64, G: 0.2752, B: 0.16]], bit8];
CDColors.DefineIColor [xlime, ImagerColor.ColorFromRGB [rgb: [R: 0.39, G: 0.75, B: 0.75]], bit8];
CDColors.DefineIColor [xturquise, ImagerColor.ColorFromRGB [rgb: [R: 0.42, G: 0.7, B: 0.92]], bit8];
CDColors.DefineIColor [xaqua, ImagerColor.ColorFromRGB [rgb: [R: 0.42, G: 0.92, B: 0.55]], bit8];
CDColors.DefineIColor [xultraviolet, ImagerColor.ColorFromRGB [rgb: [R: 0.13, G: 0, B: 0.33]], bit8];
CDColors.DefineIColor [xpink, ImagerColor.ColorFromRGB [rgb: [R: 0.9, G: 0.45, B: 0.55]], bit8];
CDColors.DefineIColor [xsmoke, ImagerColor.ColorFromRGB [rgb: [R: 0.5, G: 0.5, B: 0.5]], bit8];
CDColors.DefineIColor [xblue, ImagerColor.ColorFromRGB [rgb: [R: 0, G: 0, B: 1]], bit8];
CDColors.DefineColor [xneutral, Mixture[fakeBlack], bit8];
CDColors.DefineColor [xred, Mixture[red], bit8];
CDColors.DefineColor [xyellow, Mixture[yellow], bit8];
CDColors.DefineColor [xgreen, Mixture[green], bit8];
CDColors.DefineColor [xcyan, Mixture[cyan], bit8];
CDColors.DefineColor [xviolet, Mixture[fakeViolet], bit8];
CDColors.DefineColor [xmagenta, Mixture[magenta], bit8];
CDColors.DefineColor [xwhite, Mixture[white], bit8];
CDColors.DefineColor [xbrown, Mixture[fakeBrown], bit8];
CDColors.DefineColor [xorange, Mixture[orange], bit8];
CDColors.DefineColor [xlime, Mixture[fakeLime], bit8];
CDColors.DefineColor [xturquise, Mixture[fakeTurquoise], bit8];
CDColors.DefineColor [xaqua, Mixture[fakeAqua], bit8];
CDColors.DefineColor [xultraviolet, Mixture[fakeUltraviolet], bit8];
CDColors.DefineColor [xpink, Mixture[fakePink], bit8];
CDColors.DefineColor [xsmoke, Mixture[fakeSmoke], bit8];
CDColors.DefineColor [xblue, Mixture[blue], bit8];
CDColors.DefineColor [CD.backgroundLayer, NEW[CDColors.Brick ← [8, 0, 256*8, 0]], bit8];
CDColors.DefineColor [CD.errorLayer, NEW[CDColors.Brick ← [255, 0, 0, 0]], bit8];
CDColors.DefineColor [CD.shadeLayer, NEW[CDColors.Brick←[0, 255,0 , 255]], bit8];
Lighten [xneutral, fakeBlack];
Lighten [xred, red];
Lighten [xyellow, yellow];
Lighten [xgreen, green];
Lighten [xcyan, cyan];
Lighten [xviolet, fakeViolet];
Lighten [xmagenta, magenta];
Lighten [xwhite, white];
Lighten [xbrown, fakeBrown];
Lighten [xorange, orange];
Lighten [xlime, fakeLime];
Lighten [xturquise, fakeTurquoise];
Lighten [xaqua, fakeAqua];
Lighten [xultraviolet, fakeUltraviolet];
Lighten [xpink, fakePink];
Lighten [xsmoke, fakeBlack];
Lighten [xblue, blue]
END;
4 bit colors
blue: CARDINAL = 1;
green: CARDINAL = 2;
red: CARDINAL = 4;
yellow: CARDINAL = 14;
black: CARDINAL = 0FFFFH;
xneutral ← CD.NewLayer[cdsil, $xneutral]; -- 00
xred ← CD.NewLayer[cdsil, $xred];  -- 01
xyellow ← CD.NewLayer[cdsil, $xyellow]; -- 02
xgreen ← CD.NewLayer[cdsil, $xgreen]; -- 03
xcyan ← CD.NewLayer[cdsil, $xcyan];  -- 04
xviolet ← CD.NewLayer[cdsil, $xviolet]; -- 05
xmagenta ← CD.NewLayer[cdsil, $xmagenta]; -- 06
xwhite ← CD.NewLayer[cdsil, $xwhite]; -- 07
xbrown ← CD.NewLayer[cdsil, $xbrown]; -- 08
xorange ← CD.NewLayer[cdsil, $xorange]; -- 09
xlime ← CD.NewLayer[cdsil, $xlime];  -- 10
xturquise ← CD.NewLayer[cdsil, $xturquise]; -- 11
xaqua ← CD.NewLayer[cdsil, $xaqua];  -- 12
xultraviolet ← CD.NewLayer[cdsil, $xultraviolet]; -- 13
xpink ← CD.NewLayer[cdsil, $xpink];  -- 14
xsmoke ← CD.NewLayer[cdsil, $xsmoke]; -- 15
xblue ← CD.NewLayer[cdsil, $xblue];  -- not a Sil color
CDEnvironment.SetTipTable[cdsil, "Standard"];
the 1 bit pattern are fair but not great
the 4 bit pattern are nice with cmos-chipmonk
the 8 bit pattern don't fit anywhere
CDColors.DefineColor[xneutral,
NEW[CDColors.Brick←[8*s1, 0, 0, 0]], bit4];
CDColors.DefineColor[xneutral,
NEW[CDColors.Brick←[05H*1111H, 0AH*1111H, 05H*1111H, 0AH*1111H]], bw]; -- 00
CDColors.DefineColor[xneutral,
NEW[CDColors.Brick←[black, black, black, black]], bw]; -- 00
CDColors.DefineColor[xred,
NEW[CDColors.Brick←[7*ss, 11*ss, 7*ss, 11*ss]], bit4];
CDColors.DefineColor[xred,
NEW[CDColors.Brick←[8*ss, 4*ss, 2*ss, 1*ss]], bw]; -- 01
CDColors.DefineColor[xyellow,
NEW[CDColors.Brick←[yellow*ss, yellow*ss, yellow*ss, yellow*ss]], bit4];
CDColors.DefineColor[xyellow,
NEW[CDColors.Brick←[2*ss, 0, 2*ss, 0]], bw]; -- 02
CDColors.DefineColor[xgreen,
NEW[CDColors.Brick←[green*ss, green*ss, green*ss, green*ss]], bit4];
CDColors.DefineColor[xgreen,
NEW[CDColors.Brick←[4*ss, ss, 4*ss, ss]], bw]; -- 03
CDColors.DefineColor[xcyan,
NEW[CDColors.Brick←[2*(s1+s2+s3), 2*ss, 2*(s1+s2+s3)+15*s4, 2*ss]], bit4];
CDColors.DefineColor[xcyan,
NEW[CDColors.Brick←[0EH*1111H, 0DH*1111H, 0BH*1111H, 07H*1111H]], bw]; -- 04
CDColors.DefineColor[xviolet,
NEW[CDColors.Brick←[10*1111H, 10*1111H, 10*1111H, 10*1111H]], bit4];
CDColors.DefineColor[xviolet,
NEW[CDColors.Brick←[0EH*1111H, 0DH*1111H, 0BH*1111H, 07H*1111H]], bw]; -- 05
CDColors.DefineColor[xmagenta,
NEW[CDColors.Brick←[10*1111H, 10*1111H, 10*1111H, 10*1111H]], bit4];
CDColors.DefineColor[xmagenta,
NEW[CDColors.Brick←[8*ss, 8*ss, 2*ss, 2*ss]], bw]; -- 06
CDColors.DefineColor[xwhite,
NEW[CDColors.Brick←[11*ss, 11*ss, 11*ss, 11*ss]], bit4];
CDColors.DefineColor[xwhite,
NEW[CDColors.Brick←[4*ss, 0, 0, 0]], bw]; -- 07
CDColors.DefineColor[xbrown,
NEW[CDColors.Brick←[10*1111H, 10*1111H, 10*1111H, 10*1111H]], bit4];
CDColors.DefineColor[xbrown,
NEW[CDColors.Brick←[0EH*1111H, 0DH*1111H, 0BH*1111H, 07H*1111H]], bw]; -- 08
CDColors.DefineColor[xorange,
NEW[CDColors.Brick←[10*1111H, 10*1111H, 10*1111H, 10*1111H]], bit4];
CDColors.DefineColor[xorange,
NEW[CDColors.Brick←[0EH*1111H, 0DH*1111H, 0BH*1111H, 07H*1111H]], bw]; -- 09
CDColors.DefineColor[xlime,
NEW[CDColors.Brick←[10*1111H, 10*1111H, 10*1111H, 10*1111H]], bit4];
CDColors.DefineColor[xlime,
NEW[CDColors.Brick←[0EH*1111H, 0DH*1111H, 0BH*1111H, 07H*1111H]], bw]; -- 10
CDColors.DefineColor[xturquise,
NEW[CDColors.Brick←[10*1111H, 10*1111H, 10*1111H, 10*1111H]], bit4];
CDColors.DefineColor[xturquise,
NEW[CDColors.Brick←[0EH*1111H, 0DH*1111H, 0BH*1111H, 07H*1111H]], bw]; -- 11
CDColors.DefineColor[xaqua,
NEW[CDColors.Brick←[10*1111H, 10*1111H, 10*1111H, 10*1111H]], bit4];
CDColors.DefineColor[xaqua,
NEW[CDColors.Brick←[0EH*1111H, 0DH*1111H, 0BH*1111H, 07H*1111H]], bw]; -- 12
CDColors.DefineColor[xultraviolet,
NEW[CDColors.Brick←[10*1111H, 10*1111H, 10*1111H, 10*1111H]], bit4];
CDColors.DefineColor[xultraviolet,
NEW[CDColors.Brick←[0EH*1111H, 0DH*1111H, 0BH*1111H, 07H*1111H]], bw]; -- 13
CDColors.DefineColor[xpink,
NEW[CDColors.Brick←[10*1111H, 10*1111H, 10*1111H, 10*1111H]] , bit4];
CDColors.DefineColor[xpink,
NEW[CDColors.Brick←[8*ss, 2*ss, 0, 0]], bw]; -- 14
CDColors.DefineColor[xsmoke,
NEW[CDColors.Brick←[red*ss, red*ss, red*ss, red*ss]], bit4];
CDColors.DefineColor[xsmoke,
NEW[CDColors.Brick←[4*ss, 14*ss, 4*ss, 0*ss]], bw]; -- 15
CDColors.DefineColor[xblue,
NEW[CDColors.Brick←[blue*ss, blue*ss, blue*ss, blue*ss]], bit4];
CDColors.DefineColor[xblue,
NEW [CDColors.Brick←[7*ss, 11*ss, 7*ss, 11*ss]], bw]; -- not Sil
Init8Patterns[];
CDPanel.DefineLayerEntry [cdsil, xneutral, "black", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xwhite, "white", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xsmoke, "grey", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xred, "red", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xblue, "blue", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xgreen, "green", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xmagenta, "magenta", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xcyan, "cyan", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xyellow, "yellow", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xpink, "pink", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xorange, "orange", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xbrown, "brown", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xlime, "lime", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xaqua, "aqua", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xturquise, "turquise", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xviolet, "violet", 0, lambda];
CDPanel.DefineLayerEntry [cdsil, xultraviolet, "UV", 0, lambda];
CDPanel.DefineIntEntry [cdValueKey: $CDxSelectNewMode, tech: cdsil, text: "select new:", min: 0, max: 1, default: 1];
CDPanel.DefineNewLine [cdsil];
CDPanel.DefineIntEntry [cdValueKey: $CDxStepValue, tech: cdsil, text: "step moves size:", min: 1, default: 8];
CDPanel.DefineIntEntry [cdValueKey: $CDxStretchyMove, tech: cdsil, text: "stretchy:", min: 0, max: 1, default: 0];
CDPanel.DefineNewLine [cdsil];
CDValue.StoreInt [boundTo: cdsil, key: $CDxInitScale, value: 9];
CDValue.StoreInt [boundTo: cdsil, key: $CDxInitGrid, value: 8];
ColorMaps.RegisterMenu ["ChipNSil", CDIO.MakeName["ChipNSil", "ColorMap", FileNames.CurrentWorkingDirectory[]]];
CDPanelFonts.ImplementIt [cdsil];
Commander.Register [key: "///Commands/CDSil", proc: Load, doc: "Loads ChipNSil"];
Commander.Register [key: "///Commands/CDNewSil", proc: NewSWorld, doc: "Creates new chipndale 'sil' design"];
TerminalIO.WriteRope ["ChipNSil loaded [version of April 7, 1986].\n"];
END;
Init []
END.
gbb July 18, 1986 10:58:32 am PDT
Duplicated the "imager colors" from CDSil8BitColors.
changes to: DIRECTORY, Init8Patterns (local of Init)
gbb July 24, 1986 5:19:00 pm PDT
Eliminated registration of a tip table.
changes to: DIRECTORY, CDSilImpl, Init
gbb August 5, 1986 12:03:44 pm PDT
Implemented registration of a dummy tip table.
changes to: DIRECTORY, Init