1000 '   ==================================================================
1010 '
1020 '   PROGRAM:	FLASHGEN.BAS
1030 '   AUTHOR:	JAMES TUCKER - FLASHPRINT!! SOFTWARE
1040 '   RELEASE:	FOR FLASHPRINT!! RELEASE H FEBRUARY 1985
1050 '   LANGUAGE:	MICROSOFT BASIC-80 V5.XX
1060 '
1070 '   *** Please note that FLASHGEN is a public domain program but
1080 '   *** FLASHPRINT!! and FLASHKEY!! are trademarks of JAMES TUCKER
1090 '	 *** and FLASHLITE SOFTWARE, P.O. BOX 2179, 
1100 '	 ***      DALY CITY, CA 94017   (415) 994-8282
1110 '   ==================================================================
1120 '
1130 DEFINT X,Y		'   INTEGERS MAKE IT A BIT FASTER
1140 DIM R(64,8)	'   ARRAY FOR DOTSON/DOTSOFF (0=NO DOT 1=DOT)
1150			'   X(64) IS HORIZONTAL Y(8) IS VERTICAL
1160 PW=76		'   PAPER WIDTH (YOUR PRINTER WIDTH-4)
1170 CLS$=CHR$(26)	'   CLEAR SCREEN CHAR (CLS IN SOME BASICS)
1180 U$=CHR$(11)	'   CP/M UP CURSOR CHARACTER
1190 D$=CHR$(10)	'   CP/M DOWN CURSOR CHARACTER
1200 L$=CHR$(8)		'   CP/M LEFT CURSOR CHARACTER
1210 R$=CHR$(12)	'   CP/M RIGHT CURSOR CHARACTER
1220 ESC$=CHR$(27)	'   ASCII ESCAPE
1230 CR$=CHR$(13)	'   ASCII CARRIAGE RETURN
1240 '   ===================================================================
1250 '   PRINT A HEADER ON SCREEN.
1260 PRINT CLS$
1270 PRINT "   FLASHPRINT!! CHARACTER GENERATOR RELEASE H"
1280 PRINT "   DO YOU NEED INSTRUCTIONS (Y/N) ? ";
1290 A$=INKEY$:IF A$="" THEN 1290
1300 IF A$="Y" OR A$="y" THEN 2920 ELSE 1350
1310 '   ===================================================================
1320 '   JUMP IF A PRINTER HAS ALREADY BEEN SPECIFIED. IT IS UNLILKELY YOU 
1330 '   WILL SPECIFY A DIFFERENT PRINTER IN THE SAME SESSION. YOU COULD
1340 '   EQUATE P$ TO "E" OR "C" FOR YOUR PRINTER AND DELETE PREVIOUS CODE
1350 PRINT CLS$
1360 PRINT "   FLASHPRINT!! CHARACTER GENERATOR RELEASE H"
1370 IF P$="E" OR P$="C" THEN 1460
1380 '   
1390 PRINT "   YOUR PRINTER TYPE: PRESS E FOR EPSON OR C FOR CITOH: ";
1400 P$=INKEY$:IF P$="" THEN 1400
1410 IF P$="e" OR P$="E" THEN P$="E":PRINT "EPSON":GOTO 1460
1420 IF P$="c" OR P$="C" THEN P$="C":PRINT "CITOH":GOTO 1460
1430 GOTO 1400
1440 '   ===================================================================
1450 '   HERE WE GET WIDTH OF CHARACTER FROM USER
1460 INPUT "   WIDTH OF THIS CHARACTER: (RETURN=8 MAXIMUM=64) ";W
1470 IF W<1 THEN W=8
1480 IF W>64 THEN W=64
1490 PRINT
1500 '   ===================================================================
1510 '   WE MUST CLEAR THE ARRAY THE HARD WAY. NOTE THAT BASCOM 
1520 '   DOES NOT ALLOW USE OF CLEAR STATEMENT NOR ALLOW US TO REDIMENSION
1530 '   AN ARRAY. THIS ALSO PRINTS THE GRID PATTERN THEN MOVES UP CURSOR.
1540 FOR Y=1 TO 8:FOR X=1 TO W
1550 R(X,Y)=0:PRINT ".";
1560 NEXT:PRINT:NEXT
1570 FOR Y=1 TO 8:PRINT U$;:NEXT
1580 '   ===================================================================
1590 '   INITIALIZE X Y CO-ORDINATES
1600 X=1:Y=1
1610 '   ===================================================================
1620 '   THE MAIN LOOP STARTS HERE -- WE GET A KEY FROM THE USER
1630 A$=INKEY$:IF A$="" THEN 1630
1640 '   TEST FOR A VALID KEY. IF NOT VALID GET ANOTHER ELSE PROCESS IT
1650 IF A$=L$ OR A$=R$ OR A$=U$ OR A$=D$ THEN 1790
1660 IF A$=" " OR A$="." THEN A$=".":GOTO 1890
1670 IF A$="X" OR A$="x" THEN A$="X":GOTO 1940
1680 IF A$="D" OR A$="d" THEN 2010
1690 IF A$="A" OR A$="a" THEN 1350
1700 IF A$=CR$ THEN PRINT A$;:X=1
1710 IF A$=CR$ AND Y<8 THEN PRINT D$;:Y=Y+1
1720 GOTO 1630
1730 '   ===================================================================
1740 '   HERE IF USER HIT A CURSOR CONTROL KEY
1750 '   NOTE: BASIC-80 DOES NOT PRINT L$ IF PREVIOUS CHAR WAS R$ (I ASSUME
1760 '   IT LOOKS FOR A CHAR TO DELETE AND DOES NOT FIND ONE AND IGNORES THE
1770 '   BACKSPACE). HOWEVER, BASCOM DOESN'T CHECK AND ALWAYS PRINTS AN L$.
1780 '   TO PREVENT THIS NONSENSE I PRINT A CHAR WHEN R$ IS FOUND.
1790 IF A$=L$ AND X>1 THEN PRINT A$;:X=X-1:GOTO 1630
1800 IF A$=U$ AND Y>1 THEN PRINT A$;:Y=Y-1:GOTO 1630
1810 IF A$=D$ AND Y<8 THEN PRINT A$;:Y=Y+1:GOTO 1630
1820 '   FUDGE TO PRINT A CHAR WHEN R$ FOUND SO THAT BACKSPACE WORKS
1830 IF A$<>R$ GOTO 1630
1840 IF R(X,Y)=0 THEN PRINT "."; ELSE PRINT "X";
1850 IF X=W THEN PRINT L$; ELSE X=X+1
1860 GOTO 1630
1870 '   ===================================================================
1880 '   HERE IF HE KEYED A BLANK OR A DOT
1890 PRINT A$;:R(X,Y)=0
1900 IF X=W THEN PRINT L$; ELSE X=X+1
1910 GOTO 1630
1920 '   ===================================================================
1930 '   HERE IF HE KEYED X TO PRINT A DOT
1940 PRINT A$;:R(X,Y)=1
1950 IF X=W THEN PRINT L$; ELSE X=X+1
1960 GOTO 1630
1970 '   ===================================================================
1980 '   HERE AT D TO DUMP SCREEN PATTERN TO PRINTER. YOU MAY DELETE
1990 '   IF YOU DO NOT WANT A PRINTED PATTERN OF THE Xs AND DOTS
2000 '	 SAVE X,Y IN CASE HE WANTS TO CONTINUE WITH THIS CHAR.
2010 XS=X:YS=Y
2020 FOR K=1 TO 8
2030 FOR J=1 TO W
2040 IF R(J,K)=0 THEN LPRINT "."; ELSE LPRINT "X";
2050 NEXT
2060 LPRINT
2070 NEXT
2080 LPRINT
2090 '   ===================================================================
2100 '   JUMP OVER CITOH CODE IF WE ARE PRINTING EPSON
2110 IF P$="E" THEN GOTO 2570
2120 '   ===================================================================
2130 '   HERE IF PROCESSING A CHAR FOR A CITOH PRINTER (P$="C")
2140 LPRINT "CHARACTER: ";
2150 LPRINT ESC$+"S";
2160 IF W<10 THEN LPRINT "000"; ELSE LPRINT "00";
2170 A$=STR$(W)
2180 IF W<10 THEN A$=RIGHT$(A$,1)
2190 IF W>9 THEN A$=RIGHT$(A$,2)
2200 LPRINT A$;
2210 '   ===================================================================
2220 '   NOW SEND CITOH BYTES TO PRINT THE CHAR IN GRAPHIC MODE
2230 FOR X=1 TO W
2240 N=0:S=1
2250 FOR Y=1 TO 8
2260 N=N+R(X,Y)*S
2270 S=S*2
2280 NEXT
2290 LPRINT CHR$(N);
2300 NEXT
2310 LPRINT " ";
2320 '   ===================================================================
2330 '   NOW PRINT THE STRING NEEDED TO CREATE THIS CHAR
2340 LPRINT "CITOH CODE: 27 'S";
2350 IF W<10 THEN LPRINT "'0'0'0"; ELSE LPRINT "'0'0";
2360 A$=STR$(W):A$=RIGHT$(A$,LEN(A$)-1)
2370 IF W<10 THEN LPRINT "'"+A$
2380 IF W>9 THEN LPRINT "'"+LEFT$(A$,1)+"'"+RIGHT$(A$,1)
2390 '   ===================================================================
2400 '   PRINT DECIMAL BYTES FOR THIS CITOH CHAR.
2410 LPRINT "+ DECIMAL: ";
2420 FOR X=1 TO W
2430 N=0:S=1
2440 FOR Y=1 TO 8
2450 N=N+R(X,Y)*S
2460 S=S*2
2470 NEXT
2480 LPRINT N;
2490 IF LPOS(X) >PW THEN LPRINT
2500 NEXT
2510 LPRINT
2520 GOTO 2860
2530 '   ===================================================================
2540 '   WE ARE HERE TO PRINT THE CHARACTER ON AN EPSON
2550 '   SAME CODING AS CITOH EXCEPT FOR INTIALIZATION AND READING OF
2560 '   R ARRAY (EPSON IS READ FROM BOTTOM TO TOP OF EACH COLUMN)
2570 LPRINT "CHARACTER: ";
2580 LPRINT ESC$+"K"+CHR$(W)+CHR$(0);
2590 '   NOW SEND BYTES TO PRINT THE CHAR
2600 FOR X=1 TO W
2610 N=0:S=1
2620 FOR Y=8 TO 1 STEP -1
2630 N=N+R(X,Y)*S
2640 S=S*2
2650 NEXT
2660 LPRINT CHR$(N);
2670 NEXT
2680 LPRINT "  ";
2690 '   NOW PRINT THE CODE TO CREATE THIS CHAR
2700 LPRINT "EPSON BIT IMAGE CODE: 27 'K";W;"0"
2710 '   PRINT DECIMAL BYTES FOR EPSON CHAR
2720 LPRINT "+ DECIMAL: ";
2730 FOR X=1 TO W
2740 N=O:S=1
2750 FOR Y=8 TO 1 STEP -1
2760 N=N+R(X,Y)*S
2770 S=S*2
2780 NEXT
2790 LPRINT N;
2800 IF LPOS(X) >PW THEN LPRINT
2810 NEXT
2820 LPRINT
2830 GOTO 2860
2840 '   ===================================================================
2850 '   HERE AT END OF PRINT. RESTORE X AND Y IN CASE OF CONTINUE
2860 X=XS:Y=YS
2870 LPRINT:LPRINT
2880 A$=INKEY$:IF A$="" THEN 2880
2890 IF A$="C" OR A$="c" THEN 1630 ELSE GOTO 1350
2900 '   ===================================================================
2910 '   HERE TO PRINT INSTRUCTIONS
2920 PRINT CLS$
2930 PRINT "FLASHGEN FOR FLASHPRINT!! VERSION H - JAMES TUCKER 1985"
2940 PRINT
2950 PRINT "FLASHGEN  ALLOWS YOU TO DESIGN A CHARACTER  ON YOUR  SCREEN THEN 
2960 PRINT "DUMP THE REQUIRED BIT IMAGE CODING TO YOUR PRINTER. THE CODE MAY 
2970 PRINT "THEN BE KEYED INTO A FLASHPRINT!! TABLE. FLASHPRINT!! ALLOWS YOU
2980 PRINT "TO PRINT ANY CHARACTER WHICH YOU DESIGN FROM A WORDSTAR FILE
2990 PRINT "
3000 PRINT "YOU MUST  SPECIFY YOUR PRINTER  (AS PROMPTED)  THEN THE WIDTH OF 
3010 PRINT "YOUR CHARACTER (ALL CHARACTERS ARE 8 DOTS HIGH). THE NORMAL CP/M 
3020 PRINT "CURSOR  KEYS MAY BE USED TO MOVE YOUR CURSOR TO A DOT  POSITION. 
3030 PRINT "THE <RETURN> KEY WILL MOVE YOU TO THE START OF THE NEXT LINE.
3040 PRINT "
3050 PRINT "ON YOUR GRID,  BLANK PRINTING DOTS  ARE DISPLAYED BY A DOT  (THE 
3060 PRINT "INITIAL STATE) AND PRINTING DOTS ARE DISPLAYED BY AN X.  YOU KEY 
3070 PRINT "AN X TO CHANGE A BLANK INTO A PRINTING DOT. YOU KEY A SPACE OR A 
3080 PRINT "DOT TO CHANGE AN X INTO A BLANK.
3090 PRINT "
3100 PRINT "WHENEVER  YOU HAVE A CHARACTER IMAGE  ON THE SCREEN  YOU MAY KEY 
3110 PRINT "D TO DUMP IT YOUR PRINTER OR A TO ABORT AND START AGAIN. AFTER A 
3120 PRINT "PRINTER DUMP YOU MAY KEY C TO CONTINUE WITH CURRENT CHARACTER OR 
3130 PRINT "ANY OTHER KEY TO CLEAR SCREEN AND START A NEW CHARACTER.
3140 PRINT "
3150 PRINT "NOW PLEASE PRESS ANY KEY TO RUN FLASHGEN"
3160 A$=INKEY$:IF A$="" THEN 3160
3170 GOTO 1350
3180 END
