Home » CEEFAX disks » telesoftware5.adl » 07-02-88/LISTER3

07-02-88/LISTER3

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » CEEFAX disks » telesoftware5.adl
Filename: 07-02-88/LISTER3
Read OK:
File size: 27DA bytes
Load address: FFFF1B00
Exec address: FFFF8023
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
   10REM BASIC PROGRAM LISTER
   20REM This program will list any
   30REM BASIC program from disc/net to
   40REM screen or printer.   It will
   50REM properly indent program lines,
   60REM split multiple statements,
   70REM split and indent IF statements
   80REM and emphasise the DEFinitions
   90REM of all procedures and
  100REM functions.
  110 
  120REM     (c) Derek Grainge
  130REM     18th April , 1987
  140REM Loretto School, Musselburgh
  150 
  160 
  170REM set up section
  171REM Lines 190,200,240,300
  172REM are NET/ADFS - specific.
  173REM Get rid of them if using disc.
  174REM Line 200 refers to a program
  175REM called PUTGET available
  176REM through MUSE or SJ research.
  180ON ERROR GOTO 1910
  190*NET
  200*PUTGET2
  210MODE7
  220PRINT"SETTING UP. PLEASE WAIT ..."
  230DIM A% 40 ,NAME$(127),linebuffer 256
  240*DIR $
  241REM The file called "FILE"
  242REM contains a list of all the
  243REM BASIC keywords.   This avoids
  244REM problems with differences
  245REM between BASIC versions 1,2 etc
  246REM However, In BASIC1 you will
  247REM find that OPENIN appears as
  248REM OPENUP.   If this is a problem
  249REM remove the REM on line 301.
  250X=OPENUP("FILE")
  260FOR I=0 TO 127
  270INPUT#X,NAME$(I)
  280NEXT
  290CLOSE#X
  300*NET
  301REM IF ?&8015=49 THEN NAME$(45)="OPENIN"
  310indent=0:margin=6:fornext=0:repuntil=0:space=32:return=13:remark=&F4:quote=34:comma=44:for=&E3:repeat=&F5:until=&FD:next=&ED:lineno=141:define=221:printable=127:colon=58:then=&8C:else=&8B
  320if=&E7:test1$=CHR$(quote)+CHR$(remark)+CHR$(for)+CHR$(else)+CHR$(repeat)+CHR$(next)+CHR$(until)
  330test2$=CHR$(then)+CHR$(if)+CHR$(else)+CHR$(colon)
  340single=1:double=2
  350 
  360 
  370REM THE MAIN PROGRAM REPEATS ITSELF
  380REPEAT
  390REM CHOOSE A DIRECTORY
  391REM To select a different directory
  392REM just type in its name.  If you
  393REM are happy with the current one,
  394REM press return.
  395REM If you are using the DFS there's
  396REM is no point in doing all this,
  397REM so delete lines 400 to 450.
  400*DIR
  410REPEAT
  420*CAT
  430INPUT"WHICH DIRECTORY",A$
  440IF A$<>"" THEN PROCoscli("DIR "+A$)
  450UNTIL A$=""
  460REM CHOOSE A PROGRAM
  470CLS:*CAT
  480INPUT"NAME OF PROGRAM",P$:P%=linebuffer
  490REM CHOOSE OUTPUT PARAMETERS
  491REM 1. You can start from any line
  492REM    in the program by typing a
  493REM    line number.
  494REM 2. I have arbitrarily limited
  495REM    the printing width to lie
  496REM    between 20 and 78.   Change
  497REM    these if you wish.
  498REM 3. Any word starting with Y
  499REM    will switch the printer on.
  500INPUT"STARTING AT LINE NO",startno
  510INPUT''"WIDTH OF LISTING ON SCREEN OR PAPER",R%
  520IF R%<20 OR R%>78 THEN GOTO 510
  530INPUT ''"PRINTER ON (Y/N) ",Y1$
  540IF LEFT$(Y1$,1)="Y" THEN INPUT"ECONET PRINTER (Y/N)",Y2$ ELSE Y2$="N"
  550*FX 5,1
  560IF LEFT$(Y2$,1)="Y" THEN *FX 5,4
  570PRINT'''''
  580IF LEFT$(Y1$,1)="Y" THEN VDU 2,1,27,1,40
  581REM The VDU sequence 1,27,1,40
  582REM selects NLQ printing on my
  583REM CANON.   Stick in your own
  584REM code to select your
  585REM preferred printing style.
  590REM IF R%<40 THEN MODE 7 ELSE MODE 3
  591REM If you remove all the REM state-
  592REM ments there will probably be
  593REM enough room for the program
  594REM to run in a mode with 80
  595REM characters to the line.   In 
  596REM which case, remove the REM from
  597REM line 590, but leave the IF
  598REM statement behind!
  600 
  610REM THE MAIN PROGRAM ITSELF
  611REM Open the file, and process each
  612REM line until we reach the end.
  614margin=6:fornext=0:repuntil=0
  615decode=TRUE:mode=single
  620PRINT'P$'
  630theend=FALSE
  640X=OPENUP(P$)
  650REPEAT
  660PROCloadline(linebuffer)
  670PROCcheck(linebuffer)
  680IF (NOT theend) AND highenough THEN PROClistline(linebuffer+4)
  690UNTIL theend
  700CLOSE#X
  710PRINT''
  720IF Y2$="N" THEN VDU 1,12
  730VDU 3
  740 
  750REM ANOTHER GO ?
  751REM The program repeats until you
  752REM reply with a word starting with
  753REM N.
  760INPUT''"ANOTHER GO",Y$
  770UNTIL LEFT$(Y$,1)="N"
  780END
  790REM END OF MAIN PROGRAM
  800 
  810 
  820REM CHECK A LINE FOR LEGALITY
  821REM The 1st char must be 13, and
  822REM the 2nd less than 128. Check
  823REM if within range for listing.
  824REM Calculate the correct margin
  825REM and print the line number.
  830 
  840DEFPROCcheck(A%)
  850IF ?A%<>13 THEN theend=TRUE:VDU 3:PRINT"ILLEGAL BASIC STORAGE":ENDPROC
  860IF A%?1>127 THEN theend=TRUE:ENDPROC
  870highenough=TRUE
  880IF (A%?1)*256+A%?2<startno THEN highenough=FALSE:ENDPROC
  890@%=5:margin=6+2*fornext+2*repuntil:IF margin<6 THEN margin=6
  900PRINT(A%?1)*256 + (A%?2) ;STRING$(margin-5," ");:@%=0:Q%=margin
  910mode=single
  920ENDPROC
  930 
  940 
  950REM PRINT A PROGRAM LINE
  951REM B% points the the line's text.
  952REM Reset indent because IF state-
  953REM ments are only indented while
  954REM on the current line.
  955REM calculate the line length.
  956REM Calculate the margin and
  957REM print each statement until
  958REM finished.
  960 
  970DEFPROClistline(B%)
  980indent=0
  990L%=?(B%-1)-4
 1000K%=-1
 1010margin=6+2*fornext+2*repuntil:IF margin<6 THEN margin=6
 1020Q%=margin
 1030REPEAT
 1040PROCstatement
 1050UNTIL K%>=L%-1
 1060PRINT
 1070ENDPROC
 1080 
 1090 
 1100REM PRINT ONE PROGRAM STATEMENT
 1101REM Deal with each program state-
 1102REM ment.   BASIC doesn't have a
 1103REM CASE statement , so ON .. GOTO
 1104REM is the most efficient way of
 1105REM selecting options.
 1110 
 1120DEF PROCstatement
 1130PROCstripspaces
 1150REPEAT
 1160PROCnextchar
 1170a=INSTR(test1$,CHR$(char))
 1180ON a+1 GOTO 1260,1190,1200,1210,1220,1230,1240,1250
 1181REM line 1190 deals with a quote,
 1182REM 1200 with REM, 1210 with FOR
 1183REM 1220 with THEN, 1230 with
 1184REM REPEAT, 1240 with NEXT, and
 1185REM 1150 with UNTIL.
 1190PROCtext:GOTO 1320
 1200PROCrem:GOTO 1320
 1210fornext=fornext+1:PROCprint(space,decode):PROCprint(space,decode):GOTO 1260
 1220indent=indent-2:PROCstartline:GOTO 1260
 1230repuntil=repuntil+1:PROCprint(space,decode):PROCprint(space,decode):GOTO 1260
 1240PROCcheck_commas:GOTO 1260
 1250repuntil=repuntil-1:IF repuntil<0 THEN repuntil=0
 1260IF char=lineno THEN PROClineno(B%+K%+1) ELSE PROCprint(char,decode)
 1270a=INSTR(test2$,CHR$(char))
 1280ON a+1 GOTO 1320,1310,1290,1300,1305
 1281REM 1290 deals with IF, 1300 with
 1282REM ELSE, 1310 THEN, 1305 colon
 1290indent=indent+2:GOTO 1320
 1300indent=indent+2
 1305IF a=4 THEN PROCstripspaces:IF K%>=L%-1 THEN 1320
 1310PROCstartline
 1320UNTIL K%>=L%-1 OR char=colon
 1330ENDPROC
 1340 
 1350 
 1360REM EXECUTE A * INSTRUCTION
 1361REM A% point to a small text
 1362REM buffer where the * command
 1363REM is placed.
 1370 
 1380DEFPROCoscli(A$)
 1390$A%=A$
 1400X%=A% MOD 256
 1410Y%=A% DIV 256
 1420CALL &FFF7
 1430ENDPROC
 1440 
 1450 
 1460REM DECODE A LINE NUMBER
 1461REM Line numbers used by GOTO
 1462REM GOSUB are stored in a
 1463REM special format of a line
 1464REM number flag followed by three
 1465REM bytes.   This is to avoid each
 1466REM byte being >127 or <32 and
 1467REM hence possibly being decoded
 1468REM by BASIC as a control code or
 1469REM a BASIC keyword!
 1470 
 1480DEFPROClineno(A%)
 1490LOCAL D1%,D2%,D3%,L
 1500D1%= ((A%?1)AND &3F)
 1510D2%= ((A%?2)AND &3F)
 1520D3%= (?A%) EOR &54
 1530L= D2%*256+D1%+(D3%AND 4)*256*16 +(D3% AND 48)*4
 1540IF Q%+LEN(STR$(L))*mode>R% THEN PROCstartline
 1550PRINT L;
 1560K%=K%+3
 1570Q%=Q%+LEN(STR$(L))*mode
 1580ENDPROC
 1590 
 1600 
 1610REM CHECK A NEXT STATEMENT FOR COMMAS
 1611REM A next statement may be
 1612REM followed by one or more
 1613REM variables, separated by commas.
 1614REM By counting forwards through
 1615REM the commas we know how many
 1616REM NEXTs have beeen implied.
 1617REM PS take care to avoid
 1618REM 'outdenting' !
 1620 
 1630DEF PROCcheck_commas
 1640fornext=fornext-1
 1650pos=K%
 1660REPEAT
 1670pos=pos+1
 1680IF B%?pos=comma THEN fornext=fornext-1
 1690UNTIL B%?pos=colon OR pos=L%-1 OR B%?pos=return
 1700IF fornext<0 THEN fornext=0
 1710ENDPROC
 1720 
 1730 
 1740REM INDENT THE MARGIN THE CORRECT # OF SPACES
 1741REM Used to split multiple state-
 1742REM ments or long lines.
 1743REM FOR/NEXT REPEAT/UNTIL and 
 1744REM IF/THEN/ELSE statements
 1745REM are all indented by two spaces.
 1746REM The effects of indenting an
 1747REM IF statement are only effective
 1748REM for the current program line.
 1750 
 1760DEF PROCstartline
 1770PRINT
 1780IF indent<0 THEN indent=0
 1790margin=6+2*fornext+2*repuntil+indent
 1800IF margin<6 THEN margin=6
 1810PRINT STRING$(margin," ");
 1820Q%=margin
 1830PROCstripspaces
 1850mode=single
 1860ENDPROC
 1870 
 1880 
 1890REM ERROR SECTION
 1891REM Escape will cause an exit to 
 1892REM this section, as will an error
 1893REM in the program - which will be
 1894REM reported.   You are asked if
 1895REM you wish another go.   Because
 1896REM an error might happen while
 1897REM setting things up, the program
 1898REM will have to be RUN again if
 1899REM the error happened there.
 1900 
 1910CLOSE#0
 1920VDU 12,3
 1930IF ERR<>17 THEN REPORT:PRINT" at line ";ERL
 1940INPUT''"ANOTHER GO ?",Y$
 1950IF LEFT$(Y$,1)="N" THEN END
 1960IF ERL<370 THEN RUN
 1970GOTO 380
 1980 
 1990 
 2000REM GET A LINE FROM THE FILE
 2001REM The line format is char. 13
 2002REM followed by line no (hi byte)
 2003REM If the hi byte is >127 that
 2004REM marks the end of the program.
 2005REM If all is well, the line no
 2006REM (lo byte) and line length
 2007REM follow, and then the code for
 2008REM that line of program.
 2010 
 2020DEFPROCloadline(buf)
 2030LOCAL a,b
 2040a=BGET#X
 2050?buf=a
 2060b=BGET#X
 2070buf?1=b
 2080IF a<>13 THEN ENDPROC
 2090IF b>127 THEN ENDPROC
 2100buf?2=BGET#X
 2110a=BGET#X
 2120buf?3=a
 2130FOR b=4 TO a-1
 2140buf?b=BGET#X
 2150NEXT b
 2160buf?a=13
 2170ENDPROC
 2180 
 2190 
 2200REM IGNORE ANY LEADING SPACES
 2210REM AT THE START OF A LINE
 2211REM The program organises its own
 2212REM indentation so it ignores yours
 2220 
 2230DEF PROCstripspaces
 2235IF Q%>margin THEN ENDPROC
 2240REPEAT
 2250K%=K%+1
 2260UNTIL K%>=L%-1 OR B%?K%>space
 2265K%=K%-1
 2270ENDPROC
 2280 
 2290 
 2300REM GET THE NEXT CHARACTER
 2301REM Return a space if off the end
 2302REM of the line, or if the char.
 2303REM was a control code. Thus many
 2304REM unlistable programs are now
 2305REM listable!
 2310 
 2320DEF PROCnextchar
 2330K%=K%+1
 2340IF K%>L%-1 THEN char=space ELSE char=B%?K%
 2350IF char<space THEN char=space
 2360ENDPROC
 2370 
 2380 
 2390REM DEAL WITH A REM STATEMENT
 2391REM The rest of the line will be
 2392REM treated as text, but it may
 2393REM include BASIC keywords, which
 2394REM have to be decoded.
 2400 
 2410DEF PROCrem
 2420PROCprint(char,decode)
 2430REPEAT
 2440PROCnextchar
 2450IF char=quote THEN PROCtext ELSE PROCprint(char,decode)
 2460UNTIL K%>=L%-1
 2470ENDPROC
 2480 
 2490 
 2500REM DEAL WITH TEXT BETWEEN QUOTES
 2501REM print the first quote, then 
 2502REM keep on printing until the
 2503REM end of the string is found.
 2504REM Guard against missing quotes
 2505REM at the end of line!
 2506REM Double quotes are no problem -
 2507REM we toggle out and in to text
 2508REM mode again.   Codes >128 are
 2509REM teletext control - ignore them.
 2510 
 2520DEF PROCtext
 2530PROCprint(char,NOT decode)
 2540REPEAT
 2550PROCnextchar
 2560PROCprint(char,NOT decode)
 2570UNTIL K%>=L%-1 OR char=quote
 2580ENDPROC
 2590 
 2600 
 2610REM PRINT A CHARACTER OR
 2620REM COMPRESSED CODE
 2621REM Logical variable decode
 2622REM indicates whether in program
 2623REM or text mode - teletext codes
 2624REM >128 can clog up the printer,
 2625REM so for neatness' sake, replace
 2626REM them by spaces.
 2627REM DEF PROC and FN statements are
 2628REM printed double width, so be
 2629REM careful about the line length.
 2630 
 2640DEF PROCprint(char,decode)
 2650LOCAL l,A$
 2660A$=CHR$(char)
 2670l=1
 2680IF decode THEN IF char>printable THEN A$=NAME$(char-128):l=LEN(A$)
 2690IF NOT decode THEN IF (char MOD 128)<space THEN A$=" "
 2700IF Q%+l*mode>R% THEN PROCstartline
 2710IF char=define THEN VDU 8,129:IF LEFT$(Y1$,1)="Y" THEN mode=double:VDU 1,32,1,14
 2720PRINT A$;
 2730Q%=Q%+l*mode
 2740ENDPROC
 2750 
 2760 

� BASIC PROGRAM LISTER
 � This program will list any
$� BASIC program from disc/net to
("� screen or printer.   It will
2$� properly indent program lines,
< � split multiple statements,
F$� split and indent IF statements
P#� and emphasise the DEFinitions
Z� of all procedures and
d� functions.
n 
x�     (c) Derek Grainge
��     18th April , 1987
�!� Loretto School, Musselburgh
� 
� 
�� set up section
�� Lines 190,200,240,300
�� are NET/ADFS - specific.
�$� Get rid of them if using disc.
�"� Line 200 refers to a program
�� called PUTGET available
�"� through MUSE or SJ research.
�� � � �DvG
�*NET
�*PUTGET2
��7
�"�"SETTING UP. PLEASE WAIT ..."
�&� A% 40 ,NAME$(127),linebuffer 256
�
*DIR $
�� The file called "FILE"
� � contains a list of all the
�#� BASIC keywords.   This avoids
�� problems with differences
�$� between BASIC versions 1,2 etc
�!� However, In BASIC1 you will
�!� find that OPENIN appears as
�$� OPENUP.   If this is a problem
�!� remove the REM on line 301.
�X=�("FILE")
� I=0 � 127
�#X,NAME$(I)
�
"�#X
,*NET
-*� IF ?&8015=49 THEN NAME$(45)="OPENIN"
6�indent=0:margin=6:fornext=0:repuntil=0:space=32:return=13:remark=&F4:quote=34:comma=44:for=&E3:repeat=&F5:until=&FD:next=&ED:lineno=141:define=221:printable=127:colon=58:then=&8C:else=&8B
@Nif=&E7:test1$=�(quote)+�(remark)+�(for)+�(else)+�(repeat)+�(next)+�(until)
J)test2$=�(then)+�(if)+�(else)+�(colon)
Tsingle=1:double=2
^ 
h 
r%� THE MAIN PROGRAM REPEATS ITSELF
|�
�� CHOOSE A DIRECTORY
�%� To select a different directory
�$� just type in its name.  If you
�%� are happy with the current one,
�� press return.
�&� If you are using the DFS there's
�$� is no point in doing all this,
�!� so delete lines 400 to 450.
�*DIR
��
�*CAT
��"WHICH DIRECTORY",A$
� � A$<>"" � �oscli("DIR "+A$)
�� A$=""
�� CHOOSE A PROGRAM
�
�:*CAT
�'�"NAME OF PROGRAM",P$:P%=linebuffer
�� CHOOSE OUTPUT PARAMETERS
�$� 1. You can start from any line
�#�    in the program by typing a
��    line number.
�#� 2. I have arbitrarily limited
�"�    the printing width to lie
�$�    between 20 and 78.   Change
��    these if you wish.
�!� 3. Any word starting with Y
�$�    will switch the printer on.
�"�"STARTING AT LINE NO",startno
�/�''"WIDTH OF LISTING ON SCREEN OR PAPER",R%
� R%<20 � R%>78 � � �d~A
� ''"PRINTER ON (Y/N) ",Y1$
9� �Y1$,1)="Y" � �"ECONET PRINTER (Y/N)",Y2$ � Y2$="N"
&*FX 5,1
0� �Y2$,1)="Y" � *FX 5,4
:
�'''''
D!� �Y1$,1)="Y" � � 2,1,27,1,40
E � The VDU sequence 1,27,1,40
F � selects NLQ printing on my
G � CANON.   Stick in your own
H� code to select your
I� preferred printing style.
N&� IF R%<40 THEN MODE 7 ELSE MODE 3
O&� If you remove all the REM state-
P"� ments there will probably be
Q!� enough room for the program
R� to run in a mode with 80
S#� characters to the line.   In 
T%� which case, remove the REM from
U � line 590, but leave the IF
V� statement behind!
X 
b� THE MAIN PROGRAM ITSELF
c%� Open the file, and process each
d"� line until we reach the end.
f!margin=6:fornext=0:repuntil=0
gdecode=�:mode=single
l	�'P$'
vtheend=�
�X=�(P$)
��
��loadline(linebuffer)
��check(linebuffer)
�7� (� theend) � highenough � �listline(linebuffer+4)
�� theend
��#X
��''
�� Y2$="N" � � 1,12
�� 3
� 
�� ANOTHER GO ?
�#� The program repeats until you
�%� reply with a word starting with
�� N.
��''"ANOTHER GO",Y$
� �Y$,1)="N"
�
� END OF MAIN PROGRAM
  
