home *** CD-ROM | disk | FTP | other *** search
- \ Author: Jack W Brown
- \ Date: June 2, 1988
- \ Subject: 16 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.
-
-
- \ 16 X n Shape tables.
-
- HEX 8000 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 -- )
- 16 0 DO DUP MASK AND
- IF 177 DUP EMIT EMIT
- ELSE BL DUP EMIT EMIT
- THEN 2*
- LOOP DROP ;
-
- \ Like COUNT except it fetches a word and increments the
- \ address by 2.
- : WCOUNT ( adr adr+2 n )
- DUP 2+ SWAP @ ;
-
-
- \ This is the runtime routine for the new SHAPE16 object.
- : DRAW-SHAPE ( adr -- )
- WCOUNT 0 ?DO WCOUNT
- CR 1ROW
- LOOP DROP ;
-
- \ This is the compile time routine for the new SHAPE16 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 , 0 DO DEPTH 1- ROLL , LOOP ;
-
- : SHAPE16 ( n1 n2 ... nk -- )
- CREATE COMPILE-SHAPE
- DOES> DRAW-SHAPE ;
-
- HEX
- CCCC CCCC 3333 3333 CCCC CCCC 3333 3333
- CCCC CCCC 3333 3333 CCCC CCCC 3333 3333 SHAPE16 CHECK
- DECIMAL
-
- 1 3 7 15 31 63 127 SHAPE16 STAIRS
-
- 2 BASE !
-
- 1111111111111111
- 0000000000000000
- 0001100011000011
- 0011110001100110
- 0110011000111100
- 1100001100011000
- 0110011000111100
- 0011110001100110
- 0001100011000011
- 0000000000000000
- 1111111111111111
-
- SHAPE16 DIAMONDX
-
- DECIMAL
-
-