home *** CD-ROM | disk | FTP | other *** search
- \ Author: Jack W Brown
- \ Date: June 2, 1988
- \ Subject: 8 x k shape tables using CREATE ... DOES>
-
- \ Extensions of the ideas presented here could be used to construct,
- \ diskplay, and edit character sets and shapes.
-
-
- HEX 0080 CONSTANT MASK DECIMAL
-
- \ Display one row of the shape table as specified by n .
- \ Bits are displayed starting with the highest bit so the
- \ table will not apear as the mirror image of the data.
- : 1ROW ( n -- )
- 8 0 DO DUP MASK AND
- IF 177 DUP EMIT EMIT \ two characters per cell
- ELSE BL DUP EMIT EMIT \ to give 1:1 aspect ratio.
- THEN 2*
- LOOP DROP ;
-
-
- \ This is the runtime routine for the new SHAPE8 object.
- : DRAW-SHAPE ( adr -- )
- COUNT 0 ?DO COUNT
- CR 1ROW
- LOOP DROP ;
-
- \ This is the compile time routine for the new SHAPE8 object.
- \ The reason for the DEPTH 1- ROLL is to reverse the order of
- \ the compiled data so the shape will not appear upside down.
- \ The use of DEPTH may not be the best thing here as it assumes that
- \ the stack is empty just before shape data is placed on the stack.
- : COMPILE-SHAPE ( n1 n2 ... nk -- )
- DEPTH DUP C, 0 DO DEPTH 1- ROLL C, LOOP ;
-
- : SHAPE8 ( n1 n2 ... nk -- )
- CREATE COMPILE-SHAPE
- DOES> DRAW-SHAPE ;
-
- \ Some sample shapes.
-
- HEX
- CC CC 33 33 CC CC 33 33 SHAPE8 CHECK
-
- DECIMAL
- 1 3 7 15 31 63 127 SHAPE8 STAIRS
-
- 2 BASE !
- 00000000
- 00011000
- 00111100
- 01100110
- 11000011
- 01100110
- 00111100
- 00011000
- 00000000
- SHAPE8 DIAMOND
-
- DECIMAL
-
-