* 
4� CHECK A LINE FOR LEGALITY
5"� The 1st char must be 13, and
6"� the 2nd less than 128. Check
7"� if within range for listing.
8"� Calculate the correct margin
9 � and print the line number.
> 
H��check(A%)
R7� ?A%<>13 � theend=�:� 3:�"ILLEGAL BASIC STORAGE":�
\� A%?1>127 � theend=�:�
fhighenough=�
p.� (A%?1)*256+A%?2<startno � highenough=�:�
z<@%=5:margin=6+2*fornext+2*repuntil:� margin<6 � margin=6
�8�(A%?1)*256 + (A%?2) ;�margin-5," ");:@%=0:Q%=margin
�mode=single
��
� 
� 
�� PRINT A PROGRAM LINE
�$� B% points the the line's text.
�$� Reset indent because IF state-
�#� ments are only indented while
�� on the current line.
� � calculate the line length.
�� Calculate the margin and
� � print each statement until
�� finished.
� 
���listline(B%)
�indent=0
�L%=?(B%-1)-4
�	K%=-1
�7margin=6+2*fornext+2*repuntil:� margin<6 � margin=6
�
Q%=margin
�
�statement
� K%>=L%-1
$�
.�
8 
B 
L!� PRINT ONE PROGRAM STATEMENT
M#� Deal with each program state-
N"� ment.   BASIC doesn't have a
O$� CASE statement , so ON .. GOTO
P"� is the most efficient way of
Q� selecting options.
V 
`� �statement
j�stripspaces
~�
�
�nextchar
�a=�test1$,�(char))
�3� a+1 � �dlD,�tfD,�tpD,�tzD,�dDD,�dND,�dXD,�dbD
�#� line 1190 deals with a quote,
�"� 1200 with REM, 1210 with FOR
�� 1220 with THEN, 1230 with
�!� REPEAT, 1240 with NEXT, and
�� 1150 with UNTIL.
��text:� �ThE
��rem:� �ThE
�Ffornext=fornext+1:�print(space,decode):�print(space,decode):� �dlD
�%indent=indent-2:�startline:� �dlD
�Hrepuntil=repuntil+1:�print(space,decode):�print(space,decode):� �dlD
��check_commas:� �dlD
�1repuntil=repuntil-1:� repuntil<0 � repuntil=0
�:� char=lineno � �lineno(B%+K%+1) � �print(char,decode)
�a=�test2$,�(char))
$� a+1 � �ThE,�T^E,�TJE,�TTE,�TYE
#� 1290 deals with IF, 1300 with
!� ELSE, 1310 THEN, 1305 colon

indent=indent+2:� �ThE
indent=indent+2
*� a=4 � �stripspaces:� K%>=L%-1 � �ThE
�startline
(� K%>=L%-1 � char=colon
2�
< 
F 
P� EXECUTE A * INSTRUCTION
Q� A% point to a small text
R � buffer where the * command
S� is placed.
Z 
d��oscli(A$)
n
$A%=A$
xX%=A% � 256
�Y%=A% � 256
�� &FFF7
��
� 
� 
�� DECODE A LINE NUMBER
�� Line numbers used by GOTO
�� GOSUB are stored in a
�� special format of a line
�#� number flag followed by three
�$� bytes.   This is to avoid each
� � byte being >127 or <32 and
�"� hence possibly being decoded
�#� by BASIC as a control code or
�� a BASIC keyword!
� 
���lineno(A%)
�� D1%,D2%,D3%,L
�D1%= ((A%?1)� &3F)
�D2%= ((A%?2)� &3F)
�D3%= (?A%) � &54
�0L= D2%*256+D1%+(D3%� 4)*256*16 +(D3% � 48)*4
%� Q%+�(�(L))*mode>R% � �startline
� L;
K%=K%+3
"Q%=Q%+�(�(L))*mode
,�
6 
@ 
J'� CHECK A NEXT STATEMENT FOR COMMAS
K� A next statement may be
L� followed by one or more
M%� variables, separated by commas.
N"� By counting forwards through
O!� the commas we know how many
P� NEXTs have beeen implied.
Q� PS take care to avoid
R� 'outdenting' !
T 
^� �check_commas
hfornext=fornext-1
r
pos=K%
|�
�
pos=pos+1
�&� B%?pos=comma � fornext=fornext-1
�-� B%?pos=colon � pos=L%-1 � B%?pos=return
�� fornext<0 � fornext=0
��
� 
� 
�/� INDENT THE MARGIN THE CORRECT # OF SPACES
�#� Used to split multiple state-
�� ments or long lines.
� � FOR/NEXT REPEAT/UNTIL and 
�� IF/THEN/ELSE statements
�%� are all indented by two spaces.
�!� The effects of indenting an
�%� IF statement are only effective
�#� for the current program line.
� 
�� �startline
��
�� indent<0 � indent=0
�(margin=6+2*fornext+2*repuntil+indent
� margin<6 � margin=6
� �margin," ");

Q%=margin
&�stripspaces
:mode=single
D�
N 
X 
b� ERROR SECTION
c#� Escape will cause an exit to 
d$� this section, as will an error
e$� in the program - which will be
f"� reported.   You are asked if
g$� you wish another go.   Because
h!� an error might happen while
i$� setting things up, the program
j"� will have to be RUN again if
k� the error happened there.
l 
v�#0
�
� 12,3
�� �<>17 � �:�" at line ";�
��''"ANOTHER GO ?",Y$
�� �Y$,1)="N" � �
�� �<370 � �
�
� �D|A
� 
� 
�� GET A LINE FROM THE FILE
�!� The line format is char. 13
�#� followed by line no (hi byte)
�!� If the hi byte is >127 that
�#� marks the end of the program.
�!� If all is well, the line no
�� (lo byte) and line length
�#� follow, and then the code for
�� that line of program.
� 
���loadline(buf)
�	� a,b
�	a=�#X

?buf=a
	b=�#X
buf?1=b
 � a<>13 � �
*� b>127 � �
4
buf?2=�#X
>	a=�#X
Hbuf?3=a
R� b=4 � a-1
\
buf?b=�#X
f� b
pbuf?a=13
z�
� 
� 
�� IGNORE ANY LEADING SPACES
�� AT THE START OF A LINE
�#� The program organises its own
�%� indentation so it ignores yours
� 
�� �stripspaces
�� Q%>margin � �
��
�K%=K%+1
�� K%>=L%-1 � B%?K%>space
�K%=K%-1
��
� 
� 
�� GET THE NEXT CHARACTER
�#� Return a space if off the end
�"� of the line, or if the char.
�#� was a control code. Thus many
	!� unlistable programs are now
	� listable!
	 
	� �nextchar
	K%=K%+1
	$'� K%>L%-1 � char=space � char=B%?K%
	.� char<space � char=space
	8�
	B 
	L 
	V� DEAL WITH A REM STATEMENT
	W"� The rest of the line will be
	X!� treated as text, but it may
	Y#� include BASIC keywords, which
	Z� have to be decoded.
	` 
	j
