8-Bit Software Online Conversion
:0.$.TYPIST2 - Listing
1REM"
2REM" Typewriter Listing 2
3REM" Mike Rawlings
4REM" For BBCB / B+ / Electron
5REM" 6th July 1986
6REM"
7REM"
8REM" Printer specific codes
9REM" marked with REM statements
10REM"
11REM"
12REM" Codes are correct for
13REM" Epson DX-100 / Brother HR15
14REM"
15:
16ON ERROR GOTO 80
17IF PAGE=&2400:*TAPE
18x1=0:y1=0:PROCesc:PROCtab4
19x2=0:y2=9:VDU 12,30:PROCres
20FOR a=0 TO Q%
21$(F%+a*71)=STRING$(70," "):NEXT
22:
23REPEAT x=GET
24IF x=144 GOTO 47
25IF x=145 GOTO 48
26IF x=146 GOTO 49
27IF x=148 GOTO 50
28IF x=21 UNTIL 0
29IF x=136 AND x2=0 UNTIL 0
30IF x=127 AND x2=0 UNTIL 0
31IF x=127 OR x=136 PROCbs:UNTIL 0
32IF x=138 AND y2>(Q%-1) UNTIL 0
33IF x=138 PROCline(3):UNTIL 0
34IF x=139 AND y2=0 UNTIL 0
35IF x=139 PROCline(2):UNTIL 0
36IF y2>Q% UNTIL 0
37IF x=13 VDU 2,x,10,3:PROCline(1)
38IF x2>69 OR x=13 UNTIL0
39IF x=9 PROCtab1:UNTIL 0
40IF x=147 GOTO 51
41IF x=137 OR x=32 PROCht:UNTIL 0
42IF x>127 UNTIL 0
43UNTIL x=x
44:
45f=x:x3=x2:REPEAT
46IF f<>0 x=f:f=0:ELSE x=GET
47IF x=144 PROCtab4:UNTIL 0
48IF x=145 PROCtab5:UNTIL 0
49IF x=146 PROCtab3(255):UNTIL 0
50IF x=148 PROCdef:UNTIL 0
51IF x=147 PROCtab3(32):UNTIL 0
52IF x=127 VDU x:x2=x2-1
53IF x=127 UNTIL x2=x3:GOTO 23
54IF x=9 AND x2>69 UNTIL 0
55IF x=9 PROCtab2:UNTIL 0
56IF x>127 UNTIL 0
57IF x=21 PROCdel:UNTIL x=x:GOTO 23
58IF x<>13 AND x<32 UNTIL 0
59IF x=13 OR x2>69 GOTO63
60VDU 5,25,4,(POS+5)*16;895-VPOS*32;
61SOUND0,2,4,1:VDU x,4,9:?(C%+x2)=x+6
1*(x=96)
62PROCbell:UNTIL 0
63UNTIL x=13:!&8B=F%+y2*71
64?&8D=x3:?&8E=x2:CALL D%
65PROCline(1):GOTO 23
66:
67DEF PROCdef:x1=POS:y1=VPOS:VDU 28,4
4,31,76,29:CLS:PRINTTAB(1,1)$N%;
68REPEAT x=GET:UNTIL (x>47 AND x<58)
OR x=13
69IF x=13 PROCesc:ENDPROC
70VDU x:x=x-48:REPEAT d=GET:UNTIL d=1
3 OR d=127
71IF d=127 VDU d:GOTO 68
72PRINTTAB(1,1)$M%;:?&8D=23:CALL B%:$
H%="KEY"+STR$(x)+""""+$H%+"""":CALL &FFF
7:PROCesc:ENDPROC
73:
74DEF PROCesc:VDU 28,44,31,76,29:COLO
UR 1:COLOUR 128:CLS:PRINT $J%'$K%'$L%;:P
ROCret:ENDPROC
75:
76DEF PROCret:VDU28,5,27,76,4:COLOUR0
:COLOUR129:VDU31,x1,y1:ENDPROC
77:
78DEF PROCset:x1=POS:y1=VPOS:COLOUR 1
:COLOUR 128:ENDPROC
79:
80IF ERR=17:PROCesc:GOTO 19
81PROCres:MODE 7:*FX 4,0
82PRINT'':REPORT:*FX 202,32
83*FX 212,144
84*FX 213,101
85PRINT" at line ";ERL:*DISK
86END
87:
88DEF PROCline(a):ON a GOTO 91,94,89
89VDU 10,2:IFx2=0 VDU 13,3:ELSEVDU 1,
10,3
90GOTO 92
91x2=0
92y2=y2+1:IF VPOS=23 AND y2<(Q%+1) GO
TO 95
93ENDPROC
94VDU 11:PROCup:y2=y2-1:IF VPOS<>0 EN
DPROC
95y1=895-VPOS*32:!&8B=F%+y2*71:?&8D=y
1 MOD 256:?&8E=y1 DIV 256:CALL E%:ENDPRO
C
96:
97DEF PROCtab1:REPEAT VDU 2,9,1,32,3:
GOTO 100
98:
99DEF PROCtab2:REPEAT VDU 9:?(C%+x2)=
32
100PROCbell:UNTIL ?(G%+x2)=255
101ENDPROC
102:
103DEF PROCtab3(x):IF x2=0 OR x2>69 EN
DPROC
104PROCset:?(G%+x2)=x:VDU 28,5,28,76,3
:VDU 31,x2,0,x,31,x2,25,x:PROCret:ENDPRO
C
105:
106DEF PROCtab4:PROCset:FOR a=0 TO 69:
?(G%+a)=32:NEXT:?(G%+a)=255:FOR a=3 TO 2
8 STEP 25:VDU 28,5,a,76,a:CLS:NEXT:PROCr
et:ENDPROC
107:
108DEF PROCtab5:PROCtab4:PROCset:VDU 2
8,5,28,76,3:FOR a=10 TO 60 STEP 10:VDU 3
1,a,0,255,31,a,25,255:?(G%+a)=255:NEXT:P
ROCret:ENDPROC
109:
110DEF PROCbell:IFx2=60 VDU 7
111x2=x2+1:ENDPROC
112:
113DEF PROCdel:FOR a=x3 TO (x2-1):VDU
127:NEXT:x2=x3:ENDPROC
114:
115DEF PROCht:VDU 9,2,1,32,3:PROCbell:
ENDPROC
116:
117DEF PROCbs:x2=x2-1:VDU 2,8,3:ENDPRO
C
118:
119REM" Reset printer
120DEF PROCres
121VDU 2,1,27,1,13,1,80,3:ENDPROC
122REM" Reset printer
123:
124REM" Reverse linefeed
125DEF PROCup:VDU 2,1,27,1,10,3
126ENDPROC
127REM" Reverse linefeed