8-Bit Software Online Conversion
PRINT : Print prepared L-head - Listing
10REM Headed Paper Printer
20REM by Steven Flintham
30REM
40REM Thursday 11th April 1991
50:
60MODE 135
70VDU 23;8202;0;0;0;
80PROCdisable
90PROCinit
100REPEAT
110REPEAT
120print%=FNmenu
130copies%=FNnum`of`copies
140UNTIL copies%>0
150continuous%=FNcont
160parallel%=FNparallel
170PROCprint(print%,copies%,continuous
%,parallel%)
180UNTIL FALSE
190END
200:
210DEF PROCdisable
220*FX229,1
230*FX4,2
240ENDPROC
250:
260DEF PROCenable
270*FX229,0
280*FX4,0
290ENDPROC
300:
310DEF PROCinit
320ON ERROR MODE 135:PROCerror:END
330max`size%=&5100
340DIM lhead% max`size%,oscli% 64
350ENDPROC
360:
370DEF PROCoscli($oscli%)
380LOCAL X%,Y%
390X%=oscli% MOD 256
400Y%=oscli% DIV 256
410CALL &FFF7
420ENDPROC
430:
440DEF PROCerror
450*FX3,4
460VDU 3
470REPORT
480PRINT " at line ";ERL
490PROCenable
500ENDPROC
510:
520DEF FNmenu
530LOCAL menu%
540PROCtitle
550PRINT'"Please select the heading to
print:"
560PRINT'TAB(2);"1) Steven Flintham"
570PRINT'TAB(2);"2) LHPRN"
580PRINT'"Please choose: ";
590REPEAT
600menu%=GET-48
610IF menu%>=-15 AND menu%<=-7 THEN me
nu%=menu%+16
620UNTIL menu%>=1 AND menu%<=2
630PRINT STR$(menu%)
640=menu%
650:
660DEF PROCtitle
670CLS
680PRINTTAB(6,0);CHR$141;CHR$132;CHR$1
57;CHR$131;"Headed Paper Printer ";CHR$
156
690PRINTTAB(6,1);CHR$141;CHR$132;CHR$1
57;CHR$131;"Headed Paper Printer ";CHR$
156
700ENDPROC
710:
720DEF FNparallel
730LOCAL key$
740PRINT'"Are you using a parallel pri
nter? ";
750REPEAT
760key$=CHR$(GET AND &DF)
770UNTIL key$="Y" OR key$="N"
780IF key$="Y" THEN PRINT "Yes":=TRUE
790PRINT "No":=FALSE
800:
810DEF FNnum`of`copies
820PRINT'"How many copies do you requi
re? ";
830=VAL(FNinput(3,0))
840:
850DEF FNinput(max`len%,min`len%)
860LOCAL input$,key%
870input$=""
880REPEAT
890REPEAT
900*FX21,0
910key%=GET
920UNTIL key%=13 OR key%=127 OR (key%>
=32 AND key%<=126)
930IF key%=127 AND LEN(input$)=0 THEN
PROCbleep
940IF key%<>127 AND key%<>13 AND LEN(i
nput$)=max`len% THEN PROCbleep
950IF key%<>127 AND key%<>13 AND LEN(i
nput$)<max`len% THEN VDU key%:input$=inp
ut$+CHR$(key%)
960IF key%=127 AND LEN(input$)>0 THEN
VDU 8,32,8:input$=LEFT$(input$,LEN(input
$)-1)
970UNTIL key%=13 AND LEN(input$)>min`l
en%
980PRINT
990=input$
1000:
1010DEF PROCbleep
1020SOUND 3,-10,101,5
1030ENDPROC
1040:
1050DEF FNcont
1060LOCAL key$
1070PRINT'"Are you using continuous pap
er? ";
1080REPEAT
1090key$=CHR$(GET AND &DF)
1100UNTIL key$="Y" OR key$="N"
1110IF key$="Y" THEN PRINT "Yes":=TRUE
1120PRINT "No":=FALSE
1130:
1140DEF PROCprint(print%,copies%,cont%,
parallel%)
1150LOCAL read%,fname$,length%,copy%,pr
int`one`copy%
1160IF parallel% THEN PROCoscli("FX5,1"
) ELSE PROCoscli("FX5,2")
1170RESTORE 1610
1180FOR read%=1 TO print%
1190READ fname$
1200NEXT
1210length%=FNlength(fname$)
1220IF length%<=max`size% THEN PROCoscl
i("LOAD "+fname$+" "+STR$÷lhead%) ELSE P
ROCprint`from`disc(fname$,copies%,cont%)
:ENDPROC
1230IF cont% THEN PRINT'"Printing..."
1240FOR copy%=1 TO copies%
1250IF NOT cont% THEN PRINT'"Printing..
."
1260VDU 2
1270FOR print`one`copy%=lhead% TO lhead
%+length%-1
1280VDU 1,?print`one`copy%
1290NEXT
1300IF cont% THEN VDU 1,12
1310VDU 3
1320IF NOT cont% AND copies%>1 AND copy
%<copies% THEN PRINT'"Insert a new sheet
of paper and press"'"SPACE...":PROCoscl
i("FX21"):REPEAT UNTIL GET=32
1330NEXT
1340ENDPROC
1350:
1360DEF PROCprint`from`disc(fname$,copi
es%,cont%)
1370LOCAL chan%,copy%
1380IF continuous% THEN PRINT'"Printing
..."
1390FOR copy%=1 TO copies%
1400IF NOT continuous% THEN PRINT'"Prin
ting..."
1410chan%=OPENIN(fname$)
1420VDU 2
1430REPEAT
1440VDU 1,BGET #chan%
1450UNTIL EOF #chan%
1460CLOSE #chan%
1470IF cont% THEN VDU 1,12
1480VDU 3
1490IF NOT cont% AND copies%>1 AND copy
%<copies% THEN PRINT'"Insert a new sheet
of paper and press"'"SPACE...":PROCoscl
i("FX21"):REPEAT UNTIL GET=32
1500NEXT
1510:
1520DEF FNlength(fname$)
1530LOCAL chan%,length%
1540chan%=OPENIN(fname$)
1550length%=EXT #chan%
1560CLOSE #chan%
1570=length%
1580ENDPROC
1590:
1600REM Filenames
1610DATA SFPRN1,LHPRN