� �rem
	t�print(char,decode)
	~�
	�
�nextchar
	�.� char=quote � �text � �print(char,decode)
	�� K%>=L%-1
	��
	� 
	� 
	�#� DEAL WITH TEXT BETWEEN QUOTES
	�"� print the first quote, then 
	� � keep on printing until the
	�!� end of the string is found.
	�"� Guard against missing quotes
	�� at the end of line!
	�$� Double quotes are no problem -
	�"� we toggle out and in to text
	�"� mode again.   Codes >128 are
	�%� teletext control - ignore them.
	� 
	�� �text
	��print(char,� decode)
	��
	�
�nextchar
�print(char,� decode)

� K%>=L%-1 � char=quote
�
 
( 
2� PRINT A CHARACTER OR
<� COMPRESSED CODE
=� Logical variable decode
>"� indicates whether in program
?#� or text mode - teletext codes
@#� >128 can clog up the printer,
A$� so for neatness' sake, replace
B� them by spaces.
C$� DEF PROC and FN statements are
D!� printed double width, so be
E$� careful about the line length.
F 
P� �print(char,decode)
Z
� l,A$
dA$=�(char)
nl=1
x<� decode � � char>printable � A$=NAME$(char-128):l=�(A$)
�.� � decode � � (char � 128)<space � A$=" "
�� Q%+l*mode>R% � �startline
�C� char=define � � 8,129:� �Y1$,1)="Y" � mode=double:� 1,32,1,14
�	� A$;
�Q%=Q%+l*mode
��
� 
� 
�
00000000  0d 00 0a 1a f4 20 42 41  53 49 43 20 50 52 4f 47  |..... BASIC PROG|
00000010  52 41 4d 20 4c 49 53 54  45 52 0d 00 14 20 f4 20  |RAM LISTER... . |
00000020  54 68 69 73 20 70 72 6f  67 72 61 6d 20 77 69 6c  |This program wil|
00000030  6c 20 6c 69 73 74 20 61  6e 79 0d 00 1e 24 f4 20  |l list any...$. |
00000040  42 41 53 49 43 20 70 72  6f 67 72 61 6d 20 66 72  |BASIC program fr|
00000050  6f 6d 20 64 69 73 63 2f  6e 65 74 20 74 6f 0d 00  |om disc/net to..|
00000060  28 22 f4 20 73 63 72 65  65 6e 20 6f 72 20 70 72  |(". screen or pr|
00000070  69 6e 74 65 72 2e 20 20  20 49 74 20 77 69 6c 6c  |inter.   It will|
00000080  0d 00 32 24 f4 20 70 72  6f 70 65 72 6c 79 20 69  |..2$. properly i|
00000090  6e 64 65 6e 74 20 70 72  6f 67 72 61 6d 20 6c 69  |ndent program li|
000000a0  6e 65 73 2c 0d 00 3c 20  f4 20 73 70 6c 69 74 20  |nes,..< . split |
000000b0  6d 75 6c 74 69 70 6c 65  20 73 74 61 74 65 6d 65  |multiple stateme|
000000c0  6e 74 73 2c 0d 00 46 24  f4 20 73 70 6c 69 74 20  |nts,..F$. split |
000000d0  61 6e 64 20 69 6e 64 65  6e 74 20 49 46 20 73 74  |and indent IF st|
000000e0  61 74 65 6d 65 6e 74 73  0d 00 50 23 f4 20 61 6e  |atements..P#. an|
000000f0  64 20 65 6d 70 68 61 73  69 73 65 20 74 68 65 20  |d emphasise the |
00000100  44 45 46 69 6e 69 74 69  6f 6e 73 0d 00 5a 1b f4  |DEFinitions..Z..|
00000110  20 6f 66 20 61 6c 6c 20  70 72 6f 63 65 64 75 72  | of all procedur|
00000120  65 73 20 61 6e 64 0d 00  64 10 f4 20 66 75 6e 63  |es and..d.. func|
00000130  74 69 6f 6e 73 2e 0d 00  6e 05 20 0d 00 78 1b f4  |tions...n. ..x..|
00000140  20 20 20 20 20 28 63 29  20 44 65 72 65 6b 20 47  |     (c) Derek G|
00000150  72 61 69 6e 67 65 0d 00  82 1b f4 20 20 20 20 20  |rainge.....     |
00000160  31 38 74 68 20 41 70 72  69 6c 20 2c 20 31 39 38  |18th April , 198|
00000170  37 0d 00 8c 21 f4 20 4c  6f 72 65 74 74 6f 20 53  |7...!. Loretto S|
00000180  63 68 6f 6f 6c 2c 20 4d  75 73 73 65 6c 62 75 72  |chool, Musselbur|
00000190  67 68 0d 00 96 05 20 0d  00 a0 05 20 0d 00 aa 14  |gh.... .... ....|
000001a0  f4 20 73 65 74 20 75 70  20 73 65 63 74 69 6f 6e  |. set up section|
000001b0  0d 00 ab 1b f4 20 4c 69  6e 65 73 20 31 39 30 2c  |..... Lines 190,|
000001c0  32 30 30 2c 32 34 30 2c  33 30 30 0d 00 ac 1e f4  |200,240,300.....|
000001d0  20 61 72 65 20 4e 45 54  2f 41 44 46 53 20 2d 20  | are NET/ADFS - |
000001e0  73 70 65 63 69 66 69 63  2e 0d 00 ad 24 f4 20 47  |specific....$. G|
000001f0  65 74 20 72 69 64 20 6f  66 20 74 68 65 6d 20 69  |et rid of them i|
00000200  66 20 75 73 69 6e 67 20  64 69 73 63 2e 0d 00 ae  |f using disc....|
00000210  22 f4 20 4c 69 6e 65 20  32 30 30 20 72 65 66 65  |". Line 200 refe|
00000220  72 73 20 74 6f 20 61 20  70 72 6f 67 72 61 6d 0d  |rs to a program.|
00000230  00 af 1d f4 20 63 61 6c  6c 65 64 20 50 55 54 47  |.... called PUTG|
00000240  45 54 20 61 76 61 69 6c  61 62 6c 65 0d 00 b0 22  |ET available..."|
00000250  f4 20 74 68 72 6f 75 67  68 20 4d 55 53 45 20 6f  |. through MUSE o|
00000260  72 20 53 4a 20 72 65 73  65 61 72 63 68 2e 0d 00  |r SJ research...|
00000270  b4 0e ee 20 85 20 e5 20  8d 44 76 47 0d 00 be 08  |... . . .DvG....|
00000280  2a 4e 45 54 0d 00 c8 0c  2a 50 55 54 47 45 54 32  |*NET....*PUTGET2|
00000290  0d 00 d2 06 eb 37 0d 00  dc 22 f1 22 53 45 54 54  |.....7..."."SETT|
000002a0  49 4e 47 20 55 50 2e 20  50 4c 45 41 53 45 20 57  |ING UP. PLEASE W|
000002b0  41 49 54 20 2e 2e 2e 22  0d 00 e6 26 de 20 41 25  |AIT ..."...&. A%|
000002c0  20 34 30 20 2c 4e 41 4d  45 24 28 31 32 37 29 2c  | 40 ,NAME$(127),|
000002d0  6c 69 6e 65 62 75 66 66  65 72 20 32 35 36 0d 00  |linebuffer 256..|
000002e0  f0 0a 2a 44 49 52 20 24  0d 00 f1 1c f4 20 54 68  |..*DIR $..... Th|
000002f0  65 20 66 69 6c 65 20 63  61 6c 6c 65 64 20 22 46  |e file called "F|
00000300  49 4c 45 22 0d 00 f2 20  f4 20 63 6f 6e 74 61 69  |ILE"... . contai|
00000310  6e 73 20 61 20 6c 69 73  74 20 6f 66 20 61 6c 6c  |ns a list of all|
00000320  20 74 68 65 0d 00 f3 23  f4 20 42 41 53 49 43 20  | the...#. BASIC |
00000330  6b 65 79 77 6f 72 64 73  2e 20 20 20 54 68 69 73  |keywords.   This|
00000340  20 61 76 6f 69 64 73 0d  00 f4 1f f4 20 70 72 6f  | avoids..... pro|
00000350  62 6c 65 6d 73 20 77 69  74 68 20 64 69 66 66 65  |blems with diffe|
00000360  72 65 6e 63 65 73 0d 00  f5 24 f4 20 62 65 74 77  |rences...$. betw|
00000370  65 65 6e 20 42 41 53 49  43 20 76 65 72 73 69 6f  |een BASIC versio|
00000380  6e 73 20 31 2c 32 20 65  74 63 0d 00 f6 21 f4 20  |ns 1,2 etc...!. |
00000390  48 6f 77 65 76 65 72 2c  20 49 6e 20 42 41 53 49  |However, In BASI|
000003a0  43 31 20 79 6f 75 20 77  69 6c 6c 0d 00 f7 21 f4  |C1 you will...!.|
000003b0  20 66 69 6e 64 20 74 68  61 74 20 4f 50 45 4e 49  | find that OPENI|
000003c0  4e 20 61 70 70 65 61 72  73 20 61 73 0d 00 f8 24  |N appears as...$|
000003d0  f4 20 4f 50 45 4e 55 50  2e 20 20 20 49 66 20 74  |. OPENUP.   If t|
000003e0  68 69 73 20 69 73 20 61  20 70 72 6f 62 6c 65 6d  |his is a problem|
000003f0  0d 00 f9 21 f4 20 72 65  6d 6f 76 65 20 74 68 65  |...!. remove the|
00000400  20 52 45 4d 20 6f 6e 20  6c 69 6e 65 20 33 30 31  | REM on line 301|
00000410  2e 0d 00 fa 0f 58 3d ad  28 22 46 49 4c 45 22 29  |.....X=.("FILE")|
00000420  0d 01 04 0f e3 20 49 3d  30 20 b8 20 31 32 37 0d  |..... I=0 . 127.|
00000430  01 0e 10 e8 23 58 2c 4e  41 4d 45 24 28 49 29 0d  |....#X,NAME$(I).|
00000440  01 18 05 ed 0d 01 22 07  d9 23 58 0d 01 2c 08 2a  |......"..#X..,.*|
00000450  4e 45 54 0d 01 2d 2a f4  20 49 46 20 3f 26 38 30  |NET..-*. IF ?&80|
00000460  31 35 3d 34 39 20 54 48  45 4e 20 4e 41 4d 45 24  |15=49 THEN NAME$|
00000470  28 34 35 29 3d 22 4f 50  45 4e 49 4e 22 0d 01 36  |(45)="OPENIN"..6|
00000480  bf 69 6e 64 65 6e 74 3d  30 3a 6d 61 72 67 69 6e  |.indent=0:margin|
00000490  3d 36 3a 66 6f 72 6e 65  78 74 3d 30 3a 72 65 70  |=6:fornext=0:rep|
000004a0  75 6e 74 69 6c 3d 30 3a  73 70 61 63 65 3d 33 32  |until=0:space=32|
000004b0  3a 72 65 74 75 72 6e 3d  31 33 3a 72 65 6d 61 72  |:return=13:remar|
000004c0  6b 3d 26 46 34 3a 71 75  6f 74 65 3d 33 34 3a 63  |k=&F4:quote=34:c|
000004d0  6f 6d 6d 61 3d 34 34 3a  66 6f 72 3d 26 45 33 3a  |omma=44:for=&E3:|
000004e0  72 65 70 65 61 74 3d 26  46 35 3a 75 6e 74 69 6c  |repeat=&F5:until|
000004f0  3d 26 46 44 3a 6e 65 78  74 3d 26 45 44 3a 6c 69  |=&FD:next=&ED:li|
00000500  6e 65 6e 6f 3d 31 34 31  3a 64 65 66 69 6e 65 3d  |neno=141:define=|
00000510  32 32 31 3a 70 72 69 6e  74 61 62 6c 65 3d 31 32  |221:printable=12|
00000520  37 3a 63 6f 6c 6f 6e 3d  35 38 3a 74 68 65 6e 3d  |7:colon=58:then=|
00000530  26 38 43 3a 65 6c 73 65  3d 26 38 42 0d 01 40 4e  |&8C:else=&8B..@N|
00000540  69 66 3d 26 45 37 3a 74  65 73 74 31 24 3d bd 28  |if=&E7:test1$=.(|
00000550  71 75 6f 74 65 29 2b bd  28 72 65 6d 61 72 6b 29  |quote)+.(remark)|
00000560  2b bd 28 66 6f 72 29 2b  bd 28 65 6c 73 65 29 2b  |+.(for)+.(else)+|
00000570  bd 28 72 65 70 65 61 74  29 2b bd 28 6e 65 78 74  |.(repeat)+.(next|
00000580  29 2b bd 28 75 6e 74 69  6c 29 0d 01 4a 29 74 65  |)+.(until)..J)te|
00000590  73 74 32 24 3d bd 28 74  68 65 6e 29 2b bd 28 69  |st2$=.(then)+.(i|
000005a0  66 29 2b bd 28 65 6c 73  65 29 2b bd 28 63 6f 6c  |f)+.(else)+.(col|
000005b0  6f 6e 29 0d 01 54 15 73  69 6e 67 6c 65 3d 31 3a  |on)..T.single=1:|
000005c0  64 6f 75 62 6c 65 3d 32  0d 01 5e 05 20 0d 01 68  |double=2..^. ..h|
000005d0  05 20 0d 01 72 25 f4 20  54 48 45 20 4d 41 49 4e  |. ..r%. THE MAIN|
000005e0  20 50 52 4f 47 52 41 4d  20 52 45 50 45 41 54 53  | PROGRAM REPEATS|
000005f0  20 49 54 53 45 4c 46 0d  01 7c 05 f5 0d 01 86 18  | ITSELF..|......|
00000600  f4 20 43 48 4f 4f 53 45  20 41 20 44 49 52 45 43  |. CHOOSE A DIREC|
00000610  54 4f 52 59 0d 01 87 25  f4 20 54 6f 20 73 65 6c  |TORY...%. To sel|
00000620  65 63 74 20 61 20 64 69  66 66 65 72 65 6e 74 20  |ect a different |
00000630  64 69 72 65 63 74 6f 72  79 0d 01 88 24 f4 20 6a  |directory...$. j|
00000640  75 73 74 20 74 79 70 65  20 69 6e 20 69 74 73 20  |ust type in its |
00000650  6e 61 6d 65 2e 20 20 49  66 20 79 6f 75 0d 01 89  |name.  If you...|
00000660  25 f4 20 61 72 65 20 68  61 70 70 79 20 77 69 74  |%. are happy wit|
00000670  68 20 74 68 65 20 63 75  72 72 65 6e 74 20 6f 6e  |h the current on|
00000680  65 2c 0d 01 8a 13 f4 20  70 72 65 73 73 20 72 65  |e,..... press re|
00000690  74 75 72 6e 2e 0d 01 8b  26 f4 20 49 66 20 79 6f  |turn....&. If yo|
000006a0  75 20 61 72 65 20 75 73  69 6e 67 20 74 68 65 20  |u are using the |
000006b0  44 46 53 20 74 68 65 72  65 27 73 0d 01 8c 24 f4  |DFS there's...$.|
000006c0  20 69 73 20 6e 6f 20 70  6f 69 6e 74 20 69 6e 20  | is no point in |
000006d0  64 6f 69 6e 67 20 61 6c  6c 20 74 68 69 73 2c 0d  |doing all this,.|
000006e0  01 8d 21 f4 20 73 6f 20  64 65 6c 65 74 65 20 6c  |..!. so delete l|
000006f0  69 6e 65 73 20 34 30 30  20 74 6f 20 34 35 30 2e  |ines 400 to 450.|
00000700  0d 01 90 08 2a 44 49 52  0d 01 9a 05 f5 0d 01 a4  |....*DIR........|
00000710  08 2a 43 41 54 0d 01 ae  19 e8 22 57 48 49 43 48  |.*CAT....."WHICH|
00000720  20 44 49 52 45 43 54 4f  52 59 22 2c 41 24 0d 01  | DIRECTORY",A$..|
00000730  b8 20 e7 20 41 24 3c 3e  22 22 20 8c 20 f2 6f 73  |. . A$<>"" . .os|
00000740  63 6c 69 28 22 44 49 52  20 22 2b 41 24 29 0d 01  |cli("DIR "+A$)..|
00000750  c2 0b fd 20 41 24 3d 22  22 0d 01 cc 16 f4 20 43  |... A$=""..... C|
00000760  48 4f 4f 53 45 20 41 20  50 52 4f 47 52 41 4d 0d  |HOOSE A PROGRAM.|
00000770  01 d6 0a db 3a 2a 43 41  54 0d 01 e0 27 e8 22 4e  |....:*CAT...'."N|
00000780  41 4d 45 20 4f 46 20 50  52 4f 47 52 41 4d 22 2c  |AME OF PROGRAM",|
00000790  50 24 3a 50 25 3d 6c 69  6e 65 62 75 66 66 65 72  |P$:P%=linebuffer|
000007a0  0d 01 ea 1e f4 20 43 48  4f 4f 53 45 20 4f 55 54  |..... CHOOSE OUT|
000007b0  50 55 54 20 50 41 52 41  4d 45 54 45 52 53 0d 01  |PUT PARAMETERS..|
000007c0  eb 24 f4 20 31 2e 20 59  6f 75 20 63 61 6e 20 73  |.$. 1. You can s|
000007d0  74 61 72 74 20 66 72 6f  6d 20 61 6e 79 20 6c 69  |tart from any li|
000007e0  6e 65 0d 01 ec 23 f4 20  20 20 20 69 6e 20 74 68  |ne...#.    in th|
000007f0  65 20 70 72 6f 67 72 61  6d 20 62 79 20 74 79 70  |e program by typ|
00000800  69 6e 67 20 61 0d 01 ed  15 f4 20 20 20 20 6c 69  |ing a.....    li|
00000810  6e 65 20 6e 75 6d 62 65  72 2e 0d 01 ee 23 f4 20  |ne number....#. |
00000820  32 2e 20 49 20 68 61 76  65 20 61 72 62 69 74 72  |2. I have arbitr|
00000830  61 72 69 6c 79 20 6c 69  6d 69 74 65 64 0d 01 ef  |arily limited...|
00000840  22 f4 20 20 20 20 74 68  65 20 70 72 69 6e 74 69  |".    the printi|
00000850  6e 67 20 77 69 64 74 68  20 74 6f 20 6c 69 65 0d  |ng width to lie.|
00000860  01 f0 24 f4 20 20 20 20  62 65 74 77 65 65 6e 20  |..$.    between |
00000870  32 30 20 61 6e 64 20 37  38 2e 20 20 20 43 68 61  |20 and 78.   Cha|
00000880  6e 67 65 0d 01 f1 1b f4  20 20 20 20 74 68 65 73  |nge.....    thes|
00000890  65 20 69 66 20 79 6f 75  20 77 69 73 68 2e 0d 01  |e if you wish...|
000008a0  f2 21 f4 20 33 2e 20 41  6e 79 20 77 6f 72 64 20  |.!. 3. Any word |
000008b0  73 74 61 72 74 69 6e 67  20 77 69 74 68 20 59 0d  |starting with Y.|
000008c0  01 f3 24 f4 20 20 20 20  77 69 6c 6c 20 73 77 69  |..$.    will swi|
000008d0  74 63 68 20 74 68 65 20  70 72 69 6e 74 65 72 20  |tch the printer |
000008e0  6f 6e 2e 0d 01 f4 22 e8  22 53 54 41 52 54 49 4e  |on...."."STARTIN|
000008f0  47 20 41 54 20 4c 49 4e  45 20 4e 4f 22 2c 73 74  |G AT LINE NO",st|
00000900  61 72 74 6e 6f 0d 01 fe  2f e8 27 27 22 57 49 44  |artno.../.''"WID|
00000910  54 48 20 4f 46 20 4c 49  53 54 49 4e 47 20 4f 4e  |TH OF LISTING ON|
00000920  20 53 43 52 45 45 4e 20  4f 52 20 50 41 50 45 52  | SCREEN OR PAPER|
00000930  22 2c 52 25 0d 02 08 1c  e7 20 52 25 3c 32 30 20  |",R%..... R%<20 |
00000940  84 20 52 25 3e 37 38 20  8c 20 e5 20 8d 64 7e 41  |. R%>78 . . .d~A|
00000950  0d 02 12 1f e8 20 27 27  22 50 52 49 4e 54 45 52  |..... ''"PRINTER|
00000960  20 4f 4e 20 28 59 2f 4e  29 20 22 2c 59 31 24 0d  | ON (Y/N) ",Y1$.|
00000970  02 1c 39 e7 20 c0 59 31  24 2c 31 29 3d 22 59 22  |..9. .Y1$,1)="Y"|
00000980  20 8c 20 e8 22 45 43 4f  4e 45 54 20 50 52 49 4e  | . ."ECONET PRIN|
00000990  54 45 52 20 28 59 2f 4e  29 22 2c 59 32 24 20 8b  |TER (Y/N)",Y2$ .|
000009a0  20 59 32 24 3d 22 4e 22  0d 02 26 0b 2a 46 58 20  | Y2$="N"..&.*FX |
000009b0  35 2c 31 0d 02 30 1b e7  20 c0 59 32 24 2c 31 29  |5,1..0.. .Y2$,1)|
000009c0  3d 22 59 22 20 8c 20 2a  46 58 20 35 2c 34 0d 02  |="Y" . *FX 5,4..|
000009d0  3a 0a f1 27 27 27 27 27  0d 02 44 21 e7 20 c0 59  |:..'''''..D!. .Y|
000009e0  31 24 2c 31 29 3d 22 59  22 20 8c 20 ef 20 32 2c  |1$,1)="Y" . . 2,|
000009f0  31 2c 32 37 2c 31 2c 34  30 0d 02 45 20 f4 20 54  |1,27,1,40..E . T|
00000a00  68 65 20 56 44 55 20 73  65 71 75 65 6e 63 65 20  |he VDU sequence |
00000a10  31 2c 32 37 2c 31 2c 34  30 0d 02 46 20 f4 20 73  |1,27,1,40..F . s|
00000a20  65 6c 65 63 74 73 20 4e  4c 51 20 70 72 69 6e 74  |elects NLQ print|
00000a30  69 6e 67 20 6f 6e 20 6d  79 0d 02 47 20 f4 20 43  |ing on my..G . C|
00000a40  41 4e 4f 4e 2e 20 20 20  53 74 69 63 6b 20 69 6e  |ANON.   Stick in|
00000a50  20 79 6f 75 72 20 6f 77  6e 0d 02 48 19 f4 20 63  | your own..H.. c|
00000a60  6f 64 65 20 74 6f 20 73  65 6c 65 63 74 20 79 6f  |ode to select yo|
00000a70  75 72 0d 02 49 1f f4 20  70 72 65 66 65 72 72 65  |ur..I.. preferre|
00000a80  64 20 70 72 69 6e 74 69  6e 67 20 73 74 79 6c 65  |d printing style|
00000a90  2e 0d 02 4e 26 f4 20 49  46 20 52 25 3c 34 30 20  |...N&. IF R%<40 |
00000aa0  54 48 45 4e 20 4d 4f 44  45 20 37 20 45 4c 53 45  |THEN MODE 7 ELSE|
00000ab0  20 4d 4f 44 45 20 33 0d  02 4f 26 f4 20 49 66 20  | MODE 3..O&. If |
00000ac0  79 6f 75 20 72 65 6d 6f  76 65 20 61 6c 6c 20 74  |you remove all t|
00000ad0  68 65 20 52 45 4d 20 73  74 61 74 65 2d 0d 02 50  |he REM state-..P|
00000ae0  22 f4 20 6d 65 6e 74 73  20 74 68 65 72 65 20 77  |". ments there w|
00000af0  69 6c 6c 20 70 72 6f 62  61 62 6c 79 20 62 65 0d  |ill probably be.|
00000b00  02 51 21 f4 20 65 6e 6f  75 67 68 20 72 6f 6f 6d  |.Q!. enough room|
00000b10  20 66 6f 72 20 74 68 65  20 70 72 6f 67 72 61 6d  | for the program|
00000b20  0d 02 52 1e f4 20 74 6f  20 72 75 6e 20 69 6e 20  |..R.. to run in |
00000b30  61 20 6d 6f 64 65 20 77  69 74 68 20 38 30 0d 02  |a mode with 80..|
00000b40  53 23 f4 20 63 68 61 72  61 63 74 65 72 73 20 74  |S#. characters t|
00000b50  6f 20 74 68 65 20 6c 69  6e 65 2e 20 20 20 49 6e  |o the line.   In|
00000b60  20 0d 02 54 25 f4 20 77  68 69 63 68 20 63 61 73  | ..T%. which cas|
00000b70  65 2c 20 72 65 6d 6f 76  65 20 74 68 65 20 52 45  |e, remove the RE|
00000b80  4d 20 66 72 6f 6d 0d 02  55 20 f4 20 6c 69 6e 65  |M from..U . line|
00000b90  20 35 39 30 2c 20 62 75  74 20 6c 65 61 76 65 20  | 590, but leave |
00000ba0  74 68 65 20 49 46 0d 02  56 17 f4 20 73 74 61 74  |the IF..V.. stat|
00000bb0  65 6d 65 6e 74 20 62 65  68 69 6e 64 21 0d 02 58  |ement behind!..X|
00000bc0  05 20 0d 02 62 1d f4 20  54 48 45 20 4d 41 49 4e  |. ..b.. THE MAIN|
00000bd0  20 50 52 4f 47 52 41 4d  20 49 54 53 45 4c 46 0d  | PROGRAM ITSELF.|
00000be0  02 63 25 f4 20 4f 70 65  6e 20 74 68 65 20 66 69  |.c%. Open the fi|
00000bf0  6c 65 2c 20 61 6e 64 20  70 72 6f 63 65 73 73 20  |le, and process |
00000c00  65 61 63 68 0d 02 64 22  f4 20 6c 69 6e 65 20 75  |each..d". line u|
00000c10  6e 74 69 6c 20 77 65 20  72 65 61 63 68 20 74 68  |ntil we reach th|
00000c20  65 20 65 6e 64 2e 0d 02  66 21 6d 61 72 67 69 6e  |e end...f!margin|
00000c30  3d 36 3a 66 6f 72 6e 65  78 74 3d 30 3a 72 65 70  |=6:fornext=0:rep|
00000c40  75 6e 74 69 6c 3d 30 0d  02 67 18 64 65 63 6f 64  |until=0..g.decod|
00000c50  65 3d b9 3a 6d 6f 64 65  3d 73 69 6e 67 6c 65 0d  |e=.:mode=single.|
00000c60  02 6c 09 f1 27 50 24 27  0d 02 76 0c 74 68 65 65  |.l..'P$'..v.thee|
00000c70  6e 64 3d a3 0d 02 80 0b  58 3d ad 28 50 24 29 0d  |nd=.....X=.(P$).|
00000c80  02 8a 05 f5 0d 02 94 19  f2 6c 6f 61 64 6c 69 6e  |.........loadlin|
00000c90  65 28 6c 69 6e 65 62 75  66 66 65 72 29 0d 02 9e  |e(linebuffer)...|
00000ca0  16 f2 63 68 65 63 6b 28  6c 69 6e 65 62 75 66 66  |..check(linebuff|
00000cb0  65 72 29 0d 02 a8 37 e7  20 28 ac 20 74 68 65 65  |er)...7. (. thee|
00000cc0  6e 64 29 20 80 20 68 69  67 68 65 6e 6f 75 67 68  |nd) . highenough|
00000cd0  20 8c 20 f2 6c 69 73 74  6c 69 6e 65 28 6c 69 6e  | . .listline(lin|
00000ce0  65 62 75 66 66 65 72 2b  34 29 0d 02 b2 0c fd 20  |ebuffer+4)..... |
00000cf0  74 68 65 65 6e 64 0d 02  bc 07 d9 23 58 0d 02 c6  |theend.....#X...|
00000d00  07 f1 27 27 0d 02 d0 16  e7 20 59 32 24 3d 22 4e  |..''..... Y2$="N|
00000d10  22 20 8c 20 ef 20 31 2c  31 32 0d 02 da 07 ef 20  |" . . 1,12..... |
00000d20  33 0d 02 e4 05 20 0d 02  ee 12 f4 20 41 4e 4f 54  |3.... ..... ANOT|
00000d30  48 45 52 20 47 4f 20 3f  0d 02 ef 23 f4 20 54 68  |HER GO ?...#. Th|
00000d40  65 20 70 72 6f 67 72 61  6d 20 72 65 70 65 61 74  |e program repeat|
00000d50  73 20 75 6e 74 69 6c 20  79 6f 75 0d 02 f0 25 f4  |s until you...%.|
00000d60  20 72 65 70 6c 79 20 77  69 74 68 20 61 20 77 6f  | reply with a wo|
00000d70  72 64 20 73 74 61 72 74  69 6e 67 20 77 69 74 68  |rd starting with|
00000d80  0d 02 f1 08 f4 20 4e 2e  0d 02 f8 16 e8 27 27 22  |..... N......''"|
00000d90  41 4e 4f 54 48 45 52 20  47 4f 22 2c 59 24 0d 03  |ANOTHER GO",Y$..|
00000da0  02 10 fd 20 c0 59 24 2c  31 29 3d 22 4e 22 0d 03  |... .Y$,1)="N"..|
00000db0  0c 05 e0 0d 03 16 19 f4  20 45 4e 44 20 4f 46 20  |........ END OF |
00000dc0  4d 41 49 4e 20 50 52 4f  47 52 41 4d 0d 03 20 05  |MAIN PROGRAM.. .|
00000dd0  20 0d 03 2a 05 20 0d 03  34 1f f4 20 43 48 45 43  | ..*. ..4.. CHEC|
00000de0  4b 20 41 20 4c 49 4e 45  20 46 4f 52 20 4c 45 47  |K A LINE FOR LEG|
00000df0  41 4c 49 54 59 0d 03 35  22 f4 20 54 68 65 20 31  |ALITY..5". The 1|
00000e00  73 74 20 63 68 61 72 20  6d 75 73 74 20 62 65 20  |st char must be |
00000e10  31 33 2c 20 61 6e 64 0d  03 36 22 f4 20 74 68 65  |13, and..6". the|
00000e20  20 32 6e 64 20 6c 65 73  73 20 74 68 61 6e 20 31  | 2nd less than 1|
00000e30  32 38 2e 20 43 68 65 63  6b 0d 03 37 22 f4 20 69  |28. Check..7". i|
00000e40  66 20 77 69 74 68 69 6e  20 72 61 6e 67 65 20 66  |f within range f|
00000e50  6f 72 20 6c 69 73 74 69  6e 67 2e 0d 03 38 22 f4  |or listing...8".|
00000e60  20 43 61 6c 63 75 6c 61  74 65 20 74 68 65 20 63  | Calculate the c|
00000e70  6f 72 72 65 63 74 20 6d  61 72 67 69 6e 0d 03 39  |orrect margin..9|
00000e80  20 f4 20 61 6e 64 20 70  72 69 6e 74 20 74 68 65  | . and print the|
00000e90  20 6c 69 6e 65 20 6e 75  6d 62 65 72 2e 0d 03 3e  | line number...>|
00000ea0  05 20 0d 03 48 0f dd f2  63 68 65 63 6b 28 41 25  |. ..H...check(A%|
00000eb0  29 0d 03 52 37 e7 20 3f  41 25 3c 3e 31 33 20 8c  |)..R7. ?A%<>13 .|
00000ec0  20 74 68 65 65 6e 64 3d  b9 3a ef 20 33 3a f1 22  | theend=.:. 3:."|
00000ed0  49 4c 4c 45 47 41 4c 20  42 41 53 49 43 20 53 54  |ILLEGAL BASIC ST|
00000ee0  4f 52 41 47 45 22 3a e1  0d 03 5c 1b e7 20 41 25  |ORAGE":...\.. A%|
00000ef0  3f 31 3e 31 32 37 20 8c  20 74 68 65 65 6e 64 3d  |?1>127 . theend=|
00000f00  b9 3a e1 0d 03 66 10 68  69 67 68 65 6e 6f 75 67  |.:...f.highenoug|
00000f10  68 3d b9 0d 03 70 2e e7  20 28 41 25 3f 31 29 2a  |h=...p.. (A%?1)*|
00000f20  32 35 36 2b 41 25 3f 32  3c 73 74 61 72 74 6e 6f  |256+A%?2<startno|
00000f30  20 8c 20 68 69 67 68 65  6e 6f 75 67 68 3d a3 3a  | . highenough=.:|
00000f40  e1 0d 03 7a 3c 40 25 3d  35 3a 6d 61 72 67 69 6e  |...z<@%=5:margin|
00000f50  3d 36 2b 32 2a 66 6f 72  6e 65 78 74 2b 32 2a 72  |=6+2*fornext+2*r|
00000f60  65 70 75 6e 74 69 6c 3a  e7 20 6d 61 72 67 69 6e  |epuntil:. margin|
00000f70  3c 36 20 8c 20 6d 61 72  67 69 6e 3d 36 0d 03 84  |<6 . margin=6...|
00000f80  38 f1 28 41 25 3f 31 29  2a 32 35 36 20 2b 20 28  |8.(A%?1)*256 + (|
00000f90  41 25 3f 32 29 20 3b c4  6d 61 72 67 69 6e 2d 35  |A%?2) ;.margin-5|
00000fa0  2c 22 20 22 29 3b 3a 40  25 3d 30 3a 51 25 3d 6d  |," ");:@%=0:Q%=m|
00000fb0  61 72 67 69 6e 0d 03 8e  0f 6d 6f 64 65 3d 73 69  |argin....mode=si|
00000fc0  6e 67 6c 65 0d 03 98 05  e1 0d 03 a2 05 20 0d 03  |ngle......... ..|
00000fd0  ac 05 20 0d 03 b6 1a f4  20 50 52 49 4e 54 20 41  |.. ..... PRINT A|
00000fe0  20 50 52 4f 47 52 41 4d  20 4c 49 4e 45 0d 03 b7  | PROGRAM LINE...|
00000ff0  24 f4 20 42 25 20 70 6f  69 6e 74 73 20 74 68 65  |$. B% points the|
00001000  20 74 68 65 20 6c 69 6e  65 27 73 20 74 65 78 74  | the line's text|
00001010  2e 0d 03 b8 24 f4 20 52  65 73 65 74 20 69 6e 64  |....$. Reset ind|
00001020  65 6e 74 20 62 65 63 61  75 73 65 20 49 46 20 73  |ent because IF s|
00001030  74 61 74 65 2d 0d 03 b9  23 f4 20 6d 65 6e 74 73  |tate-...#. ments|
00001040  20 61 72 65 20 6f 6e 6c  79 20 69 6e 64 65 6e 74  | are only indent|
00001050  65 64 20 77 68 69 6c 65  0d 03 ba 1a f4 20 6f 6e  |ed while..... on|
00001060  20 74 68 65 20 63 75 72  72 65 6e 74 20 6c 69 6e  | the current lin|
00001070  65 2e 0d 03 bb 20 f4 20  63 61 6c 63 75 6c 61 74  |e.... . calculat|
00001080  65 20 74 68 65 20 6c 69  6e 65 20 6c 65 6e 67 74  |e the line lengt|
00001090  68 2e 0d 03 bc 1e f4 20  43 61 6c 63 75 6c 61 74  |h...... Calculat|
000010a0  65 20 74 68 65 20 6d 61  72 67 69 6e 20 61 6e 64  |e the margin and|
000010b0  0d 03 bd 20 f4 20 70 72  69 6e 74 20 65 61 63 68  |... . print each|
000010c0  20 73 74 61 74 65 6d 65  6e 74 20 75 6e 74 69 6c  | statement until|
000010d0  0d 03 be 0f f4 20 66 69  6e 69 73 68 65 64 2e 0d  |..... finished..|
000010e0  03 c0 05 20 0d 03 ca 12  dd f2 6c 69 73 74 6c 69  |... ......listli|
000010f0  6e 65 28 42 25 29 0d 03  d4 0c 69 6e 64 65 6e 74  |ne(B%)....indent|
00001100  3d 30 0d 03 de 10 4c 25  3d 3f 28 42 25 2d 31 29  |=0....L%=?(B%-1)|
00001110  2d 34 0d 03 e8 09 4b 25  3d 2d 31 0d 03 f2 37 6d  |-4....K%=-1...7m|
00001120  61 72 67 69 6e 3d 36 2b  32 2a 66 6f 72 6e 65 78  |argin=6+2*fornex|
00001130  74 2b 32 2a 72 65 70 75  6e 74 69 6c 3a e7 20 6d  |t+2*repuntil:. m|
00001140  61 72 67 69 6e 3c 36 20  8c 20 6d 61 72 67 69 6e  |argin<6 . margin|
00001150  3d 36 0d 03 fc 0d 51 25  3d 6d 61 72 67 69 6e 0d  |=6....Q%=margin.|
00001160  04 06 05 f5 0d 04 10 0e  f2 73 74 61 74 65 6d 65  |.........stateme|
00001170  6e 74 0d 04 1a 0e fd 20  4b 25 3e 3d 4c 25 2d 31  |nt..... K%>=L%-1|
00001180  0d 04 24 05 f1 0d 04 2e  05 e1 0d 04 38 05 20 0d  |..$.........8. .|
00001190  04 42 05 20 0d 04 4c 21  f4 20 50 52 49 4e 54 20  |.B. ..L!. PRINT |
000011a0  4f 4e 45 20 50 52 4f 47  52 41 4d 20 53 54 41 54  |ONE PROGRAM STAT|
000011b0  45 4d 45 4e 54 0d 04 4d  23 f4 20 44 65 61 6c 20  |EMENT..M#. Deal |
000011c0  77 69 74 68 20 65 61 63  68 20 70 72 6f 67 72 61  |with each progra|
000011d0  6d 20 73 74 61 74 65 2d  0d 04 4e 22 f4 20 6d 65  |m state-..N". me|
000011e0  6e 74 2e 20 20 20 42 41  53 49 43 20 64 6f 65 73  |nt.   BASIC does|
000011f0  6e 27 74 20 68 61 76 65  20 61 0d 04 4f 24 f4 20  |n't have a..O$. |
00001200  43 41 53 45 20 73 74 61  74 65 6d 65 6e 74 20 2c  |CASE statement ,|
00001210  20 73 6f 20 4f 4e 20 2e  2e 20 47 4f 54 4f 0d 04  | so ON .. GOTO..|
00001220  50 22 f4 20 69 73 20 74  68 65 20 6d 6f 73 74 20  |P". is the most |
00001230  65 66 66 69 63 69 65 6e  74 20 77 61 79 20 6f 66  |efficient way of|
00001240  0d 04 51 18 f4 20 73 65  6c 65 63 74 69 6e 67 20  |..Q.. selecting |
00001250  6f 70 74 69 6f 6e 73 2e  0d 04 56 05 20 0d 04 60  |options...V. ..`|
00001260  10 dd 20 f2 73 74 61 74  65 6d 65 6e 74 0d 04 6a  |.. .statement..j|
00001270  10 f2 73 74 72 69 70 73  70 61 63 65 73 0d 04 7e  |..stripspaces..~|
00001280  05 f5 0d 04 88 0d f2 6e  65 78 74 63 68 61 72 0d  |.......nextchar.|
00001290  04 92 16 61 3d a7 74 65  73 74 31 24 2c bd 28 63  |...a=.test1$,.(c|
000012a0  68 61 72 29 29 0d 04 9c  33 ee 20 61 2b 31 20 e5  |har))...3. a+1 .|
000012b0  20 8d 64 6c 44 2c 8d 74  66 44 2c 8d 74 70 44 2c  | .dlD,.tfD,.tpD,|
000012c0  8d 74 7a 44 2c 8d 64 44  44 2c 8d 64 4e 44 2c 8d  |.tzD,.dDD,.dND,.|
000012d0  64 58 44 2c 8d 64 62 44  0d 04 9d 23 f4 20 6c 69  |dXD,.dbD...#. li|
000012e0  6e 65 20 31 31 39 30 20  64 65 61 6c 73 20 77 69  |ne 1190 deals wi|
000012f0  74 68 20 61 20 71 75 6f  74 65 2c 0d 04 9e 22 f4  |th a quote,...".|
00001300  20 31 32 30 30 20 77 69  74 68 20 52 45 4d 2c 20  | 1200 with REM, |
00001310  31 32 31 30 20 77 69 74  68 20 46 4f 52 0d 04 9f  |1210 with FOR...|
00001320  1f f4 20 31 32 32 30 20  77 69 74 68 20 54 48 45  |.. 1220 with THE|
00001330  4e 2c 20 31 32 33 30 20  77 69 74 68 0d 04 a0 21  |N, 1230 with...!|
00001340  f4 20 52 45 50 45 41 54  2c 20 31 32 34 30 20 77  |. REPEAT, 1240 w|
00001350  69 74 68 20 4e 45 58 54  2c 20 61 6e 64 0d 04 a1  |ith NEXT, and...|
00001360  16 f4 20 31 31 35 30 20  77 69 74 68 20 55 4e 54  |.. 1150 with UNT|
00001370  49 4c 2e 0d 04 a6 10 f2  74 65 78 74 3a e5 20 8d  |IL......text:. .|
00001380  54 68 45 0d 04 b0 0f f2  72 65 6d 3a e5 20 8d 54  |ThE.....rem:. .T|
00001390  68 45 0d 04 ba 46 66 6f  72 6e 65 78 74 3d 66 6f  |hE...Ffornext=fo|
000013a0  72 6e 65 78 74 2b 31 3a  f2 70 72 69 6e 74 28 73  |rnext+1:.print(s|
000013b0  70 61 63 65 2c 64 65 63  6f 64 65 29 3a f2 70 72  |pace,decode):.pr|
000013c0  69 6e 74 28 73 70 61 63  65 2c 64 65 63 6f 64 65  |int(space,decode|
000013d0  29 3a e5 20 8d 64 6c 44  0d 04 c4 25 69 6e 64 65  |):. .dlD...%inde|
000013e0  6e 74 3d 69 6e 64 65 6e  74 2d 32 3a f2 73 74 61  |nt=indent-2:.sta|
000013f0  72 74 6c 69 6e 65 3a e5  20 8d 64 6c 44 0d 04 ce  |rtline:. .dlD...|
00001400  48 72 65 70 75 6e 74 69  6c 3d 72 65 70 75 6e 74  |Hrepuntil=repunt|
00001410  69 6c 2b 31 3a f2 70 72  69 6e 74 28 73 70 61 63  |il+1:.print(spac|
00001420  65 2c 64 65 63 6f 64 65  29 3a f2 70 72 69 6e 74  |e,decode):.print|
00001430  28 73 70 61 63 65 2c 64  65 63 6f 64 65 29 3a e5  |(space,decode):.|
00001440  20 8d 64 6c 44 0d 04 d8  18 f2 63 68 65 63 6b 5f  | .dlD.....check_|
00001450  63 6f 6d 6d 61 73 3a e5  20 8d 64 6c 44 0d 04 e2  |commas:. .dlD...|
00001460  31 72 65 70 75 6e 74 69  6c 3d 72 65 70 75 6e 74  |1repuntil=repunt|
00001470  69 6c 2d 31 3a e7 20 72  65 70 75 6e 74 69 6c 3c  |il-1:. repuntil<|
00001480  30 20 8c 20 72 65 70 75  6e 74 69 6c 3d 30 0d 04  |0 . repuntil=0..|
00001490  ec 3a e7 20 63 68 61 72  3d 6c 69 6e 65 6e 6f 20  |.:. char=lineno |
000014a0  8c 20 f2 6c 69 6e 65 6e  6f 28 42 25 2b 4b 25 2b  |. .lineno(B%+K%+|
000014b0  31 29 20 8b 20 f2 70 72  69 6e 74 28 63 68 61 72  |1) . .print(char|
000014c0  2c 64 65 63 6f 64 65 29  0d 04 f6 16 61 3d a7 74  |,decode)....a=.t|
000014d0  65 73 74 32 24 2c bd 28  63 68 61 72 29 29 0d 05  |est2$,.(char))..|
000014e0  00 24 ee 20 61 2b 31 20  e5 20 8d 54 68 45 2c 8d  |.$. a+1 . .ThE,.|
000014f0  54 5e 45 2c 8d 54 4a 45  2c 8d 54 54 45 2c 8d 54  |T^E,.TJE,.TTE,.T|
00001500  59 45 0d 05 01 23 f4 20  31 32 39 30 20 64 65 61  |YE...#. 1290 dea|
00001510  6c 73 20 77 69 74 68 20  49 46 2c 20 31 33 30 30  |ls with IF, 1300|
00001520  20 77 69 74 68 0d 05 02  21 f4 20 45 4c 53 45 2c  | with...!. ELSE,|
00001530  20 31 33 31 30 20 54 48  45 4e 2c 20 31 33 30 35  | 1310 THEN, 1305|
00001540  20 63 6f 6c 6f 6e 0d 05  0a 1a 69 6e 64 65 6e 74  | colon....indent|
00001550  3d 69 6e 64 65 6e 74 2b  32 3a e5 20 8d 54 68 45  |=indent+2:. .ThE|
00001560  0d 05 14 13 69 6e 64 65  6e 74 3d 69 6e 64 65 6e  |....indent=inden|
00001570  74 2b 32 0d 05 19 2a e7  20 61 3d 34 20 8c 20 f2  |t+2...*. a=4 . .|
00001580  73 74 72 69 70 73 70 61  63 65 73 3a e7 20 4b 25  |stripspaces:. K%|
00001590  3e 3d 4c 25 2d 31 20 8c  20 8d 54 68 45 0d 05 1e  |>=L%-1 . .ThE...|
000015a0  0e f2 73 74 61 72 74 6c  69 6e 65 0d 05 28 1b fd  |..startline..(..|
000015b0  20 4b 25 3e 3d 4c 25 2d  31 20 84 20 63 68 61 72  | K%>=L%-1 . char|
000015c0  3d 63 6f 6c 6f 6e 0d 05  32 05 e1 0d 05 3c 05 20  |=colon..2....<. |
000015d0  0d 05 46 05 20 0d 05 50  1d f4 20 45 58 45 43 55  |..F. ..P.. EXECU|
000015e0  54 45 20 41 20 2a 20 49  4e 53 54 52 55 43 54 49  |TE A * INSTRUCTI|
000015f0  4f 4e 0d 05 51 1e f4 20  41 25 20 70 6f 69 6e 74  |ON..Q.. A% point|
00001600  20 74 6f 20 61 20 73 6d  61 6c 6c 20 74 65 78 74  | to a small text|
00001610  0d 05 52 20 f4 20 62 75  66 66 65 72 20 77 68 65  |..R . buffer whe|
00001620  72 65 20 74 68 65 20 2a  20 63 6f 6d 6d 61 6e 64  |re the * command|
00001630  0d 05 53 10 f4 20 69 73  20 70 6c 61 63 65 64 2e  |..S.. is placed.|
00001640  0d 05 5a 05 20 0d 05 64  0f dd f2 6f 73 63 6c 69  |..Z. ..d...oscli|
00001650  28 41 24 29 0d 05 6e 0a  24 41 25 3d 41 24 0d 05  |(A$)..n.$A%=A$..|
00001660  78 0f 58 25 3d 41 25 20  83 20 32 35 36 0d 05 82  |x.X%=A% . 256...|
00001670  0f 59 25 3d 41 25 20 81  20 32 35 36 0d 05 8c 0b  |.Y%=A% . 256....|
00001680  d6 20 26 46 46 46 37 0d  05 96 05 e1 0d 05 a0 05  |. &FFF7.........|
00001690  20 0d 05 aa 05 20 0d 05  b4 1a f4 20 44 45 43 4f  | .... ..... DECO|
000016a0  44 45 20 41 20 4c 49 4e  45 20 4e 55 4d 42 45 52  |DE A LINE NUMBER|
000016b0  0d 05 b5 1f f4 20 4c 69  6e 65 20 6e 75 6d 62 65  |..... Line numbe|
000016c0  72 73 20 75 73 65 64 20  62 79 20 47 4f 54 4f 0d  |rs used by GOTO.|
000016d0  05 b6 1b f4 20 47 4f 53  55 42 20 61 72 65 20 73  |.... GOSUB are s|
000016e0  74 6f 72 65 64 20 69 6e  20 61 0d 05 b7 1e f4 20  |tored in a..... |
000016f0  73 70 65 63 69 61 6c 20  66 6f 72 6d 61 74 20 6f  |special format o|
00001700  66 20 61 20 6c 69 6e 65  0d 05 b8 23 f4 20 6e 75  |f a line...#. nu|
00001710  6d 62 65 72 20 66 6c 61  67 20 66 6f 6c 6c 6f 77  |mber flag follow|
00001720  65 64 20 62 79 20 74 68  72 65 65 0d 05 b9 24 f4  |ed by three...$.|
00001730  20 62 79 74 65 73 2e 20  20 20 54 68 69 73 20 69  | bytes.   This i|
00001740  73 20 74 6f 20 61 76 6f  69 64 20 65 61 63 68 0d  |s to avoid each.|
00001750  05 ba 20 f4 20 62 79 74  65 20 62 65 69 6e 67 20  |.. . byte being |
00001760  3e 31 32 37 20 6f 72 20  3c 33 32 20 61 6e 64 0d  |>127 or <32 and.|
00001770  05 bb 22 f4 20 68 65 6e  63 65 20 70 6f 73 73 69  |..". hence possi|
00001780  62 6c 79 20 62 65 69 6e  67 20 64 65 63 6f 64 65  |bly being decode|
00001790  64 0d 05 bc 23 f4 20 62  79 20 42 41 53 49 43 20  |d...#. by BASIC |
000017a0  61 73 20 61 20 63 6f 6e  74 72 6f 6c 20 63 6f 64  |as a control cod|
000017b0  65 20 6f 72 0d 05 bd 16  f4 20 61 20 42 41 53 49  |e or..... a BASI|
000017c0  43 20 6b 65 79 77 6f 72  64 21 0d 05 be 05 20 0d  |C keyword!.... .|
000017d0  05 c8 10 dd f2 6c 69 6e  65 6e 6f 28 41 25 29 0d  |.....lineno(A%).|
000017e0  05 d2 13 ea 20 44 31 25  2c 44 32 25 2c 44 33 25  |.... D1%,D2%,D3%|
000017f0  2c 4c 0d 05 dc 16 44 31  25 3d 20 28 28 41 25 3f  |,L....D1%= ((A%?|
00001800  31 29 80 20 26 33 46 29  0d 05 e6 16 44 32 25 3d  |1). &3F)....D2%=|
00001810  20 28 28 41 25 3f 32 29  80 20 26 33 46 29 0d 05  | ((A%?2). &3F)..|
00001820  f0 14 44 33 25 3d 20 28  3f 41 25 29 20 82 20 26  |..D3%= (?A%) . &|
00001830  35 34 0d 05 fa 30 4c 3d  20 44 32 25 2a 32 35 36  |54...0L= D2%*256|
00001840  2b 44 31 25 2b 28 44 33  25 80 20 34 29 2a 32 35  |+D1%+(D3%. 4)*25|
00001850  36 2a 31 36 20 2b 28 44  33 25 20 80 20 34 38 29  |6*16 +(D3% . 48)|
00001860  2a 34 0d 06 04 25 e7 20  51 25 2b a9 28 c3 28 4c  |*4...%. Q%+.(.(L|
00001870  29 29 2a 6d 6f 64 65 3e  52 25 20 8c 20 f2 73 74  |))*mode>R% . .st|
00001880  61 72 74 6c 69 6e 65 0d  06 0e 08 f1 20 4c 3b 0d  |artline..... L;.|
00001890  06 18 0b 4b 25 3d 4b 25  2b 33 0d 06 22 16 51 25  |...K%=K%+3..".Q%|
000018a0  3d 51 25 2b a9 28 c3 28  4c 29 29 2a 6d 6f 64 65  |=Q%+.(.(L))*mode|
000018b0  0d 06 2c 05 e1 0d 06 36  05 20 0d 06 40 05 20 0d  |..,....6. ..@. .|
000018c0  06 4a 27 f4 20 43 48 45  43 4b 20 41 20 4e 45 58  |.J'. CHECK A NEX|
000018d0  54 20 53 54 41 54 45 4d  45 4e 54 20 46 4f 52 20  |T STATEMENT FOR |
000018e0  43 4f 4d 4d 41 53 0d 06  4b 1d f4 20 41 20 6e 65  |COMMAS..K.. A ne|
000018f0  78 74 20 73 74 61 74 65  6d 65 6e 74 20 6d 61 79  |xt statement may|
00001900  20 62 65 0d 06 4c 1d f4  20 66 6f 6c 6c 6f 77 65  | be..L.. followe|
00001910  64 20 62 79 20 6f 6e 65  20 6f 72 20 6d 6f 72 65  |d by one or more|
00001920  0d 06 4d 25 f4 20 76 61  72 69 61 62 6c 65 73 2c  |..M%. variables,|
00001930  20 73 65 70 61 72 61 74  65 64 20 62 79 20 63 6f  | separated by co|
00001940  6d 6d 61 73 2e 0d 06 4e  22 f4 20 42 79 20 63 6f  |mmas...N". By co|
00001950  75 6e 74 69 6e 67 20 66  6f 72 77 61 72 64 73 20  |unting forwards |
00001960  74 68 72 6f 75 67 68 0d  06 4f 21 f4 20 74 68 65  |through..O!. the|
00001970  20 63 6f 6d 6d 61 73 20  77 65 20 6b 6e 6f 77 20  | commas we know |
00001980  68 6f 77 20 6d 61 6e 79  0d 06 50 1f f4 20 4e 45  |how many..P.. NE|
00001990  58 54 73 20 68 61 76 65  20 62 65 65 65 6e 20 69  |XTs have beeen i|
000019a0  6d 70 6c 69 65 64 2e 0d  06 51 1b f4 20 50 53 20  |mplied...Q.. PS |
000019b0  74 61 6b 65 20 63 61 72  65 20 74 6f 20 61 76 6f  |take care to avo|
000019c0  69 64 0d 06 52 14 f4 20  27 6f 75 74 64 65 6e 74  |id..R.. 'outdent|
000019d0  69 6e 67 27 20 21 0d 06  54 05 20 0d 06 5e 13 dd  |ing' !..T. ..^..|
000019e0  20 f2 63 68 65 63 6b 5f  63 6f 6d 6d 61 73 0d 06  | .check_commas..|
000019f0  68 15 66 6f 72 6e 65 78  74 3d 66 6f 72 6e 65 78  |h.fornext=fornex|
00001a00  74 2d 31 0d 06 72 0a 70  6f 73 3d 4b 25 0d 06 7c  |t-1..r.pos=K%..||
00001a10  05 f5 0d 06 86 0d 70 6f  73 3d 70 6f 73 2b 31 0d  |......pos=pos+1.|
00001a20  06 90 26 e7 20 42 25 3f  70 6f 73 3d 63 6f 6d 6d  |..&. B%?pos=comm|
00001a30  61 20 8c 20 66 6f 72 6e  65 78 74 3d 66 6f 72 6e  |a . fornext=forn|
00001a40  65 78 74 2d 31 0d 06 9a  2d fd 20 42 25 3f 70 6f  |ext-1...-. B%?po|
00001a50  73 3d 63 6f 6c 6f 6e 20  84 20 70 6f 73 3d 4c 25  |s=colon . pos=L%|
00001a60  2d 31 20 84 20 42 25 3f  70 6f 73 3d 72 65 74 75  |-1 . B%?pos=retu|
00001a70  72 6e 0d 06 a4 1b e7 20  66 6f 72 6e 65 78 74 3c  |rn..... fornext<|
00001a80  30 20 8c 20 66 6f 72 6e  65 78 74 3d 30 0d 06 ae  |0 . fornext=0...|
00001a90  05 e1 0d 06 b8 05 20 0d  06 c2 05 20 0d 06 cc 2f  |...... .... .../|
00001aa0  f4 20 49 4e 44 45 4e 54  20 54 48 45 20 4d 41 52  |. INDENT THE MAR|
00001ab0  47 49 4e 20 54 48 45 20  43 4f 52 52 45 43 54 20  |GIN THE CORRECT |
00001ac0  23 20 4f 46 20 53 50 41  43 45 53 0d 06 cd 23 f4  |# OF SPACES...#.|
00001ad0  20 55 73 65 64 20 74 6f  20 73 70 6c 69 74 20 6d  | Used to split m|
00001ae0  75 6c 74 69 70 6c 65 20  73 74 61 74 65 2d 0d 06  |ultiple state-..|
00001af0  ce 1a f4 20 6d 65 6e 74  73 20 6f 72 20 6c 6f 6e  |... ments or lon|
00001b00  67 20 6c 69 6e 65 73 2e  0d 06 cf 20 f4 20 46 4f  |g lines.... . FO|
00001b10  52 2f 4e 45 58 54 20 52  45 50 45 41 54 2f 55 4e  |R/NEXT REPEAT/UN|
00001b20  54 49 4c 20 61 6e 64 20  0d 06 d0 1d f4 20 49 46  |TIL and ..... IF|
00001b30  2f 54 48 45 4e 2f 45 4c  53 45 20 73 74 61 74 65  |/THEN/ELSE state|
00001b40  6d 65 6e 74 73 0d 06 d1  25 f4 20 61 72 65 20 61  |ments...%. are a|
00001b50  6c 6c 20 69 6e 64 65 6e  74 65 64 20 62 79 20 74  |ll indented by t|
00001b60  77 6f 20 73 70 61 63 65  73 2e 0d 06 d2 21 f4 20  |wo spaces....!. |
00001b70  54 68 65 20 65 66 66 65  63 74 73 20 6f 66 20 69  |The effects of i|
00001b80  6e 64 65 6e 74 69 6e 67  20 61 6e 0d 06 d3 25 f4  |ndenting an...%.|
00001b90  20 49 46 20 73 74 61 74  65 6d 65 6e 74 20 61 72  | IF statement ar|
00001ba0  65 20 6f 6e 6c 79 20 65  66 66 65 63 74 69 76 65  |e only effective|
00001bb0  0d 06 d4 23 f4 20 66 6f  72 20 74 68 65 20 63 75  |...#. for the cu|
00001bc0  72 72 65 6e 74 20 70 72  6f 67 72 61 6d 20 6c 69  |rrent program li|
00001bd0  6e 65 2e 0d 06 d6 05 20  0d 06 e0 10 dd 20 f2 73  |ne..... ..... .s|
00001be0  74 61 72 74 6c 69 6e 65  0d 06 ea 05 f1 0d 06 f4  |tartline........|
00001bf0  19 e7 20 69 6e 64 65 6e  74 3c 30 20 8c 20 69 6e  |.. indent<0 . in|
00001c00  64 65 6e 74 3d 30 0d 06  fe 28 6d 61 72 67 69 6e  |dent=0...(margin|
00001c10  3d 36 2b 32 2a 66 6f 72  6e 65 78 74 2b 32 2a 72  |=6+2*fornext+2*r|
00001c20  65 70 75 6e 74 69 6c 2b  69 6e 64 65 6e 74 0d 07  |epuntil+indent..|
00001c30  08 19 e7 20 6d 61 72 67  69 6e 3c 36 20 8c 20 6d  |... margin<6 . m|
00001c40  61 72 67 69 6e 3d 36 0d  07 12 13 f1 20 c4 6d 61  |argin=6..... .ma|
00001c50  72 67 69 6e 2c 22 20 22  29 3b 0d 07 1c 0d 51 25  |rgin," ");....Q%|
00001c60  3d 6d 61 72 67 69 6e 0d  07 26 10 f2 73 74 72 69  |=margin..&..stri|
00001c70  70 73 70 61 63 65 73 0d  07 3a 0f 6d 6f 64 65 3d  |pspaces..:.mode=|
00001c80  73 69 6e 67 6c 65 0d 07  44 05 e1 0d 07 4e 05 20  |single..D....N. |
00001c90  0d 07 58 05 20 0d 07 62  13 f4 20 45 52 52 4f 52  |..X. ..b.. ERROR|
00001ca0  20 53 45 43 54 49 4f 4e  0d 07 63 23 f4 20 45 73  | SECTION..c#. Es|
00001cb0  63 61 70 65 20 77 69 6c  6c 20 63 61 75 73 65 20  |cape will cause |
00001cc0  61 6e 20 65 78 69 74 20  74 6f 20 0d 07 64 24 f4  |an exit to ..d$.|
00001cd0  20 74 68 69 73 20 73 65  63 74 69 6f 6e 2c 20 61  | this section, a|
00001ce0  73 20 77 69 6c 6c 20 61  6e 20 65 72 72 6f 72 0d  |s will an error.|
00001cf0  07 65 24 f4 20 69 6e 20  74 68 65 20 70 72 6f 67  |.e$. in the prog|
00001d00  72 61 6d 20 2d 20 77 68  69 63 68 20 77 69 6c 6c  |ram - which will|
00001d10  20 62 65 0d 07 66 22 f4  20 72 65 70 6f 72 74 65  | be..f". reporte|
00001d20  64 2e 20 20 20 59 6f 75  20 61 72 65 20 61 73 6b  |d.   You are ask|
00001d30  65 64 20 69 66 0d 07 67  24 f4 20 79 6f 75 20 77  |ed if..g$. you w|
00001d40  69 73 68 20 61 6e 6f 74  68 65 72 20 67 6f 2e 20  |ish another go. |
00001d50  20 20 42 65 63 61 75 73  65 0d 07 68 21 f4 20 61  |  Because..h!. a|
00001d60  6e 20 65 72 72 6f 72 20  6d 69 67 68 74 20 68 61  |n error might ha|
00001d70  70 70 65 6e 20 77 68 69  6c 65 0d 07 69 24 f4 20  |ppen while..i$. |
00001d80  73 65 74 74 69 6e 67 20  74 68 69 6e 67 73 20 75  |setting things u|
00001d90  70 2c 20 74 68 65 20 70  72 6f 67 72 61 6d 0d 07  |p, the program..|
00001da0  6a 22 f4 20 77 69 6c 6c  20 68 61 76 65 20 74 6f  |j". will have to|
00001db0  20 62 65 20 52 55 4e 20  61 67 61 69 6e 20 69 66  | be RUN again if|
00001dc0  0d 07 6b 1f f4 20 74 68  65 20 65 72 72 6f 72 20  |..k.. the error |
00001dd0  68 61 70 70 65 6e 65 64  20 74 68 65 72 65 2e 0d  |happened there..|
00001de0  07 6c 05 20 0d 07 76 07  d9 23 30 0d 07 80 0a ef  |.l. ..v..#0.....|
00001df0  20 31 32 2c 33 0d 07 8a  1e e7 20 9f 3c 3e 31 37  | 12,3..... .<>17|
00001e00  20 8c 20 f6 3a f1 22 20  61 74 20 6c 69 6e 65 20  | . .:." at line |
00001e10  22 3b 9e 0d 07 94 18 e8  27 27 22 41 4e 4f 54 48  |";......''"ANOTH|
00001e20  45 52 20 47 4f 20 3f 22  2c 59 24 0d 07 9e 14 e7  |ER GO ?",Y$.....|
00001e30  20 c0 59 24 2c 31 29 3d  22 4e 22 20 8c 20 e0 0d  | .Y$,1)="N" . ..|
00001e40  07 a8 0f e7 20 9e 3c 33  37 30 20 8c 20 f9 0d 07  |.... .<370 . ...|
00001e50  b2 0a e5 20 8d 44 7c 41  0d 07 bc 05 20 0d 07 c6  |... .D|A.... ...|
00001e60  05 20 0d 07 d0 1e f4 20  47 45 54 20 41 20 4c 49  |. ..... GET A LI|
00001e70  4e 45 20 46 52 4f 4d 20  54 48 45 20 46 49 4c 45  |NE FROM THE FILE|
00001e80  0d 07 d1 21 f4 20 54 68  65 20 6c 69 6e 65 20 66  |...!. The line f|
00001e90  6f 72 6d 61 74 20 69 73  20 63 68 61 72 2e 20 31  |ormat is char. 1|
00001ea0  33 0d 07 d2 23 f4 20 66  6f 6c 6c 6f 77 65 64 20  |3...#. followed |
00001eb0  62 79 20 6c 69 6e 65 20  6e 6f 20 28 68 69 20 62  |by line no (hi b|
00001ec0  79 74 65 29 0d 07 d3 21  f4 20 49 66 20 74 68 65  |yte)...!. If the|
00001ed0  20 68 69 20 62 79 74 65  20 69 73 20 3e 31 32 37  | hi byte is >127|
00001ee0  20 74 68 61 74 0d 07 d4  23 f4 20 6d 61 72 6b 73  | that...#. marks|
00001ef0  20 74 68 65 20 65 6e 64  20 6f 66 20 74 68 65 20  | the end of the |
00001f00  70 72 6f 67 72 61 6d 2e  0d 07 d5 21 f4 20 49 66  |program....!. If|
00001f10  20 61 6c 6c 20 69 73 20  77 65 6c 6c 2c 20 74 68  | all is well, th|
00001f20  65 20 6c 69 6e 65 20 6e  6f 0d 07 d6 1f f4 20 28  |e line no..... (|
00001f30  6c 6f 20 62 79 74 65 29  20 61 6e 64 20 6c 69 6e  |lo byte) and lin|
00001f40  65 20 6c 65 6e 67 74 68  0d 07 d7 23 f4 20 66 6f  |e length...#. fo|
00001f50  6c 6c 6f 77 2c 20 61 6e  64 20 74 68 65 6e 20 74  |llow, and then t|
00001f60  68 65 20 63 6f 64 65 20  66 6f 72 0d 07 d8 1b f4  |he code for.....|
00001f70  20 74 68 61 74 20 6c 69  6e 65 20 6f 66 20 70 72  | that line of pr|
00001f80  6f 67 72 61 6d 2e 0d 07  da 05 20 0d 07 e4 13 dd  |ogram..... .....|
00001f90  f2 6c 6f 61 64 6c 69 6e  65 28 62 75 66 29 0d 07  |.loadline(buf)..|
00001fa0  ee 09 ea 20 61 2c 62 0d  07 f8 09 61 3d 9a 23 58  |... a,b....a=.#X|
00001fb0  0d 08 02 0a 3f 62 75 66  3d 61 0d 08 0c 09 62 3d  |....?buf=a....b=|
00001fc0  9a 23 58 0d 08 16 0b 62  75 66 3f 31 3d 62 0d 08  |.#X....buf?1=b..|
00001fd0  20 0f e7 20 61 3c 3e 31  33 20 8c 20 e1 0d 08 2a  | .. a<>13 . ...*|
00001fe0  0f e7 20 62 3e 31 32 37  20 8c 20 e1 0d 08 34 0d  |.. b>127 . ...4.|
00001ff0  62 75 66 3f 32 3d 9a 23  58 0d 08 3e 09 61 3d 9a  |buf?2=.#X..>.a=.|
00002000  23 58 0d 08 48 0b 62 75  66 3f 33 3d 61 0d 08 52  |#X..H.buf?3=a..R|
00002010  0f e3 20 62 3d 34 20 b8  20 61 2d 31 0d 08 5c 0d  |.. b=4 . a-1..\.|
00002020  62 75 66 3f 62 3d 9a 23  58 0d 08 66 07 ed 20 62  |buf?b=.#X..f.. b|
00002030  0d 08 70 0c 62 75 66 3f  61 3d 31 33 0d 08 7a 05  |..p.buf?a=13..z.|
00002040  e1 0d 08 84 05 20 0d 08  8e 05 20 0d 08 98 1f f4  |..... .... .....|
00002050  20 49 47 4e 4f 52 45 20  41 4e 59 20 4c 45 41 44  | IGNORE ANY LEAD|
00002060  49 4e 47 20 53 50 41 43  45 53 0d 08 a2 1c f4 20  |ING SPACES..... |
00002070  41 54 20 54 48 45 20 53  54 41 52 54 20 4f 46 20  |AT THE START OF |
00002080  41 20 4c 49 4e 45 0d 08  a3 23 f4 20 54 68 65 20  |A LINE...#. The |
00002090  70 72 6f 67 72 61 6d 20  6f 72 67 61 6e 69 73 65  |program organise|
000020a0  73 20 69 74 73 20 6f 77  6e 0d 08 a4 25 f4 20 69  |s its own...%. i|
000020b0  6e 64 65 6e 74 61 74 69  6f 6e 20 73 6f 20 69 74  |ndentation so it|
000020c0  20 69 67 6e 6f 72 65 73  20 79 6f 75 72 73 0d 08  | ignores yours..|
000020d0  ac 05 20 0d 08 b6 12 dd  20 f2 73 74 72 69 70 73  |.. ..... .strips|
000020e0  70 61 63 65 73 0d 08 bb  13 e7 20 51 25 3e 6d 61  |paces..... Q%>ma|
000020f0  72 67 69 6e 20 8c 20 e1  0d 08 c0 05 f5 0d 08 ca  |rgin . .........|
00002100  0b 4b 25 3d 4b 25 2b 31  0d 08 d4 1c fd 20 4b 25  |.K%=K%+1..... K%|
00002110  3e 3d 4c 25 2d 31 20 84  20 42 25 3f 4b 25 3e 73  |>=L%-1 . B%?K%>s|
00002120  70 61 63 65 0d 08 d9 0b  4b 25 3d 4b 25 2d 31 0d  |pace....K%=K%-1.|
00002130  08 de 05 e1 0d 08 e8 05  20 0d 08 f2 05 20 0d 08  |........ .... ..|
00002140  fc 1c f4 20 47 45 54 20  54 48 45 20 4e 45 58 54  |... GET THE NEXT|
00002150  20 43 48 41 52 41 43 54  45 52 0d 08 fd 23 f4 20  | CHARACTER...#. |
00002160  52 65 74 75 72 6e 20 61  20 73 70 61 63 65 20 69  |Return a space i|
00002170  66 20 6f 66 66 20 74 68  65 20 65 6e 64 0d 08 fe  |f off the end...|
00002180  22 f4 20 6f 66 20 74 68  65 20 6c 69 6e 65 2c 20  |". of the line, |
00002190  6f 72 20 69 66 20 74 68  65 20 63 68 61 72 2e 0d  |or if the char..|
000021a0  08 ff 23 f4 20 77 61 73  20 61 20 63 6f 6e 74 72  |..#. was a contr|
000021b0  6f 6c 20 63 6f 64 65 2e  20 54 68 75 73 20 6d 61  |ol code. Thus ma|
000021c0  6e 79 0d 09 00 21 f4 20  75 6e 6c 69 73 74 61 62  |ny...!. unlistab|
000021d0  6c 65 20 70 72 6f 67 72  61 6d 73 20 61 72 65 20  |le programs are |
000021e0  6e 6f 77 0d 09 01 0f f4  20 6c 69 73 74 61 62 6c  |now..... listabl|
000021f0  65 21 0d 09 06 05 20 0d  09 10 0f dd 20 f2 6e 65  |e!.... ..... .ne|
00002200  78 74 63 68 61 72 0d 09  1a 0b 4b 25 3d 4b 25 2b  |xtchar....K%=K%+|
00002210  31 0d 09 24 27 e7 20 4b  25 3e 4c 25 2d 31 20 8c  |1..$'. K%>L%-1 .|
00002220  20 63 68 61 72 3d 73 70  61 63 65 20 8b 20 63 68  | char=space . ch|
00002230  61 72 3d 42 25 3f 4b 25  0d 09 2e 1d e7 20 63 68  |ar=B%?K%..... ch|
00002240  61 72 3c 73 70 61 63 65  20 8c 20 63 68 61 72 3d  |ar<space . char=|
00002250  73 70 61 63 65 0d 09 38  05 e1 0d 09 42 05 20 0d  |space..8....B. .|
00002260  09 4c 05 20 0d 09 56 1f  f4 20 44 45 41 4c 20 57  |.L. ..V.. DEAL W|
00002270  49 54 48 20 41 20 52 45  4d 20 53 54 41 54 45 4d  |ITH A REM STATEM|
00002280  45 4e 54 0d 09 57 22 f4  20 54 68 65 20 72 65 73  |ENT..W". The res|
00002290  74 20 6f 66 20 74 68 65  20 6c 69 6e 65 20 77 69  |t of the line wi|
000022a0  6c 6c 20 62 65 0d 09 58  21 f4 20 74 72 65 61 74  |ll be..X!. treat|
000022b0  65 64 20 61 73 20 74 65  78 74 2c 20 62 75 74 20  |ed as text, but |
000022c0  69 74 20 6d 61 79 0d 09  59 23 f4 20 69 6e 63 6c  |it may..Y#. incl|
000022d0  75 64 65 20 42 41 53 49  43 20 6b 65 79 77 6f 72  |ude BASIC keywor|
000022e0  64 73 2c 20 77 68 69 63  68 0d 09 5a 19 f4 20 68  |ds, which..Z.. h|
000022f0  61 76 65 20 74 6f 20 62  65 20 64 65 63 6f 64 65  |ave to be decode|
00002300  64 2e 0d 09 60 05 20 0d  09 6a 0a dd 20 f2 72 65  |d...`. ..j.. .re|
00002310  6d 0d 09 74 17 f2 70 72  69 6e 74 28 63 68 61 72  |m..t..print(char|
00002320  2c 64 65 63 6f 64 65 29  0d 09 7e 05 f5 0d 09 88  |,decode)..~.....|
00002330  0d f2 6e 65 78 74 63 68  61 72 0d 09 92 2e e7 20  |..nextchar..... |
00002340  63 68 61 72 3d 71 75 6f  74 65 20 8c 20 f2 74 65  |char=quote . .te|
00002350  78 74 20 8b 20 f2 70 72  69 6e 74 28 63 68 61 72  |xt . .print(char|
00002360  2c 64 65 63 6f 64 65 29  0d 09 9c 0e fd 20 4b 25  |,decode)..... K%|
00002370  3e 3d 4c 25 2d 31 0d 09  a6 05 e1 0d 09 b0 05 20  |>=L%-1......... |
00002380  0d 09 ba 05 20 0d 09 c4  23 f4 20 44 45 41 4c 20  |.... ...#. DEAL |
00002390  57 49 54 48 20 54 45 58  54 20 42 45 54 57 45 45  |WITH TEXT BETWEE|
000023a0  4e 20 51 55 4f 54 45 53  0d 09 c5 22 f4 20 70 72  |N QUOTES...". pr|
000023b0  69 6e 74 20 74 68 65 20  66 69 72 73 74 20 71 75  |int the first qu|
000023c0  6f 74 65 2c 20 74 68 65  6e 20 0d 09 c6 20 f4 20  |ote, then ... . |
000023d0  6b 65 65 70 20 6f 6e 20  70 72 69 6e 74 69 6e 67  |keep on printing|
000023e0  20 75 6e 74 69 6c 20 74  68 65 0d 09 c7 21 f4 20  | until the...!. |
000023f0  65 6e 64 20 6f 66 20 74  68 65 20 73 74 72 69 6e  |end of the strin|
00002400  67 20 69 73 20 66 6f 75  6e 64 2e 0d 09 c8 22 f4  |g is found....".|
00002410  20 47 75 61 72 64 20 61  67 61 69 6e 73 74 20 6d  | Guard against m|
00002420  69 73 73 69 6e 67 20 71  75 6f 74 65 73 0d 09 c9  |issing quotes...|
00002430  19 f4 20 61 74 20 74 68  65 20 65 6e 64 20 6f 66  |.. at the end of|
00002440  20 6c 69 6e 65 21 0d 09  ca 24 f4 20 44 6f 75 62  | line!...$. Doub|
00002450  6c 65 20 71 75 6f 74 65  73 20 61 72 65 20 6e 6f  |le quotes are no|
00002460  20 70 72 6f 62 6c 65 6d  20 2d 0d 09 cb 22 f4 20  | problem -...". |
00002470  77 65 20 74 6f 67 67 6c  65 20 6f 75 74 20 61 6e  |we toggle out an|
00002480  64 20 69 6e 20 74 6f 20  74 65 78 74 0d 09 cc 22  |d in to text..."|
00002490  f4 20 6d 6f 64 65 20 61  67 61 69 6e 2e 20 20 20  |. mode again.   |
000024a0  43 6f 64 65 73 20 3e 31  32 38 20 61 72 65 0d 09  |Codes >128 are..|
000024b0  cd 25 f4 20 74 65 6c 65  74 65 78 74 20 63 6f 6e  |.%. teletext con|
000024c0  74 72 6f 6c 20 2d 20 69  67 6e 6f 72 65 20 74 68  |trol - ignore th|
000024d0  65 6d 2e 0d 09 ce 05 20  0d 09 d8 0b dd 20 f2 74  |em..... ..... .t|
000024e0  65 78 74 0d 09 e2 19 f2  70 72 69 6e 74 28 63 68  |ext.....print(ch|
000024f0  61 72 2c ac 20 64 65 63  6f 64 65 29 0d 09 ec 05  |ar,. decode)....|
00002500  f5 0d 09 f6 0d f2 6e 65  78 74 63 68 61 72 0d 0a  |......nextchar..|
00002510  00 19 f2 70 72 69 6e 74  28 63 68 61 72 2c ac 20  |...print(char,. |
00002520  64 65 63 6f 64 65 29 0d  0a 0a 1b fd 20 4b 25 3e  |decode)..... K%>|
00002530  3d 4c 25 2d 31 20 84 20  63 68 61 72 3d 71 75 6f  |=L%-1 . char=quo|
00002540  74 65 0d 0a 14 05 e1 0d  0a 1e 05 20 0d 0a 28 05  |te......... ..(.|
00002550  20 0d 0a 32 1a f4 20 50  52 49 4e 54 20 41 20 43  | ..2.. PRINT A C|
00002560  48 41 52 41 43 54 45 52  20 4f 52 0d 0a 3c 15 f4  |HARACTER OR..<..|
00002570  20 43 4f 4d 50 52 45 53  53 45 44 20 43 4f 44 45  | COMPRESSED CODE|
00002580  0d 0a 3d 1d f4 20 4c 6f  67 69 63 61 6c 20 76 61  |..=.. Logical va|
00002590  72 69 61 62 6c 65 20 64  65 63 6f 64 65 0d 0a 3e  |riable decode..>|
000025a0  22 f4 20 69 6e 64 69 63  61 74 65 73 20 77 68 65  |". indicates whe|
000025b0  74 68 65 72 20 69 6e 20  70 72 6f 67 72 61 6d 0d  |ther in program.|
000025c0  0a 3f 23 f4 20 6f 72 20  74 65 78 74 20 6d 6f 64  |.?#. or text mod|
000025d0  65 20 2d 20 74 65 6c 65  74 65 78 74 20 63 6f 64  |e - teletext cod|
000025e0  65 73 0d 0a 40 23 f4 20  3e 31 32 38 20 63 61 6e  |es..@#. >128 can|
000025f0  20 63 6c 6f 67 20 75 70  20 74 68 65 20 70 72 69  | clog up the pri|
00002600  6e 74 65 72 2c 0d 0a 41  24 f4 20 73 6f 20 66 6f  |nter,..A$. so fo|
00002610  72 20 6e 65 61 74 6e 65  73 73 27 20 73 61 6b 65  |r neatness' sake|
00002620  2c 20 72 65 70 6c 61 63  65 0d 0a 42 15 f4 20 74  |, replace..B.. t|
00002630  68 65 6d 20 62 79 20 73  70 61 63 65 73 2e 0d 0a  |hem by spaces...|
00002640  43 24 f4 20 44 45 46 20  50 52 4f 43 20 61 6e 64  |C$. DEF PROC and|
00002650  20 46 4e 20 73 74 61 74  65 6d 65 6e 74 73 20 61  | FN statements a|
00002660  72 65 0d 0a 44 21 f4 20  70 72 69 6e 74 65 64 20  |re..D!. printed |
00002670  64 6f 75 62 6c 65 20 77  69 64 74 68 2c 20 73 6f  |double width, so|
00002680  20 62 65 0d 0a 45 24 f4  20 63 61 72 65 66 75 6c  | be..E$. careful|
00002690  20 61 62 6f 75 74 20 74  68 65 20 6c 69 6e 65 20  | about the line |
000026a0  6c 65 6e 67 74 68 2e 0d  0a 46 05 20 0d 0a 50 19  |length...F. ..P.|
000026b0  dd 20 f2 70 72 69 6e 74  28 63 68 61 72 2c 64 65  |. .print(char,de|
000026c0  63 6f 64 65 29 0d 0a 5a  0a ea 20 6c 2c 41 24 0d  |code)..Z.. l,A$.|
000026d0  0a 64 0e 41 24 3d bd 28  63 68 61 72 29 0d 0a 6e  |.d.A$=.(char)..n|
000026e0  07 6c 3d 31 0d 0a 78 3c  e7 20 64 65 63 6f 64 65  |.l=1..x<. decode|
000026f0  20 8c 20 e7 20 63 68 61  72 3e 70 72 69 6e 74 61  | . . char>printa|
00002700  62 6c 65 20 8c 20 41 24  3d 4e 41 4d 45 24 28 63  |ble . A$=NAME$(c|
00002710  68 61 72 2d 31 32 38 29  3a 6c 3d a9 28 41 24 29  |har-128):l=.(A$)|
00002720  0d 0a 82 2e e7 20 ac 20  64 65 63 6f 64 65 20 8c  |..... . decode .|
00002730  20 e7 20 28 63 68 61 72  20 83 20 31 32 38 29 3c  | . (char . 128)<|
00002740  73 70 61 63 65 20 8c 20  41 24 3d 22 20 22 0d 0a  |space . A$=" "..|
00002750  8c 1f e7 20 51 25 2b 6c  2a 6d 6f 64 65 3e 52 25  |... Q%+l*mode>R%|
00002760  20 8c 20 f2 73 74 61 72  74 6c 69 6e 65 0d 0a 96  | . .startline...|
00002770  43 e7 20 63 68 61 72 3d  64 65 66 69 6e 65 20 8c  |C. char=define .|
00002780  20 ef 20 38 2c 31 32 39  3a e7 20 c0 59 31 24 2c  | . 8,129:. .Y1$,|
00002790  31 29 3d 22 59 22 20 8c  20 6d 6f 64 65 3d 64 6f  |1)="Y" . mode=do|
000027a0  75 62 6c 65 3a ef 20 31  2c 33 32 2c 31 2c 31 34  |uble:. 1,32,1,14|
000027b0  0d 0a a0 09 f1 20 41 24  3b 0d 0a aa 10 51 25 3d  |..... A$;....Q%=|
000027c0  51 25 2b 6c 2a 6d 6f 64  65 0d 0a b4 05 e1 0d 0a  |Q%+l*mode.......|
000027d0  be 05 20 0d 0a c8 05 20  0d ff                    |.. .... ..|
000027da
07-02-88/LISTER3.m0
07-02-88/LISTER3.m1
07-02-88/LISTER3.m2
07-02-88/LISTER3.m4
07-02-88/LISTER3.m5