LnSOS BOOT 1.1 SOS.KERNEL SOS KRNLI/O ERRORFILE 'SOS.KERNEL' NOT FOUND%INVALID KERNEL FILE: xةw,@  ȱlmi8#)!)8 .d1/hello........."MENU.MAKER" (Version 4.55.1)=".d1":100: Coldstart 200: Warmstart (GOTO 30) (I=1L2(A$(I),A$))90<B$(J)=A$(I),1,31)!FJ/2<>J/2)=4:=+1:ۙ=44PB$(J);:J=J+1ZI:8dA$(1000),B$(1000),Ce&!1%*LORENZ.PIC4!@e%!.1 *MENU.MAKER  Ge%!4 %SEG.G v III.PCL.09u' )BGRAF.INV(e)!L+DISKNAME.DAT e0!b)FRAGMENTSe'!1&.FULLFEIGEN.PICU!@e&! .FULLMANDEL.PIC!@e%!9FULLTEXTSu >dLԡm#i㰼m#iЕOLԡȱfg hi !dLԡ憦  Ljmkm l y`2 Lԡ8(Je稽)ʈ@L%(511),C$(20),name$(20):=10:=0n: GOSUB 1120 x=+B$(I),16,B)140 PREFIX$=.D1 #1, ž#1180I=0I=I+1:#1;A$(I):170#1 L=I-1j=1:same=0:/#9,".D1/DISKNAME.DAT":#9;DISKNAME$:#9Ta$="{,|,~,}; 13П,2))-12;џ,6);:1580$"П,2))=0"12";џ,6);:ٟ;$,П,2))=>12" PM-":" AM-" 61630@WW=1390J=26:=21:1400 T1400 ^:WW=1:h |: CHANGE THE FONT".D1/downloa="FEBRUARY":1550M$="MARCH":1550M$="APRIL":1550M$="MAY":1550M$="JUNE":1550M$="JULY":1550M$="AUGUST":1550M$="SEPTEMBER":1550M$="OCTOBER":1550M$="NOVEMBER":1550M$="DECEMBER":1550826);"-";M$;" ";Ѡ,2)8=11010<9F=23:=0::"79C";"PRESS ANY KEY TO HALT LISTING":P2,280,2 Z1310dn"x ..... "DATE.TIME.LINE" ....M=Ҡ,4,2))BM1430,1440,1450,1460,1470,1480,1490,1500,1510,1520,1530,1540M$="JANUARY":1550M$SH$ SLOW FLASH :120#w=w+.5*(w=0):I=1(w*1000):: Halt Subroutine::=23:=0::"79C";"PRESS ANY KEY TO HALT LISTING.": 1300(=23:=0::"79C";"CONTINUE...?":'(<>89<>121<>78<>11013202=70#4,B$(I),16,B)#5,".PRINTER" $ž#4120 .#4;a$ 8#5;a$ B1070LV:=24:=0::-`#8,".D1/FLASHNAME.DAT":#9;FLASH$:#8%jFLASH=110: FLASHER SUBROUTINEtSLOW=110~FLASH/2=FLASH/2):۴ =11:=07 FLA:=".d1":=12:=0:120=+B$(I),16,B)1408A$(1000),B$(1000),C%(511),C$(20),name$(20):=10:=0 :120;::=23:=0::"79C";"WOULD YOU LIKE A HARD COPY?":1C$:C$<>"Y"C$<>"y"C$<>"N"C$<>"n"1010C$="N"C$="n"12C$<>"y"C$<>"N"C$<>"n"850\C$="N"C$="n"1000;f:=23:=0::"79C";"PRESS ANY KEY TO HALT LISTING": p840z2,280,21K:=23:=0::"79C";"TO PRINT OR RETURN TO MENU, HIT THE SPACE BAR":C$:C$<>" "930:ۺ1000 $(I),16,B)$=01:=0::"80C";A$;::12)E=23:=0::"79C";"PRESS ANY KEY TO HALT LISTING"::2,280,21 840#2,B$(I),16,B) ž#2910*#2;A$:A$:12304810 >:120*H:=23:=0::"79C";"CONTINUE...?":0RC$:C$<>"Y"B$(I),"BASIC 0")700B$(I),"TEXT 0")740B$(I),"CAT 0")960B$(I),"FONT 0")1660B$(I),"FOTO 0")1730400A$="RUNNING "+B$(I),16,B)"79C";A$;:=0B$(I),16,B):A$="LISTING "+BOS=44:I/2<>I/2)I=I+1&I2=-1:I=I-2:NIBOTM<30XTHPOS=44I=IBOTM/2)*2:=+IBOTM/2)-1:0b=+IBOTM/2-.5):I=IBOTM:I/2=I/2)I=I-1lvB=B$(I),16)," ")-10 =Q:WW=0A=:A=21A=9oldprefix$=A=31110A=27:=".D1":980A=13630=THPOS:B$(I);A<8A>11400A-7500,520,550,580:=THPOS:B$(I);:380: 500THPOS=4:I/2=I/2)I=I-1I=IBOTM THP="BASIC 0":40,A$="TEXT 0":406A$="CAT 0":40@A$="FONT 0":40JA$="FOTO 0":40TA$(L),"BLOCKS")370*^=27:=19:"FREE MEMORY AVAILABLE: ";h=7:=20:"80C";A$(L);$r:=5:THPOS=4:I=1:IBOTM=J-1:480|Q=:=26:=21:140> selects; sets Prefix to .D1; aborts."12);::"80C";a$;:d$=DISKNAME$$=23:=0::"80C";d$;::12)1,180,22F=3:=14:"This /// SIG Disk is \^ 1991, Washington Apple `, Ltd."=4:B$(1)="":B$(2)="""A$d.inv"C$=B$(I),16,B)array$="C%"name$=34)+C$+34)getfont(@name$,@array$)loadfont(@array$)30#5,".GRAFIX"".D1/BGRAF.INV"D$=B$(I),16,B)name$=34)+D$+34) GLOAD.D$16);1) GRAFIXONX=12000:X::RELEASE:#530%& Menu.Maker v. 4.55.1 (side two)p{ )hH =)  |?Bo+ 5,h0 *ht|$LH,@ 5, +)$ x~xpw @= ``~x`@ !"#$%&'()*+,-./012B?'  x(X#x(" pg <CHAOS PROGRAMS BY C.M. DAVIDSON ~+3||`~x**L+r?3*x~,jL%` `L" `@=pwgZ~x `xj^) @ 8f |ht(J|?p{||~?r`~x chx?||`|~@}?}?|~@`||?? ?+:.Pxh@`x\adgB?uter, In@~ @@#i @@@ʐi`@` @@Lj8`?@@@]@@@@h_@@^` i@@p@^ڍ^0@@@jΕ@x@@*)`@@@@^ڍ^h@xh@* gfI~0@?@@0 J@@|@@))M?@}@@k` H@q~|@p'@cccc@ ?@@թ]j@@ @,@@@}?A@)]8}/| ^]@@] `]ֆ׆` ^`t^L ` `|8}/980 ApplPP  pgUUUUUUffx@v`@<@Ͻ]`@?@@8I@@@ ,j @x|@@-^ km,@?@~0@ple Comp@xh@h@@@@@,AZ0LpZ@x@@@@@)p@@@-,@h_@@ehp{@@@@@?@i0 ("@` @`@@@@ҥ@~ @@8` a@?@@'<@v`@@#@x|@@ 꽌@@@Н݌@@'@983. Di@p@@@@\@@ y@~@@ @@@@pp@@@pp@@ruz@@@9?CG@~@y@11@\@@@@p@@IE1p'@@@JJ` @}@?@@|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2P|b oHtR1 'A  "D@JJ` @@f) 0&`c8qL@gg M U`D1 H @+hS ,j @W>Y"A%2l @P`@@&2c@b-^ km,@ tp^ b61@@1A`y:Ko $d TAϽ]`@~aab z7p\IhwA!&<f8I@|__6wG9qaP0 CAOM]&!S S(/pTA D#i@@W!06* P b@A&0*# (1(@ʐiwM>0Ptlz>qPc"(F5T(!B@Lj8`xw'rSchS"81slb@Tz )T" Y@]@o9 ;M 2L$j"Pd  L@dehp{@\S00Q CQC@"(`Ag_I D4H$@K@oR`nC+PH4@cc$L[Uld TA)}?7fo[F( #@J 0*@,@SA`M0H-,O^uvFULLTEXTSve&' '/FEIGENPROG.TEXTx e&. u/LORENZPROG.TEXT e'.) u/MANDELPROG.TEXT e'.+ u*SHELL.TEXTe&.6 uw.=P6'R `AhVA?T 4c*Wb F5@ @vvsr<hDTR8NFHHlIU4  @' @aQRv )v@oSIb(F *Q@"@ Q P (C$@@A0j?yYPLyJ0T2"@,@HhPTTDb0Xczj @D zRu(A' `@GD,9D6"P@B@|8@HAEGaErX H LaH'EhX'!`Le@pwn9MJsQU=0%@ I$phxLcK<M RP-_:!FA4`Q d__r4$D!t`o@H6 P3P4FbJ@ ``o{_n(1vC3HD%"Ja8bwUBCr\tv`A"9N@(``@`c0xG@UR$BqJ9P`F?$Pb@PD Ojxx;gd2D`Ha` ptbB@x#,D? PSQb$@TPLoG D4"!@@@pWF1~_{ S($2RIS Pe` !Do$ (@pyw0N YvRQQ~IdP"P/B0bAple Comp@NRH9*(!,D"@@a|pfY&-@,$u|$/O9(F@ w`xJ$QE4"J@,AZ0LpZ`_/(x!E# (  JBVP&20  P@wyz{|}~O^ENBAUM.TEXT}  (* ------------------------MAIN------------------------------------------ *) BEGIN (Hello; (Initialise; (ComputeAndDisplay; (Goodbye;  END. (* include file of problem-specific procedures here :-------------------- *) (* MAKE SURE PATHNAMES ARE CORRECT FOR YOUR SYSTEM !!! ------------------ *) (* ---------------------------------------------------------------------- *) {$INCLUDE FRAGMENTS/FEIG---'); (NewLines (2); (CarryOn ('Start :'); (NewLines (2);  END; PROCEDURE Goodbye; BEGIN (CarryOn ('To Stop : ');  END; (* ----------------------------------------------------------------- *) --------------------------------------------------------- *) {$INCLUDE FRAGMENTS/UTIL.TEXT} PROCEDURE Hello; BEGIN (TEXTON; (write(chr(28)); (InfoOutput ('Calculation of FEIGENBAUM Graph. '); (InfoOutput ('-----------------------tional global variables here *) (Feedback : real; (Visible, Invisible : integer; ( (* Include text file of utilities and graphics procedures here ---------- *) (* MAKE SURE PATHNAMES ARE CORRECT FOR YOUR SYSTEM !!! ------------------ *) (* -------------{$LIST list}  PROGRAM FEIGENPROG; USES applestuff, pgraf; CONST (Xscreen = 560; (* i.e 560 points in x-direction *) (Yscreen = 192; (*i.e. 192 points in Y-direction *) ( VAR (PictureName : string; (Left, Right, Top, Bottom : real; ((* include addi--------------------------- *) {$INCLUDE FRAGMENTS/UTIL.TEXT} PROCEDURE Hello; BEGIN (TEXTON; (write(chr(28)); (InfoOutput ('Calculation of MANDELBROT Diagram'); (InfoOutput ('--------------------------'); (NewLines (2); (CarryOn ('Start :'); (imalIteration : real; (Visible, Invisible: integer; ( (  (* Include text file of utilities and graphics procedures here -------- *) (* MAKE SURE PATHNAME IS CORRECT FOR YOUR SYSTEM !!! ------------------ *) (* -----------------------------------------{$LIST .console}  PROGRAM BOXMANDEL; (* full text, not fragment *) USES applestuff, pgraf; CONST (Xscreen = 560; (* i.e 560 points in x-direction *) (Yscreen = 192; (*i.e. 192 points in Y-direction *) ( ( VAR (Left, Right, Top, Bottom : real; (MaxO^ocedures here :-------------------- *) {$INCLUDE FRAGMENTS/ } (* ------------------------MAIN------------------------------------------ *) BEGIN (Hello; (Initialise; (ComputeAndDisplay; (Goodbye;  END. -------------'); (NewLines (2); (CarryOn ('Start :'); (NewLines (2);  END; PROCEDURE Goodbye; BEGIN (CarryOn ('To Stop : ');  END; (* ----------------------------------------------------------------- *) (* include file of problem-specific prariables here *) (Feedback : real; (Visible, Invisible : integer; ( {$INCLUDE FRAGMENTS/UTIL.TEXT} PROCEDURE Hello; BEGIN (TEXTON; (write(chr(28)); (InfoOutput ('Calculation of '); (InfoOutput ('-------------PROGRAM EmptyShell; USES applestuff, pgraf; CONST (Xscreen = 560; (* i.e 560 points in x-direction *) (Yscreen = 192; (*i.e. 192 points in Y-direction *) ( VAR (PictureName : string; (Left, Right, Top, Bottom : real; ((* include additional global vNewLines (2);  END; PROCEDURE Goodbye; BEGIN (CarryOn ('To Stop : ');  END; (* ----------------------------------------------------------------- *) (* include file of problem-specific procedures here :-------------------- *) (* MAKE SURE PATHNAME IS CORRECT FOR YOUR SYSTEM !!! ------------------ *) (* -------------------------------------------------------------------- *) {$INCLUDE FRAGMENTS/MANDELBROT.TEXT}  (* ------------------------MAIN----------------------------------(* ------------------------------------------------------------------- *) (* MAKE SURE THE PATHNAME IS CORRECT FOR YOUR SYSTEM !!! ------------- *) (* ------------------------------------------------------------------- *) {$INCLUDE FRAGMENTS/LORENZ.TEXT} );  END; PROCEDURE Goodbye; BEGIN (CarryOn ('To Stop : ');  END; (* ----------------------------------------------------------------- *) (* include file of problem-specific procedures here :-------------------- *) - *)  {$INCLUDE FRAGMENTS/UTIL.TEXT} PROCEDURE Hello; BEGIN (TEXTON; (write(chr(28)); (InfoOutput ('Calculation of LORENZ Attractor. '); (InfoOutput ('--------------------------'); (NewLines (2); (CarryOn ('Start :'); (NewLines (2 real; (* Omit SetTop in UTIL.TEXT *) (* ------------------------------------------------------------------- *) (* MAKE SURE THE PATHNAME IS CORRECT FOR YOUR SYSTEM !!! ------------- *) (* ------------------------------------------------------------------{$list .console}  PROGRAM Lorenz; (* FULLTEXT - not FRAGMENT *) USES applestuff, pgraf; CONST (Xscreen = 560; (* i.e 560 points in x-direction *) (Yscreen = 192; (*i.e. 192 points in Y-direction *) ( VAR (A, B, C : real; (Left, Right, Bottom, Top :O^-------- *) BEGIN (Hello; (Initialise; (ComputeAndDisplay; (Goodbye;  END. (* ------------------------MAIN------------------------------------------ *) BEGIN (Left := -30; Right := 30; Bottom := -30; Top := 80; (Hello; (Initialise; (ComputeAndDisplay; (Goodbye;  END. (pencolor(white); ( (rewrite(gscreen, 'GRAPHIC:'); (write(gscreen, 'LORENZ Attractor: Corners -30, 30, -30, 80'); END; PROCEDURE BottomNote; (VAR 0gscreen : interactive; 0 BEGIN (pencolor(white); ( (rewrite(gscreen, 'GRAPHIC:'); (write(gscree y+delta*dy; 0z := z+delta*dz; (END; ( BEGIN (x := 1; y := 1; z := 1; (f; (SetUniversalPoint (x,z); ( (REPEAT 0f; 0DrawUniversalLine (x,z);  UNTIL (KEYPRESS; (  END;   PROCEDURE TopNote; (VAR 0gscreen : interactive; 0 BEGIN (*LORENZ - FRAGMENT - not FULLTEXT*)  PROCEDURE LorenzAttractor; ( (VAR x, y, z : real;  (PROCEDURE f; 0 0CONST 8delta = 0.01; 8 0VAR 8dx, dy, dz : real; ( (BEGIN 0dx := A*(y-x); 0dy := x*(B-z)-y; 0dz := x*y-C*z; 0x := x+delta*dx; 0y :=O^ѶFRAGMENTSve'' '/FEIGENBAUM.TEXT e("+LORENZ.TEXT e'-/MANDELBROT.TEXT e()UTIL.TEXT e(.n,'A= ',A:1:2,'; B= ',B:1:2,'; C= ',C:1:2); END;  " PROCEDURE initialise; ( BEGIN 'ReadReal ('Enter parameter A > ', A); 'ReadReal ('Enter parameter B > ', B); 'ReadReal ('Enter parameter C > ', C); 8 END; PROCEDURE ComputeAndDisplay; (BEGIN 0EnterGraphics; 0TBoxTop; 0TopNote; 0TBoxBottom; 0Bottomnote; 0DrawBox; 0LorenzAttractor; 0gsave('Lorenz.pic'); 0ExitGraphics;  END; (ReadInteger ('Invisible >', Invisible); (ReadInteger ('Visible >', Visible); END; PROCEDURE BottomNote; (VAR 0gscreen : interactive; 0 BEGIN (pencolor(white); ( (rewrite(gscreen, 'GRAPHIC:'); (write(gscreen,'Corners: ',Left:1:3,','--------------------------------------------------------- *) PROCEDURE Initialise; BEGIN (ReadReal ('Left >', Left); (ReadReal ('Right >', Right); (ReadReal ('Bottom >', Bottom); (ReadReal ('Top >', Top); END; 0FOR i := 0 TO Visible DO 0 8BEGIN @SetUniversalPoint (Feedback, population); @population := f(population, Feedback)  END; 8  END;  END; (* END: Problem-specific procedures *) (* ---------- BEGIN (deltaPerPixel := (Right - Left)/Xscreen; (FOR range := 0 TO Xscreen DO ( (BEGIN 0Feedback := Left + range*deltaPerPixel; 0population := 0.3; 0 0FOR i := 0 TO Invisible DO 0 0 BEGIN @population := f(population, Feedback)   (* FRAGMENT FEIGENBAUM - NOT FULLTEXT!! *)  (* BEGIN: Problem-specific procedures *) FUNCTION f(p, k : real) : real; BEGIN (f := p+k*p*(1-p); END; PROCEDURE FeigenbaumIteration; (VAR 0range, i : integer; 0population, deltaPerPixel : real; O^,Right:1:3,',',Top:1:3,',',Bottom:1:3,'.'); END;   PROCEDURE TopNote; (VAR 0gscreen : interactive; 0 BEGIN (pencolor(white); ( (rewrite(gscreen, 'GRAPHIC:'); (write(gscreen, 'FEIGENBAUM Diagram.'); END; PROCEDURE ComputeAndDisplay; (BEGIN 0EnterGraphics; 0TBoxBottom; 0BottomNote; 0TBoxTop; 0TopNote; 0DrawBox; 0FeigenbaumIteration; 0gsave('Feigenbaum.pic'); 0ExitGraphics;  END; (Top - Bottom)/Yscreen; (x0 := 0.0; y0 :=0.0; (y := Bottom; (FOR yRange := 0 TO Yscreen DO (BEGIN 0x:= Left; 0FOR xRange := 0 TO Xscreen DO 8BEGIN (* for one-colour plot *) IF MandelbrotComputeAndTest(x,y) >THE *) 0StartVariableInitialisation; 0REPEAT 8compute; 8test; 0UNTIL (iterationNo = maximalIteration) OR finished; 0distinguish;  END; (* MandelbrotComputeAndTest *) ( (  BEGIN (deltaxPerPixel := (Right - Left)/Xscreen; (deltayPerPixel := MandelbrotComputeAndTest := iterationNo = maximalIteration; END; { distinguish } ( ( (BEGIN (* MandelbrotComputeAndTest; (* compute *) (  PROCEDURE test; (BEGIN (finished := (distanceSq > 100.0); (END; (* test *) ( PROCEDURE distinguish; { for one-colour plot *************** } BEGIN Sq + ySq;  END; (* StartVariableInitialisation *) ( (PROCEDURE compute; (BEGIN 0iterationNo := iterationNo + 1; 0y := x*y; 0y := y + y - cImaginary; 0x := xSq - ySq - cReal; 0xSq := sqr(x); 0ySq := sqr(y); 0distanceSq := xSq + ySq; (END0iterationNo : integer; 0x, y, xSq, ySq, distanceSq : real; 0finished : boolean; 0 ( ( (PROCEDURE StartVariableInitialisation; (BEGIN 0finished := false; 0iterationNo := 0; 0x := x0; 0y := y0; 0xSq := sqr(x); 0ySq := sqr(y); 0distanceSq := x(* File BOXMANDEL.TEXT - FRAGMENT, NOT FULLTEXT*) {$list list} PROCEDURE Mapping; (VAR 0xRange, yRange : integer; 0x, y, x0, y0, deltaxPerPixel, deltayPerPixel : real; 0 FUNCTION MandelbrotComputeAndTest (cReal, cImaginary : real) : boolean; (VAR O^N Setpoint(xRange, yRange); @ " x:= x + deltaxPerPixel; " END; " y := y + deltayPerPixel; " END; "END; (* Mapping *) " " "PROCEDURE initialise; "BEGIN (ReadReal ('Left > ', Left); (ReadReal ('Right > ', Right); (ReadReal ('Bottom > ', Bottom); (ReadReal ('Maximal Iteration > ', MaximalIteration); ( (SetTop; END; PROCEDUR(* END: Useful Subroutines *) (* --------------------------UTILITY-----------------------------*) (* -------------------------GRAPHICS-----------------------------*) (* BEGIN: Graphics Procedures *) (*PROCEDURE picktint (Tint : integer);  BEGIN 6CASE (write (information, 'hit '); (readln;  END; PROCEDURE CarryOnIfKey; BEGIN (REPEAT (UNTIL KEYPRESS;  END; PROCEDURE Newlines (n : integer); (VAR 0i : integer;  BEGIN (FOR i := 1 TO n DO (writeln;  END; String (information : STRING; VAR value : string); BEGIN (write (information); (readln (value);  END; PROCEDURE InfoOutput (information : STRING);  BEGIN (writeln (information); (writeln;  END; PROCEDURE CarryOn (information : STRING); BEGIN PROCEDURE ReadReal (information : STRING; VAR value : real); BEGIN (write (information); (readln (value);  END; PROCEDURE ReadInteger (information : STRING; VAR value : integer); BEGIN (write (information); (readln (value);  END; PROCEDURE Read(* -------------------------UTILITY--------------------------*) (* BEGIN : Useful subroutines *) (* Not all of these are used everywhere, but if you have the time to com- *) (* pile and the disk space it is less mental effort to keep it all together *) O^ " END; "PROCEDURE ComputeAndDisplay; "BEGIN (EnterGraphics; (TBoxBottom; (BottomNote; (TBoxTop; (Topnote; (Drawbox; (Mapping; (gsave('Mandelbrot.pic'); (ExitGraphics; "END; 0xCen, yCen : real; BEGIN (pencolor(white); ( (xCen := (Left+Right)/2; yCen := (Top+Bottom)/2; ( (rewrite(gscreen, 'GRAPHIC:'); (write(gscreen, 'MANDELBROT Diagram: Centre (',xCen:1:3,',',yCen:1:3,') ',MaximalIteration:1:1,' Iterations.');E BottomNote; (VAR 0gscreen : interactive; 0 BEGIN (pencolor(white); ( (rewrite(gscreen, 'GRAPHIC:'); (write(gscreen,'Corners: ',Left:1:3,',',Right:1:3,',',Top:1:3,',',Bottom:1:3,'.'); END;   PROCEDURE TopNote; (VAR 0gscreen : interactive; Tint of 80: pencolor(black); 81: pencolor(magenta); 82: pencolor(darkblue); 83: pencolor(purple); 84: pencolor(darkgreen); 85: pencolor(grey1); 86: pencolor(medblue); 87: pencolor(lightblue); 88: pencolor(brown); 89: pencolor(orange); 810: pencolor(grey2); 811: pencolor(pink); 812: pencolor(green); 813: pencolor(yellow); 814: pencolor(aqua); 815: pencolor(white); 0 END END; *) (* ---------------------------------------r GRAFIXMO Y(0,0);  END; (* END: Graphics procedures *) (* ----------------------------GRAPHICS------------------------------- *) (page(output); (gotoxy(0,0); (writeln('-------------- Graphics Mode --------------'); (CarryOn('BEGIN :'); (GRAFIXMODE(bw560,1); (INITGRAFIX; (FILLPORT; (GRAFIXON; ( END; PROCEDURE ExitGraphics; BEGIN (readln; (TEXTON; (PAGE(Output); (GOTOX(Right - Left); (ys := (yu - Bottom)*Yscreen/(Top - Bottom); (DrawLine(round(xs), round(ys));  END;  (* PROCEDURES TEXTON and GRAFIXON are defined in PGRAF *) PROCEDURE EnterGraphics; BEGIN (writeln ('To end drawing hit '); s : real; BEGIN (xs := (xu - Left)*Xscreen/(Right - Left); (ys := (yu - Bottom)*Yscreen/(Top - Bottom); (GoToPoint(round(xs), round(ys));  END; PROCEDURE DrawUniversalLine (xu, yu : real); ( (VAR xs, ys : real;  BEGIN (xs := (xu - Left)*Xscreen/; ( (CONST 0L=0; R=559; B=176; T=191; 0 BEGIN (pencolor(white); (viewport(L,R,B,T); (moveto(L,T); (lineto(L,B); (lineto(R,B); (lineto(R,T); (lineto(L,T); ( (moveto(20,187); ( ( END; PROCEDURE GoToUniversalPoint (xu, yu : real); (VAR xs, y(lineto(L,T); ( END; PROCEDURE TBoxBottom; (CONST 0L=0; R=559; B=0; T=15; 0 BEGIN (pencolor(white); (viewport(L,R,B,T); (moveto(L,T); (lineto(L,B); (lineto(R,B); (lineto(R,T); (lineto(L,T); ( (moveto(20,11); ( END;   PROCEDURE TBoxToprawLine (xs, ys : integer); BEGIN (pencolor(white); (lineto(xs, ys);  END; PROCEDURE Drawbox ; (CONST 0L=0; R=559; B=15; T=176; BEGIN (viewport(L,R,B,T); (pencolor(white); (moveto(L,T); (lineto(L,B); (lineto(R,B); (lineto(R,T); ); (VAR xs, ys : real; (  BEGIN (xs := (xu - Left)*Xscreen/(Right - Left); (ys := (yu - Bottom)*Yscreen/(Top - Bottom); (SetPoint (round(xs), round(ys));  END; PROCEDURE GoToPoint (xs, ys : integer); BEGIN (moveto (xs, ys);  END; PROCEDURE D----------------------------------------- *)  PROCEDURE SetPoint (xs, ys : integer); BEGIN ((* Insert Machine-Specific graphics commands here *) ( pencolor(white); 6dotat(xs, ys); END; PROCEDURE SetUniversalPoint (xu, yu:real(* MANDELPROG; it is used to maintain esthetic proportions in the diagram *) (* Elsewhere, Top is explicitly prompted for or all four Right, Left, *) (* Bottom and Top are set to fixed values. *) (* -------------------------------------------------------- *)  { PROCEDURE SetTop; (* Sets proportions of Graph *) (BEGIN 0Top := Bottom - 0.75*(Right-Left); (END; } ( (* NOTE ! The above procedure should be activated only when compiling *) GA3/1.01/LIN `}wqnkjba_\[ZYXWVURQ$hhhhhh HH H)HHH`20+*)Hhhhhhh HHHH`&$< 詏 )x `a^]NMJGF>=<10/.+* )) y xHHHJJiH 詏 鮀hhhh  HH`420.,*)&#"! Rhhhhhh    HH`DB@><:983.+('&$h J)` `!0 nljhfdcbQNMLJFEDCBA<;6hhhhhh  HH`420.,*)&#"! Rhhhhhh    HH`DB@><:983.+('&$hhh-&#  P  `"hhhhhh  HH`420.,*)&#"! Rhhhhhh  B B HH`yyP`GB HH`)r` @A>~|zxvtslgbWTSRPMED=hhhh   HH`420.-&#  Phhhh   HH`420.h   HH`420.-&#  Phhhhhhhhhh  HH`DB@><:86421.+*)'jhhhhhhhh    X XLJFE>987410/-   `+(%" Bhhh h h h hh hhhhhh  HH`ZXVTRPNLJHFDB@<;85431hhh    `OLIHEDCB?<;8541.+*x  `"hhhhhhhh    HH`XVTRPN.GRAFIX jj# \\JHFD=;9210-,+*)!   v Q )``.`5`=`C`E` `BGRAF (C) APPLE 1980j @@@@ @``` kLK``9(89:9g:h:h L89:mm95:6:6hg gh h 99 O S   L `ee m`iɂ`0`hIhJh\h] wh]h^ w\\ ]] ]L ]L\A \A JHIH`i8\i]i\`\]`K`M %b&*L+ 16>:)    kLhhhhhh HHHH`&$<D^Z FpHx  )) y xHHHJJiH 詏 鮀RETADDR ISOSDSTATGSCB kSOSOPEN INITCHK READPARM5CREFNUM DWBUFADR ?BMOVCHK RBUFADR 7WRITEPAR=SREFNUM FRREFNUM 6WREFNUM >INITFLG KSOSCLOSE RETADDR % ! INITCHK  ITCHK LINETO LINETO WBUFLEN  UFLEN SOSWRITE SWRITERWBUF     CALCABS x q ABS RETADDR CALCABS  ABS RETADDR  SOSDSTAT SDSTATGSCB INITCHK  ITCHK DOTREL DOTREL WBUFLEN  UFLEN SOSWRITE SWRITERWBUF SWRITERWBUF  RETADDR c _ < 8 INITCHK O ITCHK WBUFLEN Y UFLEN SOSWRITE\ SWRITERWBUF T L H D @ DOTAT DOTAT RWBUF ZRNJFCALCABS BRETADDR SOSDSTATSDSTATGSCB  MOVEREL MOVEREL INITCHK ITCHK WBUFLEN UFLEN SOSWRITEWBUFLEN !UFLEN SOSWRITE$SWRITERWBUF BUF RETADDR ieB>INITCHK UITCHK MOVETO MOVETO  WBUFLEN _UFLEN SOSWRITEbSWRITERETADDR INITCHK ITCHK RANGECHKNGECHKWBUFLEN UFLEN SOSWRITESWRITERWBUF  INITCHK ITCHK FILLPORT FILLPORT RETADDR tpINITCHK ITCHK PENCOLOR PENCOLOR RANGECHKNGECHKWBUFLEN UFLEN SOSWRITESWRITERWBUF |x FILLCOLO FILLCOLO TRETADDR  SETCTAB SETCTAB  INITCHK ITCHK RANGECHKHKWBUFLEN UFLEN SOSWRITESWRITERWBUF  'SOSWRITESWRITERWBUF  RETADDR PLINITCHK sITCHK VIEWPORT VIEWPORTWBUFLEN }UFLEN SOSWRITESWRITERWBUF  xplhd`\XUFLEN SOSWRITESWRITERWBUF ~zvrRETADDR $ INITCHK ITCHK XFROPTIO XFROPTIORANGECHKNGECHKWBUFLEN UFLEN #ITCHK WBUFLEN DUFLEN SOSWRITEGSWRITERWBUF ?:72-(SYSFONT SYSFONT RETADDR njDRAWIMAG DRAWIMAGINITCHK ITCHK WBUFLEN RETADDR INITCHK ITCHK RANGECHKECHKWBUFLEN UFLEN SOSWRITESWRITERWBUF  NEWFONT NEWFONT INITCHK =+SOSWRITE@.!RWBUF  83& INITCHK uITCHK GRAFIXON GRAFIXONWBUFLEN UFLEN SOSWRITESWRITERWBUF zBUF GPGSREQDLGRAFIXMO GRAFIXMORBUFLEN 9RANGECHKwWBUFLEN ASOSWRITERWBUF \SOSREAD GBASADR TSOSSMARK$INITCHK ITCHK INITGRAF INITGRAFWBUFLEN  T P SOSDSTATj SDSTATGSCB LINEREL LINEREL INITCHK g ITCHK WBUFLEN  UFLEN SOSWRITE SWRITERWBUF } d ` \ X RELEASE RELEASE INITCHK  ITCHK BMOVCHK  OVCHK INITFLG  ITFLG RWBUF  F SOSDSTAT" SDSTATGSCB % CB INITCHK  ITCHK CREFNUM  EFNUM B$ԐB$="L"B$="l"CNDS=128:=8:=60:"LEFT ":430B$="C"B$="c"CNDS=0:=8:=60:":80"A$="2"330,A$="3"Z=1:330/6A$="4"::RELEASE:".D1/MENU.MAKER",220@270J^=0:=0::"79C";D$;:*h=23:=0::"79C";"PRINT GRAPHICS": rœ200E|=8:"Picture at left margin or centered? ('C','L', or 'Escape')"ENU.MAKER GRAPHICS":1=8:=20:"PRESS '1' TO SEE THE GRAPHIC ONLY"7=10:=20:"PRESS '2' TO SEE AND PRINT THE GRAPHIC"@=12:=20:"PRESS '3' TO SEE AND PRINT THE GRAPHIC INVERSED"2=14:=20:"PRESS '4' TO RETURN TO MENU.MAKER"A$A$="1CC>0160d=10:=40:"" nGLOAD.D$xXFROPTION(%6)MOVETO(%1,%190):#5D$8MOVETO(%1,%180):#5"ANY KEY QUITS TO GRAPHICS MENU" FILLPORT GRAFIXON C=C+1B$ :::=0:=0::"79C";D$;:/=23:=0::"79C";"M1 MENU.MAKER GRAPHICS MODULE (COLOR SUPPORT) SEG=0"MENU.MAKER"2".D1/BGRAF.INV",".D1/SCR.PRT.INV":INITGRAFIX#5,".GRAFIX"#CC=0(D$=B$(I),16,B)2name$=34)+D$+34)<C=1:N=0:Z=0:BD=0F200P INVERSE THE GRAPHICZC>1YLOC  SDSTATGSCB  INITCHK  ITCHK XLOC XLOC RETADDR     SOSDSTAT SDSTATGSCB   INITCHK  ITCHK YLOC  ASADR SOSSMARK SSMARKRETADDR  z v INITCHK  ITCHK XYCOLOR XYCOLOR RWBUF  F SOSREAD  SREAD RETADDR  SOSDSTATGPGSREQD GSREQDSOSCLOSE SCLOSEGRAFIXMO AFIXMOGLOAD GLOAD RBUFLEN  N RWBUF    SOSREAD  EAD GBASADR GBASADR ( ASADR SOSDSTAT~ SDSTATGSCB  INITCHK { ITCHK CREFNUM  EFNUM RBUFADR  ADR SREFNUM  EFNUM RREFNUM  M WBUFADR   ADR GSAVE GSAVE WREFNUM F  M GPGSREQD5 GSREQDSOSCLOSE> SCLOSEWBUFLEN 8  LEN SOSWRITE; SWRITERWBUF C F "CENTERED ":430 B$)=27"MENU.MAKER",2205=10:"Rotate picture? ('Y', 'N', or 'ESCAPE')"B$ B$)=27"MENU.MAKER,220"bB$="Y"B$="y"=10:=44:"YES ":CNDS=CNDS+57:480bB$="N"B$="n"=10:=44:"NO ":CNDS=CNDS+17:4805=12:"Include the name? ('Y', 'N', or 'ESCAPE')"B$|B$="Y"for example, the word after the median word becomes the "first" word, and the new median is the word halfway between the new "first" word and the last word. Using this system, a program must make only 25 to 30 comparisons to find the place of a new word ist in half with each comparison. (Binary means "two sided," not necessarily "base two" as in binary math.) One type of binary sort looks at the first word, the last word, and the median word in the list. If our new word is greater than the median word, st of hundreds or thousands of words. Using this sort, my friend's list required 69,532 comparisons--quite a saving compared to 124,750. But it still took 28 minutes to run. A binary sort, however, is much more efficient, for it keeps dividing the lisave a comparison. Each new word bubbles up until it meets a lesser word. Since we know the list is already in order, we don't have to search the rest. With our little eight-word list this sort saves 11 comparisons, but it can save much more in a lirds as we enter them, instead of entering them all and then sorting them. If the second word entered is less than the first, we swap their positions. Then if the third word is greater than the second, we know that it's also greater than the first, so we the number of items in the list. My friend's 500-word list, therefore, would require 124,750 comparisons. Using a slightly more efficient bubble sort (my old ox), we can make the procedure a bit less complicated. In this program, we can sort the wo order to sort the list of eight words, this bubble-sort program must make twenty-eight comparisons. This type of bubble sort is mathematically predictable using the following formula: Comparisons = N * (N-1)/2 where N isM$="04"M$="Yellow"M$="05"M$="Orange"M$="06"M$="Green") MENU.MAKER GRAPHICS MODULE (v 6.0) =12:=40:""4  CHANGE COLOR (Epson compatable Color Printers)4COLOR$=27)+"r"+N$>#8,".PRINTER"H#8;COLOR$\  COLORS M$="0"+N$M$="00"M$="Black"M$="01"M$="Red"M$="02"M$="Blue"M$="03"M$="Violet"MOVETO(%0,%0):LINETO(%0,%191):LINETO(%559,%191):LINETO(%559,%0):LINETO(%0,%0):BD=0!N=1MOVETO(%1,%190):#5;D$ GRAFIXONPSCREEN(%CNDS)X=12000:X N$="0"800#8;12):#8:CC=CC+1:40XFROPTION(%6) FILLPORTGreen) "YN$ZN$>"6"600[900]=16:=70:M$" "gN$="0"620 i800:#8lX=1600: vGLOAD.D$Z=1720bBD=16000B$="N"B$="n"=14:=44:"NO ":600 :B$)=27"MENU.MAKER",220MX=16:"Color? (0=Black;1=Red;2=Blue;3=Violet;4=Yellow;5=Orange;6=.MAKER",2202=14:"Add a border? ('Y', 'N', or 'ESCAPE')"B$&B$="Y"B$="y"=14:=44:"YES ":BD=1:B$="y"=12:=44:"YES ":N=1:530{B$="N"B$="n"=12:=44:"NO ":N=0:530 B$)=27"MENUn a list of 500. But then the program must move all the greater words down one space to make room for the new word, and that takes as much time as my old ox, even though the program knows where the new word should go. This type of binary sort is very good at FINDING a word in a long list, but it's no better than a bubble sort at PUTTING a word into that list. The Binary Tree and Pointers In a binary tree sort, however, the program doesn't move the words around in the lnter of node 3, the "showers" node, is set to 1, to point back to node 1. The LESS and MORE pointers of node 3 are set to 0. When we enter "might," the program sees that it's less than "mm," and that word 2 is the next lesser word. Since "might" irs" (word 3), the program sees that it's greater than "mm," and that word 1 is the next greater word. The program compares "showers" with word 1, finds that "showers" is less than "though," and changes the LESS pointer of node 1 from 0 to 3. The PREV poi integers called ptr%(x,2). x is the number of the node, and 0 (LESS), 1 (MORE), and 2 (PREV) are the pointers associated with that node. Entering Data Into The Binary Tree Referring to the above graphic, when we enter "showe. A number pointing back up the "branch" of the tree. (The PREV pointer.) We store the nodes' values in parallel arrays. The strings go into a linear string array, rec$(x), while the pointers are stored in a two-dimensional array ofing itself. (In the chart the number of each node is in parentheses.) 2. A number pointing to the next lesser node. (The LESS pointer.) 3. A number pointing to the next greater node. (The MORE pointer.) 4 * ***************************************************** Each "node" in the tree contains four values: 1. The str * * * * * * * * * * (PREV) 0 -1 (PREV) * * (node 2) april though (node 1) * * (LESS) 0 0 0 0 (MORE) * * (M) (L) * -1 (PREV) * * mm (node 0) * * (LESS) 2 1 (MORE) * * | | es of the tree would look like this: ***************************************************** * * * * care about left or right.) Besides its own word, each node contains pointers: the list numbers of the word to the right (MORE), the word to the left (LESS), and the previous word up the branch (PREV). If we enter "though" and "april," the first three nodsetting up the tree. It is in a node of the tree, where a branching occurs. In the following charts, words which are less than "mm," like "april," branch to the left. Greater words, like "showers," branch to the right. (Of course, the computer doesn't t of lower case letters. We could change that median to "MM" or "aa", or with a slight change in the program we could let the first word itself be the median. "mm" is the "zeroth" word in the program's list. It's never printed; it's just a means of ist. It simply keeps track of which word should be printed first, which second, and so forth. In this tree sort program, I define the "median" before entering any words. For my purposes, I assume that "mm" is the center point, since all our words consiss greater than "april," the MORE pointer of node 2 is set to 4 ("might's" node). As before, the LESS and MORE pointers of node 4 are set to 0, but the PREV pointer of node 4 is also set to 0. Why 0? Why not 2? And why does the PREV pointer in node 1 point to -1? Why not to 0? The answer lies in how the program prints the data. Printing From The Binary Tree We want the program to print the words in ascending order, so that the five words now in the tree (including "mm") e nodes to the left of the median, we now look, in the same way, at those branches to the right of the median. When the program winds up at a node which has a MORE of 0 and a PREV of -1, the printout is complete. Try drawing a tree with your own word THAT BRANCH. The PREV pointer of "april's" node (2) is 0, so we set the PREV pointer of node 4 to 0. And that's also why the PREV pointer in node 1 points to -1, for the top of its branch is node 0, which points to -1. Since we've already printed thht" over and over. Instead, we want to print "mm," (node 0), the node indicated by "april's" PREV pointer. And this is a general rule: THE PREV POINTER OF A NODE IN A RIGHT-HAND BRANCH IS ALWAYS THE SAME AS THE PREV POINTER OF THE NODE AT THE TOP OF0, the program must find the next word greater than "april." And here's the reason for node 4's PREV pointer: If PREV pointed to "april," the program would print "april" again and would go back to "might" in an infinite loop, printing "april" and "migrogram moves to node 4 ("might") and then checks to see if anything is less than node 4. Since node 4's LESS pointer is 0, it prints word 4 and then checks to see if anything is greater than "might" and less than "mm." Since node 4's MORE pointer is also the tree by following LESS pointers as far as it can. It finds "april" (node 2) and prints it. Node 2's PREV pointer points to node 0 ("mm"), but the MORE node points to another branch which is greater than "april" and less than "mm." Therefore, the p(M) * ***************************************************** To print the tree, the program starts at the median (node 0) and finds the least node in * * * (node 4) might showers (node 3) * * * * (L) 0 (M) 0 0 (L) 0 | | * * | | * * | | * * (PREV) 0 1 (PREV) * * * (node 2) april though (node 1) * * * * (L) 0 4 (M) (L) 3 0 (M) * * * * | | * * | | * * (PREV) 0 -1 (PREV) * * * * -1 (PREV) * * mm (node 0) * * (LESS) 2 1 (MORE) * * | | e 3) though (node 1) And the tree of the five nodes looks like this: ****************************************************would be in this order: april (node 2) might (node 4) mm (node 0) showers (nod list, using these concepts of entering and printing, and you'll get a good idea of how a binary tree works. Efficiency of the Tree Sort Compared to assembly-language programs, BASIC programs are always very slow, for their commands must first be interpreted into assembly language and because most of them can refer to memory addresses only indirectly, through variables. I recently read of an assembly-language sorter that will process 1,000 entries in less than 3 seconds. x=startstart+pl line$(x)&:"Press RETURN to continue: ";r$ page=page+1:start=start+pl+1Mpage300,310,320,330,340,350,340,370,360,360,310,300,330,380,310,310,390!x=starttotline:line$(x):*::"Press RETURN to go to menu: ";utput file name (RETURN=.CONSOLE): ";r$52r$=""fl$=".CONSOLE":ۻr$,1)<>"."07):40<#1,"treetise":x=1 Fž#1100P#1;line$(x):x=x+1:80d:totline=x:nr$<>""#1,fl$:#1:x=1totline:line$(x)::200xstart=1:page=1:pl=21line$(700)U :"This program prints a text file explaining how the treesort program works in"T"BASIC. You can print the text to .CONSOLE or to .PRINTER or you can load the"8"file named 'Treetise' into your word processor.":6("Specify oour Apple ///s do with this program. ram. ith about 205K allocated to the program. (Unfortunately, strings can't use the leftover space.) When someone talks about the superiority of IBM, you can smile smugly and point out that IBM's BASIC has only 64K available. It couldn't begin to do the job strings alone--plus an array holding 21,600 integers for the pointers, plus all of the other housekeeping notes the computer must write for itself. All of it adds up to about 140K. The /// has a lot of space left over, but then its BASIC is a monster, w and you'll see why. The old ox would need only one comparison per entry with an ordered list.) Capacity of the Program On our 256K Apple ///, this program can handle slightly over 7,200 seven-letter words--about 50K ofIC sorter. One note: This program works best when your entries are out of order . Unlike my old ox bubble sort, it will run most slowly when all entries are in order to start with. (Work through the tree with an ordered list, counting comparisons,y old ox which required 69,532 comparisons for the same file and took 28 minutes and 12 seconds to execute. This tree sort program required only 4,849 comparisons for that file and finished working in four and a half minutes. To me, that's a fast BAS I used to drive. I think of this tree sort in the same way, comparing it with other BASIC sorters. The simplest bubble sort of 500 entries requires 124,750 comparisons. I didn't want to take the time to time it. I assume it would take longer than mless I have an assembler program which translates assembly-language into code, but I can write a program in BASIC. Finally, speed is a relative concept. My Ford EXP is no grand prix racer, but it's fast enough for me--much faster than the Chevy truck("Lightning Sort"; Russ Gaspard. Compute! , September, 1984). But Gaspard never explained how it works. If something goes wrong or if I want to modify it, how do I fix it? In addition, I can't write an assembly-language program on my computer unr$:#0:"hello",pl=21::1306pl=13::130@pl=15::130Jpl=17::130Tpl=19::130^pl=5::130hpl=14::130rpl=18::130|pl=9::130pl=11::1806 WAP /// SIG MENU.MAKER PROGRAM (Version 4.54)=".d1":100: Coldstart 200: Warmstart (GOTO 30) (I=1L2(A$(I),A$))90<B$(J)=A$(I),1,31)!FJ/2<>J/2)=4:=+1:ۙ=44PB$(J);:J=J+1ZI:8dA$(1000),B$(1000),C%(,1450,1460,1470,1480,1490,1500,1510,1520,1530,1540M$="JANUARY":1550M$="FEBRUARY":1550M$="MARCH":1550M$="APRIL":1550M$="MAY":1550M$="JUNE":1550M$="JULY":1550M$="AUGUST":1550M$="SEPTEMBER":1550M$="OCTOBER":15=0::"79C";"CONTINUE...?":'(<>89<>121<>78<>11013202=78=11010<9F=23:=0::"79C";"PRESS ANY KEY TO HALT LISTING":P2,280,2 Z1310dn"x ..... "DATE.TIME.LINE" ....M=Ҡ,4,2))BM1430,1440,B$(I),16,B)#5,".PRINTER" $ž#4120 .#4;a$ 8#5;a$ B1070LV:=24:=0::#X=1100: TEXT SLOW-DOWN LOOPX810 Halt Subroutine::=23:=0::"79C";"PRESS ANY KEY TO HALT LISTING.": 1300(=23::=12:=0:120=+B$(I),16,B)1408A$(1000),B$(1000),C%(511),C$(20),name$(20):=10:=0 :120>::=23:=0::"79C";"WOULD YOU LIKE A PRINTED COPY?":1C$:C$<>"Y"C$<>"y"C$<>"N"C$<>"n"1010C$="N"C$="n"120#4C$<>"n"850\C$="N"C$="n"1000;f:=23:=0::"79C";"PRESS ANY KEY TO HALT LISTING": p840z2,280,21K:=23:=0::"79C";"TO PRINT OR RETURN TO MENU, HIT THE SPACE BAR":C$:C$<>" "930:ۺ1000 :=".d1"01:=0::"80C";A$;::12)E=23:=0::"79C";"PRESS ANY KEY TO HALT LISTING"::2,280,21 840#2,B$(I),16,B) ž#2910*#2;A$:A$:12304810 >:120*H:=23:=0::"79C";"CONTINUE...?":0RC$:C$<>"Y"C$<>"y"C$<>"N"IC 0")700B$(I),"TEXT 0")740B$(I),"CAT 0")960B$(I),"FONT 0")1660B$(I),"FOTO 0")1730400A$="RUNNING "+B$(I),16,B)"79C";A$;:=0B$(I),16,B):A$="LISTING "+B$(I),16,B)$=2)I=I+1&I2=-1:I=I-2:NIBOTM<30XTHPOS=44I=IBOTM/2)*2:=+IBOTM/2)-1:0b=+IBOTM/2-.5):I=IBOTM:I/2=I/2)I=I-1lvB=B$(I),16)," ")-1B$(I),"BASA=:A=21A=9oldprefix$=A=31110A=27:=".D1":980A=13630=THPOS:B$(I);A<8A>11400A-7500,520,550,580:=THPOS:B$(I);:380: 500THPOS=4:I/2=I/2)I=I-1I=IBOTM THPOS=44:I/2<>I/,A$="TEXT 0":406A$="CAT 0":40@A$="FONT 0":40JA$="FOTO 0":40TA$(L),"BLOCKS")370*^=27:=19:"FREE MEMORY AVAILABLE: ";h=7:=20:"80C";A$(L);$r:=5:THPOS=4:I=1:IBOTM=J-1:480|Q=:=26:=21:1400 =Q:WW=0PE> sets Prefix to .D1; aborts."12);::"80C";a$;:d$=DISKNAME$$=23:=0::"80C";d$;::12)1,180,22F=3:=14:"This /// SIG Disk is \^ 1990, Washington Apple `, Ltd."=4:B$(1)="":B$(2)="""A$="BASIC 0":40511),C$(20),name$(20):=10:=0nx=+B$(I),16,B)140 PREFIX$=.D1 #1, ž#1180I=0I=I+1:#1;A$(I):170#1 L=I-1j=1:same=0:/#9,".D1/DISKNAME.DAT":#9;DISKNAME$:#9Ta$="{,|,~,}; selects; 13П,2))-12;џ,6);:1580$"П,2))=0"12";џ,6);:ٟ;$,П,2))=>12" PM-":" AM-" 61630@WW=1390J=26:=21:1400 T1400 ^:WW=1:h |: CHANGE THE FONT".D1/download.inv"C$=B$(I),16,B)array$="C%"name$=34)+C$+34)getfont(@name$,@array$)loadfont(@array$)J=1:SAME=0:215#5,".GRAFIX"".D1/BGRAF.INV"D$=tion. Enjoy! ograms to our PD library. m accepts only UPPER CASE, so press ALPHA LOCK before you begin. f the file already exists, the program will load the file into memory. If not, the program will create a new textfile for you and will prompt for your command. To see a list of commands and command syntax, type '?' when you get the '>' prompt. The progra faster and more reliable. The program works with only one text file at a time. You must specify .D1/ or .D2/ as the start of the file name. If you've forgotten the name of your program's textfile, you can enter 'CAT .D2' when asked for the filename. Itically by whatever increment you wish. (Default is 10.) It allows you to insert, delete, and replace both individual characters and ranges of lines. Although it will move lines and renumber program text files, Apple /// BASIC's own RENUMBER facility is AUTO BASIC BY ROBERT BOSTON This program is a line editor for text files of BASIC programs up to 3,000 lines long. It generates line numbers automaB$(I),16,B)name$=34)+D$+34) GLOAD.D$16);1) GRAFIXONX=12000:X::RELEASE:#5302l ...... WAP /// SIG MENU.MAKER (VERSION 4.54)