(.jamrem) (The rem fcn. => ) (.dup 3 2 .roll .dup 4 1 .roll .exch .div .mul .sub).cvx /xdef (brickNotThere) ((Define a brick! ) .print .stop).cvx .def (.getrow) (X,Y => ) (.dup .getp .rem).cvx /xdef (.getcol) ( => ) (.getp .idiv .getd .mul .sub .getl .mod).cvx /xdef (.gettransbu) (Gets brick unit even if rotated. =>) (.getrow 3 1 .roll .getcol .getbu).cvx /xdef (.geta!b!c!d!) (Gets args for .writehalftone. =>a! b! c! d! -- vars not on stack) ((d!) .exch .store (c!) .exch .store (b!) .exch .store (a!) .exch .store).cvx /xdef (.writehalftone) (Uses variables a! b!.. loaded by .geta!b!c!d! to tile the alto screen. To use do: a b c d .writehalftone a, b = from, to in x; c, d = from to in y) (.geta!b!c!d! a! 1 b! (.dup c! 1 d! (.putdotelement .dup) .cvx .for .pop .pop).cvx .for).cvx /xdef (.putdotelement) (=>NIL. Gets the rotated dot element from the brick matrix and thresholds it with variable threshold) (2 .copy .gettransbu threshold .gt (dot) /if .pop .pop).cvx /xdef (comment!) (the above routine assumes on stack. it copies them in case they're needed by dot if so, dot puts the dot to the screen and replaces them, after which they're discarded else they're discarded. They must be copied because .gettransbu eats them) .def (threshold) (0.500).cvr .store (.dorow) (1 1 .getl (1 .sub row# .exch .getbu).cvx .for).cvx .def (row#) (0).cvi .store (.domatrix)(prints out the values of the brick. to call do: .domatrix)(1 1 .getp (1 .sub (row#) .exch .store (row#: ) .print row# .cvs .print ( ) .print .dorow /stk /clr).cvx .for).cvx /xdef (.zip) ((ipbrickimpl.bcd) .loadbcd /clr e) .cvx .def (.getall) (.getp = .getl = .getd .domatrix) .cvx .def (.brick) (.freebrick .buildbrick .getall) .cvx .def (.bt1) (0 10 90 (.dup 10 .exch .buildbrick 100 140 3 -1 .roll 5 .mul .dup 40 .add .writehalftone .freebrick) .cvx .for) .cvx .def (.bt2) (100 10 180 (.dup 10 .exch .buildbrick 200 240 3 -1 .roll 100 .sub 5 .mul .dup 40 .add .writehalftone .freebrick) .cvx .for) .cvx .def (.bt3) (180 10 270 (.dup 10 .exch .buildbrick 300 340 3 -1 .roll 180 .sub 5 .mul .dup 40 .add .writehalftone .freebrick) .cvx .for) .cvx .def (.bt4) (270 10 360 (.dup 10 .exch .buildbrick 400 440 3 -1 .roll 270 .sub 5 .mul .dup 40 .add .writehalftone .freebrick) .cvx .for) .cvx .def (.quad0) (/clr 0 10 90 (.dup .dup 100 150 3 -1 .roll 0 .sub 5 .mul .dup 50 .add 10 6 -1 .roll 0.5 .showbrick ) .cvx .for ) .cvx .def (.quad1) (/clr 90 10 180 (.dup .dup 200 250 3 -1 .roll 90 .sub 5 .mul .dup 50 .add 10 6 -1 .roll 0.5 .showbrick ) .cvx .for ) .cvx .def (.quad2) (/clr 180 10 270 (.dup .dup 300 350 3 -1 .roll 180 .sub 5 .mul .dup 50 .add 10 6 -1 .roll 0.5 .showbrick ) .cvx .for ) .cvx .def (.quad3) (/clr 270 10 360 (.dup .dup 400 450 3 -1 .roll 270 .sub 5 .mul .dup 50 .add 10 6 -1 .roll 0.5 .showbrick ) .cvx .for ) .cvx .def