10 REM	MASKEN
20 REM 	GENERIERT DIE PIXEL-MASKEN FUER DIE GRAUWERTE 0..15
30 REM	ALS PLOTT-MUSTER AUF DEM BILDSCHIRM
40 REM
50 REM	A.HERRMANN	16.12.83
60 REM
100 DIM MASK%(8,6)	:REM 8 MASKEN MIT 6 ZEILEN A 8 BITS
110 ESC$=CHR$(&H1B)	:REM ESCAPE
120 FF$=ESC$+"I"		:REM FENSTER LOESCHEN
130 F0$=ESC$+"B"+CHR$(&H20)	:REM FENSTER 0
132 F2$=ESC$+"B"+CHR$(&H22)	:REM FENSTER 2
150 PON%=1 : POF%=0		:REM PEN ON/OFF
160 Y0%=90 : X0%=152
170 REM
180 DIM BIT%(8)
181 BIT%(0)=&H1
182 BIT%(1)=&H2
183 BIT%(2)=&H4
184 BIT%(3)=&H8
185 BIT%(4)=&H10
186 BIT%(5)=&H20
187 BIT%(6)=&H40
188 BIT%(7)=&H80
189 REM
190 REM
200 DATA &H00,&H00,&H00,&H00,&H00,&H00	:REM 0
210 DATA &H00,&H00,&H08,&H00,&H00,&H00	:REM 1
220 DATA &H00,&H02,&H00,&H00,&H20,&H00	:REM 2
230 DATA &H00,&H22,&H00,&H00,&H22,&H00	:REM 3
240 DATA &H11,&H00,&H44,&H11,&H00,&H44	:REM 4
250 DATA &H11,&H44,&H11,&H44,&H11,&H44	:REM 5
260 DATA &H11,&H44,&HAA,&H11,&H44,&HAA	:REM 6
270 DATA &H55,&H88,&H55,&HAA,&H11,&HAA	:REM 7
280 MM%=15 : MH%=7
290 REM MASKEN EINLESEN
300 FOR I%=0 TO MH%
310 READ MASK%(I%,1),MASK%(I%,2),MASK%(I%,3),MASK%(I%,4),MASK%(I%,5),MASK%(I%,6)
320 NEXT I%
330 REM
340 PRINT FF$;
400 PRINT "Enter Greyvalue (0..F) / H / V / X ";
402 C$=INPUT$(1)
404 M%=INSTR("0123456789ABCDEFHVX",C$)-1
410 PRINT FF$;
420 IF M%<0 GOTO 402
430 IF M%=16 GOTO 1000			:REM H = HORIZONTAL GREYSCALE
432 IF M%=17 GOTO 1060			:REM V = VERTICAL GREYSCALE
434 IF M%=18 GOTO 1300			:REM X = EXIT
440 GOTO 1200
900 REM
1000 FOR M%=0 TO MM%			:REM HORIZONTAL GREYSCALE
1020 YMIN%=Y0%-M%*6 : YMAX%=YMIN%+5
1030 GOSUB 2030
1040 NEXT M%
1050 GOTO 400
1060 FOR YMIN%=Y0% TO 0 STEP -6 : YMAX%=YMIN%+5	:REM VERTICAL GREYSCALE
1080 FOR M%=0 TO MM%
1090 XMIN%=M%*8 : XMAX%=XMIN%+7
1100 GOSUB 2080
1110 NEXT M%
1120 NEXT YMIN%
1130 GOTO 400
1140 REM
1200 FOR YMIN%=Y0% TO 0 STEP -6 : YMAX%=YMIN%+5
1220 GOSUB 2030
1230 NEXT YMIN%
1240 GOTO 400
1300 END
2000 REM--------------------------------------
2030 FOR XMIN%=0 TO X0% STEP 8
2040 XMAX%=XMIN%+7
2050 GOSUB 2080
2060 NEXT XMIN%
2070 RETURN
2080 CALL WINDOW(XMIN%,YMIN%,XMAX%,YMAX%)
2090 IF M%>MH% THEN N%=MM%-M% ELSE N%=M%
2100 FOR I%=1 TO 6 : Y%=6-I%
2110 FOR J%=7 TO 0 STEP -1 : X%=7-J% 
2120 K%=MASK%(N%,I%) AND BIT%(J%)
2130 IF M%>MH% GOTO 2136
2132 IF K%=0 THEN CALL PUTP(X%,Y%,POF%) ELSE CALL PUTP(X%,Y%,PON%)
2134 GOTO 2140
2136 IF K%=0 THEN CALL PUTP(X%,Y%,PON%) ELSE CALL PUTP(X%,Y%,POF%)
2140 NEXT J% 
2150 NEXT I%
2160 RETURN
