@L}5 _$% l0$)$$Hȱ$ UhL" `e$$%`$%`  R@P!( L(1   Y I`  d  Ld M * @  $ % CC$$)%1 Udߥ$9%: !0 S$% DD˙`  }J)Lr d M * @  $ % CC$$)%1 Udߥ$9%: !0 S$%} DD˙`  }J)Lr J  ((  p L ()   J}L= ( L 0q A    IB JC;? D W } LL  ` W )LA!  ߰")-݆ p" } $G@LL 08`Q")<2Q0 -G$Ș݆ UL# ; p8(()(0ʥ)NQ` }$GȘ݆LU )L ݆ L GȘ ݆LL )W>Z   HH)H }p h  hyhy D L> L JJ    ! LA*` BF }7'8  M HN H` 8 Z  \LdJJ!"! GFE@F (!L }EE !E^ ^ E E7EȩEdE/EȩE  D } .L }  ;F d  ;?F7F? ( .   Z D LL d } . D  L    p  E` , d)  D L) 0BM݊L݉} ML  N݆ L NLML [ TEqEHȱEqEh 0Gȹ G} HLL GɛL  LFREE SECTORS G) *Gȩ GȽG GȌ*jj >G} C8jJ3j2CD( C202C ԠBX` N 1? l LlD:RAMDISK}.COMLu L1 L ;LHL  T`  `8  ɐ     `TU  } L ? .  t`GBJ ~DEHI B V0dV!}QDEHI VF9 ,0 ,0 s0hhL  L` H hDHEh"}DEL8HI4 0 HI,0 0  9 .G VLO#},0 L4*IJ`llD1:AUTORUN.SYSNEED MEM.SAV TO LOAD THIS FILE.D8:MEM.SAV J y08 B|DEHI$} V0 0`B;DEL`?<0LV`@ʆ v s? F0Ξ05: [ BDEHI%} VY8 B V  @  /DE `E:D8:DUP.SYSERROR-SAVING USER MEMORY ON DISKTYPE Y TO &}STILL RUN DOS B;DE J  (` 9 V⪍ ઍ  -'}LLu ÝDEHILV 9 .l 9 .l  `` s$B BH(}I|DE V BLV nB,DE JLV B V BLVDEIʩ BꭝLu } 3E:}DISK OPERATING SYSTEM II VERSION COPYRIGHT 1984 ATARI CORP.A. DISK DIRECTORY I. FORMAT DISKB. RUN CARTRIDG*}E J. DUPLICATE DISKC. COPY FILE K. BINARY SAVED. DELETE FILE(S) L. BINARY LOADE. RENAME FILE M. RUN AT ADDRES+}SF. LOCK FILE N. CREATE MEM.SAVG. UNLOCK FILE O. DUPLICATE FILEH. WRITE DOS FILES P. FORMAT SINGLEL !N',}#"&))9(&*)/h)''-&؆莟R'S  vL/ˢ L }Insert DOS 2.0s, type Y Λx -}DEfHI 1莏#q! @ y0ɛ8A0,' ȅ 1 1ild! 1L!NO SUCH ITEMSELECT.} ITEM OR FOR MENU! 0 .z:*{}.|{ 1 0 0JB 18L%|DL/}%DIRECTORY--SEARCH SPEC,LIST FILE?[# 0 0 &|D3" 1L!NOT A DISK FILEN !B 1L!E# 1 !BD0}ED:}:1BJ|DE 1DEBHI 1 h0ߢ 0.1}  0?詛 1 y0YЛ 1 ;#L" ;#L! BL1TYPE "Y" TO DELETE...DELETE FILE SPEC2}COPY--FROM, TO?OPTION NOT ALLOWED697 FREE SECTORS COPYING---D8:COPY32.COMl# 0|D .L/%#3}##JB|DE 1BHID#E 1#0: B 1L!#͑### B 1#c$0SY4}S1}:## # # .#Ƚ# # 𩛙## 1,#PD#ELJ- <.BJD#E 5}1 1HH 0hh|DL%1}:̳# L% #D#EL% 1 0 . .0O% 1L!WILD CARDS NOT A6}LLOWED IN DESTINATION 0 <.|K}N 2 FORMAT. t* 5) 1L!`) 0NΞ 0 L1) 1 L!BAD LOAD FILELOAD FROM WHAT FILE?) 0 ?}0#B 1L!WHAT FILE TO LOCK?) 0 0$B 1L!WHAT FILE TO UNLOCK?DUP DISK-SOURCE,DEST DRIVES?TYPE "Y" IF OK TO US@}E PROGRAM AREACAUTION: A "Y" INVALIDATES MEM.SAV.FE! +L1   `*  70 2 2A} 0.* 1 y0 0)INSERT BOTH DISKS, TYPE RETURN^, 1 y038逍 N, 1L! ,B}C, t*  Lx+, 0 ^, 1 y0 , ,0,0 ,L+ ,I0 ,Vǭ0C}Ξ, 0 }, 1 y0C,ШC, 0K'!" H H 'h h Lx+!EF 5L1L!D,I,HhD}` NOT ENOUGH ROOMINSERT SOURCE DISK,TYPE RETURNINSERT DESTINATION DISK,TYPE RETURNE}`  `8 rL1`-* 1P* 1 y0Y`hhL!NAME OF FILE TO MOVE?- 0 0|DL% <.F},^ 1 70 0 .@L# .BJ 1  DEHIB V L1 ,} 1 70,L.  G}JB|,#P#DE 1 HI BDEHHII 1 B 1 ,^ 1 70,0La- B V,#PH},^ 1 70 0L#L!-* 1P* 1 y0Yj383}mm ݭI}}`8}``|* ? ɛ,`|:-)| / 1L!`DESTINATION CANT BE DOJ}S.SYS0 0H{ 24Δ 28/L!/) 2 Π 2 0 ξK}hAΞB,0 J 1 BDEHI,HÝDE 1HIHIDELSAVE-GIVE L}FILE,START,END(,INIT,RUN)O S0 1`BDEPHI V` S0H 1 L!M}0 0 1L~0`PLEASE TYPE 1 LETTER,0`hhL! 70 1L0L<1 ,;ɛ7,"ɛ:ݦ1ݥN}A"D|ݤD|ȩ:|ȩ|ɛ,,(/+.ީ1 1,ɛ`轤{NAMEO} TOO LONG B VL!` L1I H1EΝDL1|mDiE` V0`8d/8 i:222 1 LP}!ERROR- 10˛ɛ+,' 20*.. өr2 1``2TOO MANY DIGITSINVALID HEXAQ}DECIMAL PARAMETER800 0 8 00`,0'D800 H,ɛh`2L1NEED D1 THRU D8uR} ECIMAL PARAMETER800 0 8 00`,0'D800 H,ɛh`2L1NEED D1 THRU D8u SORTING NUMBERS =============== by Ron Fetzer The Bubble Sort We will usT}e a bubble sortbecause it is the easiest tounderstand. We first load the numbersinto a number array. In this sort 2elemenU}ts of the array are examinedduring each pass of the loops. Theyare switched if they are not in theright order - low to higV}h. If theyare in the right order the loop keepson going. A bubble sort is slow butit is fine if you don't have too manynuW}mbers. This sort uses nested loops. Theouter loop is the same as the numberof elements of the array. The innerloop isX} ONE LESS than the elements ofthe array. The switching is donebetween these 2 loops. In our programit is lines # 140 to 17Y}0. Lets enter these 4 numbers intothe bubble sort and see how they areprocessed. The numbers are: 3,2,7,1 BetweenZ} the outer loop(4) andthe inner loop(3) we have (4x3=12) 12passes of the loops. The bubble sortarranges the 2 elements fro[}m low tohigh. If these 2 elements are out oforder, it switches them. The arraystarts out as: 3,2,1,7PASS NUMBERS ACTION o})6^^<s3>00x|73>00x`c6<9c` 33c366fffg~33>00xgfffff< ]}11111{!!\]_\ED!EOHI B V`}   ^} TURBO-BASIC XL 1.5 (c) 1985 Frank Ostrowski!  ӥL]""$$ (p _}%J[WܠjeC /D%Zub2gTSt$8®݊Ò2% 5R `}Ţtd.’$3@X7t5w5$?## $#L+D:*.*S:C:P:$#.#) `:#(6ENeU\l؏&/ؕ؄sأ$ a}LENeU\lأ$8آǔƐƉƐƇ4cY%٦rULۉCۄړp^gyض%iwܸJڅ*ܣ$ڭڞجئأأ b}$ ,(""(222000000..222222222222222222222222222222**22*22(222(2222222222 ,(""( c}0000000--**2*(22(2222222 V`hh@,lHH$HHHHHHӍl" d}H$HHl $`GHFH\` ` 4ӭ l 4Lq ӠԪӅԆL} Ӡ L(  e}) ` b% +L:#HH 0 HHLj%ӥHlL{ee 8eee f}eӦee褢%ƚƜ`88夅奅8 g}夕奕Ӡȱȱȱ㦢`L+`8` .E)))8@8e0 h}*څۅ܅݅ޅ߄ԠF0y"ޥy"ݥy"ܥy"ۥy"ڥy"و0ǠF0y"ݥy"ܥy"ۥy"ڥy"٥y"؈ i}0ǠF0y"ܥy"ۥy"ڥy"٥y"إy"׈0ǠF0y"ۥy"ڥy"٥y"إy"ץy"ֈ0 j}ǠF0y"ڥy"٥y"إy"ץy"֥y"Ո0L-`8`E)))8i@0 *ڄԠ k}"("!""" "L**""""""&О"("!"" l}" "L**""""""&О"("!""" "L** m}""""""&О"("!""" "L**"""" n}""&О"("!""" "L**""""""&Оd o}"("!""" "L**""""""&ОL-6"e" p}"e""e""e""e""i""}"""}"""}"""}"""}"""}""ǭ"m"""m" q}""m"""m"""m"""m"""}"""}"""}"""}"""}"""}""ǥՅօׅ؅مԅՅօ r}ׅ؅`` ` ` `80 `ԥՅ +.JJJJ)iFiFi1FicFi'ȐȦoFiU s}ȐFiiFi#iFiGi Fii@F iiFiiciՊFigi'iՊօשBL-`I t}))83Ԥԥդե֤֥פץؤإ٤L,K6"ХL--L--L- u}-E0:e٥eإeץe֥eՐ؅٥ׅإօץՅ֩L-8٥إץ֥հ'I8 v}م٘؅ؘׅטօ֘ՅL-ؤm\G0Q@Ն֩م؅2եمֆשم"ե؅֥م׆ةեׅ֥ w}؅ץم؆لԘ)q +` . |. &7i |. ,%!L?.`刱䈱㈱∱ x}ሱ`ԅՅօׅ؅م`ԍՍ֍׍؍ٍ`ԍՍ֍׍؍ٍ`L.L. Խսֽ y}׽ؽ` L%/`ӽޕ &ԅ)@إ)JJJe)e - M z} 1. &Je0F 2 . /L(8`@ԠՈքׄ؄` . |. , . . |. , #/L(8`0 I@ԥ) {} 2f / . & r 1. #/ &?P , .Iiԩ +)ԅ ,ӽޕL(`8`$ |})Ԧ61718191:1;1 (ť)8@0$Յ)e)e -F . / , . &1 1. }} #/ &F I`U9>`D'RFuCU?b9dYdg@W2@?tS)%)@0)%ԅԢ / . &G  ~} 1.Ӱ6 #/ &.ӽߕ ,ԅԥ B1 (`8``0?i? . . / , #/ &ԍՍ }֍׍؍ٍ . . ( / , O2 / ,0 .JeF 2`L+) .e٥eإeץe֥e }Պi؊؅٥ׅإօץՅֆե1ԥ'JffffJffffJffffJffffم`ԩ&&&&*&&&&*&&&&*& }&&&*`Pi`)JJJeԅԘ)Peԅ`եԆ8@EB)JJJeԅԥ)PeԅԘ)3eԅԽ3eՅ՘)JJJ}3 }}3`)JJJeԅԥ)PeԅԹ3eԅԹ3eՅդЧ` 0@P`'Nu pX@(#d,X L(  兢 }0襙 bɥ⥋㩀 50ɥ0DȱȱȄ   ik#ZMkVgğe拰ㅋ }⅊0 eee拰 L f5дƨħ 4LY4 f5К,樥ŧH 4h h5L4樤ܱ.* O %30 }  5Ԅ +(fԤԈ`ř嚰Ԥ`ڥۥड़0-԰eڅڐۈ0eeL+58` }O#`,#5  6`]5 6DE 68DHEIHI V0$ 6Sл B } V,# 6` $#LllBHI V0HH V0Ԩh``{a$%Ȏ$$xө$Ѝ$ ` } `@X a Ӆʢ ʎD  _ɠ %` ɩHH `өL: g% D }:??????*.ARBөjJHH`ՠԢӱԙ!ӹ!`֝DEIHB V0Y|ڝDa۝E }օܥׅݥܝHݝI V0+Ӡڑڑ0`l `  䅠 _ɠԐ }e拢 &L &Lħ © ¥4 䥝ň剰' k ɀ8@4= LY ĩ`OJ ]J?L } KԪȱLRHHצ R, hhLRHHHHHH /0ȑȑޠhhhhh }h`HHHHHHHHHH $H bɐhȥLHhhhhLň剰) }i桰` )``L(兢ħ #$ x Hҩ h$襚ҥ ԝ` } UV #T` ` `,H ¥ȍ` JKhLŢ  #)I L ¤Ȣ`L¦ ¦ Lĩ } ½J*K+ $LąLĩ …L~ …`H Ġh é`,H hH Ġ  ĭ 8}} } L n [h`LkL © 8倝偝 Ġ  ĥ󥃅  Lĩ LH } éLH#h ĩ`H hKJ L+ , H hHHħ s hKhJ  Lĩ# qL } ŘL ũ& QŽLM " ĽNL  ĥԝL՝M  ĥԝN%LV  ¤ħ` Ťħ` ƪ Ċ }Ťħ` ¢`届 x݅ L ĽCӠɀ L]Ɉ L] Ln LŠI }HEDBL$HH hh +L `ħ LĢl ¦`OBRUT ԅՅ֦ }󅗄`L+ ¢p 0 Hp hɈL` ,#,$,!Lé ,H ĥDEԝH՝Ih L }©L $`L© , k ĩԅ  + ĥ 夨ħ`2ƪƪ ! A!Ƚa!Ƚ!Ƚ!Ƚ!Ƚ! }``氤hhL1@$ƪư 0 0 n$P`L+FҐ֥װ綾إٰو LǠFf }ؐ ee&ee* &eeeԪeըee$.ƪ@!Ƚ`!Ƚ!Ƚ!Ƚ!Ƚ!`檦 }!!!!`!@!^!` Ȅ 8 n奱 ٥Lǥ֤צưĘ=ŗ78֪א& } eԥe$`L: L ԅՅօׄ 1פ& ٤ţĢԅeՅe8包卅 ]& } 8Ԩժ%אְ`ֆL夨ħ` FҰg8&0ei֥i0Tׅiإi0BJe؅eم0&f }fff&0 &0 eeL+օפإ颎 %8包ԥ卅 L ɥ }ȱъŠe拰8``,ªȱȱI ѝ3ȥLɥHHO] }  ȥe暰Х ȥL+ʅȱhh`Lħ OԪȱԨ``L :0 } `L(奷 bɥ󥋅ȱȱȱȄ#鈄0B8eeŶ }ɛ,@LBˤ,ɛ`L?± ˤ樱f Oƨ x݅ + ~ [ˠ O樥0# +  L˥` }LL :ɛ,$PH h $P润䧰 ʐLʦ䧐 +` ʐL3LBˢ }ԝD՝E֝HםI L 兢L]& 兢L% ,L6 ,L6 &L6 (L6妪@!I@!` ؐb`P KW ؐRB ؐ }=;G ؐ4@ ;+ƪƪ@!=A! (ƪƪ@!A! ƪ@! ,@@檦@!`!!!!!!`ƪ@! ǩjҤ } /L.٤ƪƪ@!@!, 舽`!`!!ـ!!٠!!!!!`@!jI*` . ֪ ( }ϰ`(8` ֤ׅԄ +҅L: Lyƪ8吪周Ly sũ + ŐL Ly sŠԄ h L} } L}٩    e쪽pLyL( + ڥHJJJJ h) 0:i`  ک; n +ȱ)ȥ% }ݓ Lh ԍՅԄׅ֩өL:ƪ?Ԣ )ɠ )  -L &Lڦ@!)@!` n)8@ } -L:` / n)8@I= n)8@/ѩ֔$ሄ ,L: + n 0L8 n } 0L8 n H1L8 n /L8 n /L8 n D/L8 n 1L8LLإL( &)ԥ)8@JjH@ }MC)JJJe)e .F / .P . &F . #/ &L.L(HHHHHH /hhhhhh & } Y/hԅL:,` L _ܘ%ᨥ%Ly _ܘᨥLy _ܘEᨥELyٚ<|'g 0L` }!!!!i ` &LإL٥LyɥLzvmZ ƨ!0 4 䦵 ¥ԝD՝E֝Heם }I Lܤį eį L` x݅ƨLLLܤ ©`#ۢ Lĩ_,ߤ } ڄ . eڅԥeۅհ"8څ֥ۅא8ܥݰL۠Q%0ԅإՅ٥ަ0%Q% }L-ե0LޥڤLyمօנ6&֐ eו`L( Hħ hբՅ `ޥԢ `ޥՅ֠ }&&֐eܥeېڈ 7 \ 7 j N \ N j$0!ee80å/8ܥ۰uڕ0 }eUiV`TUV`8UV`eTi`8TȢ` $L„')Q ȱ8 e }新`8`L齀).Q Ӱȱ8e新 O :L䅫# *$Ŭ } Ʃ HL"䥫ș L` Ml/#樱0ZS'`ȱȱȱȱȱȱȄ`ȱօȘuԩׅu՘e֨҄` }I 屝Ҡȱȱȱȱȱ` n$҅J?eԨe` L 兙 兛 n %3 Ԥ` ҩ, } , , L檤 ٙ!ؙ!י!֙!ՙ`!ԙ@!ә !ҙ!` 䤪ƪ!ٹ!ع!׹!ֹ`!չ@!Թ !ӹ!`ƪ!! }!㹁!a!A!Lp ґȥӑȥԑȥՑȥ֑ȥבȥؑȥّ` ***j)e)e`ʭȅiȅ }iȅȩȩ Lfإ  4  \ +] ¥򄟄 }   넨ɛ$0L祔 Z f0#ڠ쩀 ߩ6ei$0 녖چ + !5 }ɛȑ @膔7 ɛ 襔!ɛL! _ɩ8$IȢ %e拢 } &!$P* &8孨客 "&$ 1L~ L~ &L _ɰe拢 &L~ +0 %30Ԅ }L 9:枢0 O L :H9Hhh tLHH`h }hLCL馩`ʆLC枢0ְşLC`A枢Ɣ!L!L }!T 򈩛LQLD ijq ߰,iŰD VD8` 覲`8` 넬 S( +饰 }0 S0:$$ p8`$p (ȩ@҅ҥ򄬤 ߰ A L8򨢄 %Ӥ򈦬ʽ ʽ % }+HH 屝EҨhh$P0Ƭ 襯I `_A[`8`80 &Ոԅ }` 넬$ +  + h갳 h) + , 褔ԙ!` "8` 襔 ɛ "ȱ" }嫤!`! `) ɛ%)a{)_0:A[_դ`RE͕DATINPUԑCOLOҝLISԖENTEҚLEԛIƜFO }NEXԑGOTϑGO TϑGOSU½TRAАBYŐCONԞCO͟CLOSŐCLҐDEǞDI͐ENĐNEנOPEΖLOAĖSAVŢSTATUӣNOTPOINԡXIϤOΒPOKťPRINԐRAęREA }ĨRESTORŐRETURΩRUΐSTOАPOХGEԫPUԑGRAPHICӒPLOԒPOSITIOΐDOӒDRAWTϓSETCOLOҬLOCATŔSOUNĦLPRINԐCSAVŐCLOAĚERROR- }DPOKœMOVœ-MOVŪ*ƐREPEAԑUNTȊWHILŐWENĐELSŐENDIBPUBGEԒFILLTϐDϐLOOШEXIDIҖLOC˖UNLOC˖RENAMŖDELETőPAUSŖTI }ME$PROøEXEÐENDPROÑFCOLOҪ*̕-RENU͒DEDUMЪTRACTEXԖBLOAĖBRUθGO*’PAINԟCLӔDSOUNCIRCLū%PUԘ%GEԚG }OTGOSUTSTETHEΣ<<>ުNOOANĨ<<>STRCHRUSASVALEADATCOPEESIRNFREXLOCLOSQSGABIN }PADDLSTICPTRISTRIDPEE˦INSTINKEYEXOHEXDEDIFRATIMETIMMOEXERNRANTRUN%%%%GOUINSTERER+,%5 }&6(+8,<Xk`fghilm^deDѳHc?,Ќ,е,Y_Ҳ+7,/0 }1 2!3"4Ɛ"-"."-؂ٿ֐ː }ĐאŐbj+9,+;,ʐͭ }ͭ@ABC\=>[<+:е<,&%rvnnxc<\ }-78s_XV+@D&0d*"'2GJh N }Rl~&2 +饰(+VWZ ]a8`L`  ¤ħ.H h L5 䄡 } 䅭 bɠ04Ů .ŭ%) e拰 ĩ L+Ư0 Le }`毤Hɛ) h`  L ȱ R @ʆ ȱȄ Iğ` :62T F : }7 8 Lbԩ- L 8 8,I ɨ 8L.UH `ƨh $ %3   + \L L 8󅯩" } 8" ©" Ư" L8q :Z#]abj(=) W같  L樤ħ`hh`H YhZ }L<>EO ƹƹ0`H f5h`I&` =? FQA` L񄳱ȱI 䦐 }Ħ ąŅ T k /䧰 k ,Ǡ ĩJH ThĥȑĥȑĦʊȑ`HHąŅ }H h hhhh ȱIELZ L`ȱI Hȱȱȱȱȱ }, h @ $L+L.*ȱȱȱȱȱjEE `EjI `e`ħ ¥ }0 ` Lk 䦪`! 䧰L A@L `I&`L ©؅ L. }0`STOPPED륺 bɠhhL :ʅ` k %3Hƹ h5h`hbjH h # }ԤLQ #LLei  `LԑȥՑȥ֑ȥבȥؑȥّ``䈥剰 }#)iiLɠL4űI&`048ץğ=ȱȄ  }`L  L0e拠0ȱȄL  䦪`!' >?L (<ж`!  $Л +`,LőŐ78Ƒ8 Ƒ`8` - PѠ }`,,L L PQ 8,L ȱI ѝߠȱ`ԩ },L E  $EL+L],,,؍ 0âLɀL ©7 F󦹩 RbL g  }0g `Ո V fL{Ն + +􅕄L AT LINE?BLOAMEVALU>#VAR$LE?DAT>3276INPUDISTACOVERFLO?LIN? }FOTOO LON?DE?GOSUGARBAG?CHMEͣ?LOA?NES?WHIL?REPEA?D?EXIXPRO?EXE?PRO?IS OPE?DEWR ONLCMNOT OPEΣRD ONLEOT }RUNTIMEOUNA!FRAMCURSO!OVERRUCHKSUDONMODNOT IMPRA͠D?>#FILEDSK FULFATAL I/FILENAMPOINLOCKEDCM>DI }?FILPOIN?APPNBAD SECTORӥHՄ +h & .hԩ + ,҅L: ƪn (@Մ$ 0` 0 }` 0LoH - . /h &@Յ՘JJJJ X) 0:i`AVC@ sŠ 5  <)  < } L L + e +e`e`&&&&&&eee` & }&eee&*`` 兙 䦪!0 4 ۄܱ **m ݤܱEۅڦڱ= } ܥeƥiեLN@ ` **)]` 00`` ( ((((((((8 }`W)ߥ & &e &߽řِ׼JJJJ&eXޥeYߥ䥛 9 FfЎᰈ } `  M 8*` 兙 󥐅i祣L{ &L }  0 & L ȑ & L; # )ȱ L })ȱ) )ȱ 8ƣŐő0eސ`ƙ8ް`)ȱJJJ` }``=`]``` E߭H Ġ} hL±&Lv`[  ȱ R] } L L  䅠 bɰhhğȱȄ L l"0e拱LjLx`[  ȱ R] h^_OPIC_LOAFDIM_SESCRN_CMENFINXNAYNDTSCREEPRNEND_FILSCROLEND_TXPAGTMP9 }@4@g9:<7E    )x  @@}A@rAYCD@ TTWRITTEN IN TURBO-BASI}C FOR XL/XE COMPUTERS. MODULAR PROGRAM by Ron Fetzer 1/91T ` P(P2P<PFPPZTdOn<<};@%,;@,;@,;A ,;@,xQTO6. D1:RON.PIC5 +@$@5@}@$6-F:AY,$AY+!C@U:@,Av+ A07)@A}7C@A@0@@@0@@@AY )"@: ,A}@ +QTO8-@@8(WHAT SCREEN COLOR DO YOU WANT?#-@@#( 1: NORMAL}""-@@"(2: AMBER,"-@@"(3: GREEN6!-@@!(4: GREY@B A -@}@8SELECT A NUMBER >>B BJT  @)!@)P:,#(J("ERROR: SELECT A NUMBER FROM 1 TO 4T A }T''APA`ApA^1AAH'A @1 Ah1A@X'A }1 Ar1AA4'A 1 A|1A@'A 1 AQT4}O `AR@(6-46-.-@ @.(Π/-@@/(1. Ho}w To Use Modules.-@@.(2. How To Use Arrays.-@@.(3. How To Do Sorting.-@@}.SELECT A NUMBER >>(( @)!@)P:,A`O"@`$-@@;(HOW TO USE MODU}LESO6. D1:MODULE.TXTM"@`$-@@:(HOW TO USE ARRAYSM6. D1:ARRAY.TXTO"@`$-@}@:(HOW TO DO SORTINGO6.D1:SORTING.TXT!-@@!(*******1-@@1(PRESS ٠} TO SCROLL--@@-CREEN OR RINTER737@<@,4S)7@<@,4s7P&737@}<@,4P)7@<@,4p7P0Q:TD(O `AR@(6-N+@+@@}X# @#6-%@b(l"@"Pv A=]F:A,"A6'@+}P=AR< 6. `-@@<READ ANOTHER FILE(Y/N)737@<@,4Y)7@<@},4y7PQTOAR@)"@: ,A 6-QTO `AR}O-@@O3DID YOU SET THE PAPER TO THE TOP OF ITS FORM(Y/N)$$7@<@,0YAP!3 3} 33!AR@ &`-@@&( ǡ+@+@@ # @}#6-%@*.@.@@P:4(((@ >"@WPH }UUUUUeZUp?<UUUUVZZUUP  D"! $UUUUUUZUUUP'} D"!$UUUUUVUYYUUUP$$UUUUUUUVUUUUU@P$H$@$UUUUUUUUUUUUU@P$H$}@"%UUUUUUZUUUU@P'H$~2%UUUUUUZUUUUUU@P H$)5UUUUUUUUUUUUUPQE'H$~$ }UUUUUUUUUUUUUPR%$H$@"uUUUUUUUUUUZUUTT$HH$@"uUUUUUUUUUUUUUU@X$HH$@!UUUUUU }UYUUUUU@QE$$H$!UUUUUUZiUUUAA$$ H$!%UUUUUUUjiUUUB!$ H$!%uUUUUUUjYV }eUU|<x<}UUUUUUeUUeUUUUUUViUiUUUUUUUUUUeeUjUUUUU }UUUUUUUUVUUiUUU@UUUUUUUUZeUUUUU@UUUUUUUUZUUUUUU@ }UUUUUeUUUUUUfUUU@UUUUUUUUUUUUjUUU@UUUUUUUUUUUUYUUUP}UUUUUUUUUUUVZUUUPUUUUUUUUUUeZjUUTUUUUUUUUUUijUUT}UUUUUUUUUUjUUEUUUUUUUUUUUUUZUUAUUUUUUUUUUUUUUUUUU}UUUUUUUUUUUUUPUU@UUUUUUUU@UUUPTU@UUUUUUUUUPPU@UUU}UUUVUUPU@UUUUUUVT@PUUUUUUUTPUUUUUUUP}PUUUUUUU@PUUUUUUU@PUUUUUUU}TUUUUUU@TUUUUTTUUUUU@}TUUUUUTU@UUUUUUTU@PU@UUUUUTU@U@}UUUUUUU@P`0UUUUUT@P@UUUUUU@P@ }UUUUUU@@ UUUUTU@@`?UUUUT@ }@UUUUUP@/ UUUUUP@( UUUUUP@( R}UUUUUP@/$UUUUUP@ UUUUUP@ UUU}UU@/UUUUUPP@( PUUUUUU@@( PUUUUUU}( PUUUUUTT( PUUUUUPT/PUUUUUP}@ PUUUUUP?pUUUUU@UUUUP@}@UUUUT@@UUUUUUUUUT}UUUUT@UUUUP@UUUUPUP}UUUUU@UUUUUPUUUTU@UUUUPUUPUUUTUUUUUUPUUP}UUUUUUUUUUPUUUPUUUUQ@UUUUUPUUQPUUUUUP@UUUTUUAP }UUUUTUUUTUUQPUUUUUTUUUTUUUPUUUUUPUUUTUUUP pU@U!}UUQUUUUPUUUP @PUPUUUUUUUUTTUUP @P?UUUQUUUEUTPUUP @P   T@UUPU"}UUUTTUUP @p' TPUUPUUUTUUP$pA PTUUPUUUT@UP$ ! PTUT@UTT#}EUP$I PUUTUPTU@UP'I UUUTAPATUTEP II AUUUUPTATUUU@$}'I% EUUUUPUUUUUU$I EUUUU@UTUUPP$HI AEUUUUTTUUT%}$H  QUEUUUTTU@UUPP$$p QUEUUUTPU@UUPP$$  UEUUUT@U@UTP&}$  UAUUUUPU@UTP<UEUUUUPU@UT\P8UEUUUU@U@UTT P '}EUUUUU@U@UPP P0UUUUUU@UPT P QUUUUUUP\p8(}UUUUUUPU@PPUUUUUUPU@PPUUUUUUPU@PPUUU)}UUUPU@TPUUUUUUUTPUUUU@UTPUUUUUP*}UUTPUUUUUPUUTPUUUUUUU@TPUUUUUTUU+}UTPUUUUUTUUUU@PPUUUTUUUUPPUUUTUUUT,}PTUUUUDUUUTP?UUUUUUUTP@ $BUUUUUUTPP-}@ $B~@UUUUUTUTPO'$A UUUU@@UT@H$dA UUUU@T@.}H$ ĀA UUUUTP@O'~@UUUUUP@@@ 3UUUUUPT@O'/}fyUUUUUPT@H$IUUUUUPUP@H$DUUUUU@UP@H$00}DUUUUUUUP@H'`BUUUUUUU@@U@H BBUAUUUUU@PUU@UH $BA5AU1}UUUU@UUUUUQUx?AUUUUU@UUUUUAUUAUUUUU@UUUUUAUUAUUUUT@2}UUUTTU@UUUTPPTU@UUUTPPTU@UUTT3}PTU@UUTTPPU@UUUPPUU@UUUUPP4}UU@UUUTPUP@UU@UUU@UTUUP@UU@UUU@U@UUUUP@5}UU@UUUPU@UUUUPUU@UU@UUUUPUUUUPUUPUUUU@U6}UUUPUUPUUUU@TUUUPUUT@UUUQTUUUPUUUUUTAP7}UUUUTUUUU@APUUUUTUUUEPEPUUUUTUUPU@U8}UUUTUUATU@UUUUTUUEUUPUUUUUUUUUUUUUUUUUU9}UUU@UU@UUUUUUUUU@UUTUUUUUU@UUUAUUUUUUUUU@UU:}UTUUUPUUUUUUU@UUUUUUUUTUUUUUUUPUUUUAQUUUUUUUUUUUPUUUUE;}UUUUU@UUUUUUUPUUUUUUUUUUTUUUUUUUUPUUUUUUUUUUUUUUUUUUUTUUUUUUUUUU<}UU@UUUUUUUUTUUUUUUUUUUUUUTUUUUUUUUTUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUP=}UUUUUUUUUUUUUUUUUUUUUUTUUUUUUUUUUUUUUPUUUUUUUUUUUUUUUUU@UUUU@UUUUUUUU@>}UUUUUUUUU@UUUUUUUUUUUUPUUUUUUUUU@UUUTUUUUUUUUTUUUUUUUUUPUUUTUUUUUUUUU?}UUUUUUUUUPUUUPUUUUUUUUU@UUUUUUUUUPUU@UUUUUUUUU@UUUUUUUUUTUUUUUUUUUUUPUUUU@}UUUUUTUTUUUUUUUUUT@UUUUUUUUUTUA@UUUUUUUUUTUUUUUUUUUTTPUUUUUUUUUTUUUUUUUUUA}UTQTUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU@UUU@UUUUUUUUUU@UUUUUUUUUUUU@B}UUU@UUUUUUUUUU@UUUUUUUUUU@UUUPUUUUUUUUUU@UUUUUUUUUUUUPUUUTUUUUUUUUUUPUUUUUUUUUUUPUUUC}TUUUUUUUUUUPUU@UUUUUUUUUUPUUUTUUUUUUUUUUP5UUUUUUUUUUUUPUUUTUUUUUUUUUUPUUUUUUUUUUUPUUU; PROGRAM MODULES =============== by Ron Fetzer 1. INTRODUCTION -----E}---------- These modules are designed tomake programming easy. They arewritten in TURBO-BASIC and are selfcontained. F}They are in the form ofPROCedure - ENDPROCedure(Atariequivalent GOSUB - RETURN) You do not have to re-inventedthe wheG}el every time you write a newprogram. You take the modules thatyou need and string them together toform the program that yH}ou want. This documentation is brokeninto four parts. They are theINTRODUCTION, the MODULE DESCRIPTIONSthe TUTORIAL oI}n how to use them andan INDEX for easy finding ofinformation MODULE FUNCTIONS & FILENAMES _______________________J}_____ ** DOS FUNCTIONS ** DELET.LIS DENSITY.LIS DISKDRV.LIS FORMT.LIS K} LOCKK.LIS RENAM.LIS UNLOCKK.LIS ** SCREEN DISPLAY FUNCTIONS ** CONVERT.LIS L} CNTROL.LIS DIRCTRY.LIS DELRAM.LIS ERASE.LIS FILE.LIS FINI.LIS HAM}LT.LIS MENU.LIS RAMEND.LIS SCREENCL.LIS TEXTSCRN.LIS ** PRINTING FUNCTIONS **N} PRNTDIR.LIS PRNT40.LIS PRNT4080.LIS ** SORTING FUNCTIONS ** SORTNUM.LIS O} SORTSTR.LIS SORTFONE.LIS SORTMIMI.LIS SORTSHEL.LIS ** GRAPHICS FUNCTIONS ** P} PICLOAD.LIS PIC24.LIS ** UTILITIES ** CENTER.LIS CURSOR.LIS HEXADEQ}CI.LIS LABEL.LIS LOAN.LIS MEMCHECK.LIS SCROLL.LIS VARIABEL.LIS WOR}RDCNT.LIS************************************* 2. MODULE DESCRIPTIONS ______________________ The modulS}es are saved with theLIST command. The reason is that withLIST, a module can be loaded into awordprocessor. Variables can T}bechanged with GLOBAL SEARCH/REPLACEfeatures of a wordprocessor. A secondconsideration was if a module isloaded with the U}ENTER command it willnot destroy the program in the memoryof the computer. Programs must beloaded with the ENTER command.V}Example: ENTER "D:SCREENCL.LIS" Each module is in the form ofPROC - ENDPROC and can only beexecuted with the EW}XEC command. Ifyou want to check out a module to seewhat it does you must type 1. CLR toclear the DIM statement and 2. EXEX}C(name of PROC) For instance if youwant to see what the moduleSCREENCL.LIS does you type: CLR andRETURN, EXEC SCRN_CL(ThiY}s is the nameof the PROC)and RETURN. You must ofcourse be in TURBO-BASIC Some modules require othermodules to be in tZ}he program. ALLLINES BEFORE LINE # 10 areinstructions on the use of themodule. They can be erased once theinstructions ha[}ve been followed. Line #4 is the FILENAME of themodule. Usually line #6,7,8 and 9 areREM lines that tell you what thefu\}nction of the module is. Line #10is the name of the PROC and has to becalled by an EXEC command. To get abetter understand]}ing of how to usethem see the TUTORIAL section. ** NOTE on DIRCTRY.LIS ** - Anymodule that calls for the DIRCTRYmodul^}e also has to use the CONVERTmodule somewhere in the program. TheCONVERT module changes the FREEsectors into KILO - BYTES._} The DIRCTRY module also needsthe DISKDRV.LIS module. TheDISKDRV.LIS module must be EXECutedbefore the DIRCTRY module`}. This waythe program knows which drive to getthe directory from.** On the UTILITY modules you canerase the command Pa}ROC and ENDPROCand then you will have a freestanding little program. If you dothat make sure the other commands onthat lib}ne will be executed such asCLS and the initializing of thevariables. ** DOS FUNCTIONS **DELET.LIS - This modulec} deletes afile from a disk. It must have theDIRCTRY(See *) and the FILE modulessomewhere in the program you areusing. It d}first shows you your diskdirectory then it asks you for thefilename and when it is finished itshows your disk directory age}ain. Thisis to verify that it has been erased.If you do not want the directory tobe shown twice change line # 90 toREM.f}DENSITY.LIS - This module lets youselect the density that you want foryour program. 'DN'= THE DENSITYVARIABLE. 'DR'=THE DRg}IVE NUMBERVARIABLE. This module will ONLY setthe variables to your choice. It willnot change the disk drive densitymode!q}b%DOS SYSb*)DUP SYSbdSSORTING TXTb\AUTORUN SYSbDOCS ARBb>RON PICbDMODULE TXTbQARRAY TXT_oSORTING TXTDISKDRV.LIS - This module will allowyou to select the disk drive number1,2 or 8. The variable for this is'DR'. 'DR' becomr}es either 1, 2, or8.FORMT.LIS - This module lets youformat a disk in either drive 1 ordrive 2 with SINGLE or 1050 DENSITs}Y.This is a stand alone module, it hasno sub modules.LOCKK.LIS - This module lets you locka disk file. It needs modulest}DIRCTRY(See *) and FILE somewhere inyour program. It shows you the diskdirectory at the beginning and thenit locks the filu}e. It shows you thedirectory at the end again to verifythat the action has been completed.You can eliminate the seconddirv}ectory showing by making line #90REM. You can lock all files on yourdisk by using the wild card symbol'*' for the filenamw}e.RENAM.LIS - This module lets yourename a file. It needs theDIRCTRY(See *) module. You can changefilenames on drive #1,x}2 and 8. Whenyou are finished it will show you thedisk directory again to verify thatthe change has been made. If youdon'y}t want the 2nd directory showingmake line # 130 REM.UNLOCKK.LIS - This module lets youunlock a file. It needs theDIRCTRYz}(SEE *) and FILE modulesomewhere in the program. When it isfinished it will show you thedirectory again to verify that the{}file is locked. You can use the wildcard symbol of '*' to lock all files.If you don't want the seconddirectory display ma|}ke line #90 REM. ** SCREEN DISPLAY FUNCTIONS **CONVERT.LIS - This module convertsthe number of FREE sectors left onyo}}ur disk and changes it into K-Bytes. It will tell you how muchspace in K-Bytes you have left on thedisk. It is a SUB-MODUL~}E of theDIRECTRY module.CNTROL.LIS - This is only ademonstration module. It shows youhow to write a control module. The}control module is usually the 1stmodule of your program. It is thebrain of the program. Every modulereturns to the control} module when itis finished. Line 60 always returnsthe program to the MENU MODULE - thusyou always have a new choice from t}hemenu.DIRCTRY.LIS - This module shows youthe disk directory. It waits for theSPACE BAR to be pressed before itgoes to }a new module. This moduleneeds sub modules CONVERT.LIS andDISKDRV.LIS to work. The files aredisplayed in a 2 column form o}n thescreen. It works with drives 1,2 and8.DELRAM.LIS - This module will deletea file from the RAMDISK D8. Thismodule n}eeds the DIRCTRY(SEE *) and aMENU module to work correctly.ERASE.LIS - This program can erase 22lines or more from a pro}gramincluding itself. Line #30000 "STOP"is in the program so it does noterase itself. The variable XX shouldbe 2 lines BE}FORE the lines you wantto erase. For example: You want tostart erasing with lines 200. MakeXX=180 (200-20) and the YY =420}, theending line number. The program readsfrom the screen the lines to erase.If you want to erase more than 22lines you m}ust repeat this programwith a new FOR-NEXT LOOP. The way youactivate this program is either witha EXEC or a GOTO 30020(Rem}ove PROCENDPROC). The STEP in the loop is thesame as your line increments.FILE.LIS - This program allows you toinput any} file name. It needs DISKDRVmodule. It works with drives 1,2 and8. It is a SUB-MODULE of DISKDRV,DELET, LOCKK and UNLOCKK.}FINI.LIS - A module to signal the endof a program and put you back indefault screen colors as well as GR.0.HALT.LIS - }A program that puts in apause until the SPACE BAR is pressed.It can be called for from anymodule.MENU.LIS - This is only} a samplemenu. I used R$ to create 8 spacesfrom the left edge of the screen. Inthis way I can center my menu easilyby cha}nging the spaces R$ is equalto. I also used ON - EXEC command.Each PROCedure after it is finishedwill return to line # 17}0ENDPROCedure and then will return tothe CONTROL module. In the CONTROLmodule after the EXEC MENU there is aGOTO that fol}lows the EXEC MENUmodule that directs the program backto the MENU MODULE.(See CNTROL.LIS).RAMEND.LIS - This is a module t}oremind the user to save his programfrom the RAM DISK to a FLOPPY DISKbefore he turns off the computerSCREENCL.LIS - Thi}s is a module tolet the user select the screen colorof the program. The colors areNORMAL, AMBER, GREEN and GREY. Itusuall}y follows the CONTROL module.TEXTSCRN.LIS - This module reads a 38column text file and prints it to thescreen. It display}s 22 lines of textand then stops. The scrolling module activates and the user has to pressANY KEY to get the next screen o}ftext. In line #20 X$ is the name ofthe text file. It must be definedsomewhere in the program. Example 15X$="D1:FILENM.TX}T". It is usuallyplaced in the MENU module ** PRINTING FUNCTIONS **PRNT.LIS - This module prints thedirectory in }2 columns on the printerand gives you the free space left onyour disk in K-Bytes. You need theDIRCTRY module and the DISKD}RV modulesomewhere in your program. It willprint the directory of drive #1,2 or8.PRNT40.LIS - This module reads andprin}ts a 40 column text file on yourprinter. It gives you page numbersand provides page breaks on the topand the bottom of the} page. Itcenters the text in the middle of thepage. X$ has to be the name of thetext file. It is usually placed inthe MEN}U module. Example: 15X$="D1:FILENM.TXT". Also 'T2=0'should be placed into the MENUmodule. This module reads the printbuff}er and counts how many times itis accessed to determine thepagination.PRNT4080.LIS - This module reads 40column text fil}e and then gives you achoice of printing it either at 40 or80 columns. It provides page numberspage breaks and centers the} text inthe middle of the page(40 column).The variable FILE$ is the name of thetext file. It should be placed in theMENU }module. Example: 15FILE$="D1:FILENM.TXT". Also 'PG=0'should be placed in the MENU module ** SORTING FUNCTIONS **}SORTNUM.LIS - This module is really ademonstration module of how to sortnumbers using a bubble sort. If youare going to us}e this in a programyou must DIM the Array for the numberof elements you expect to have. Placethis DIM into the DIM section}.Example DIM A(50). The printingsection can be detached and usedlater in the program.SORTSTR.LIS - This is a demonstrati}onmodule of how to sort strings using abubble sort. The maximum length ofthe string can be 10 characters. Ifyou are going} to use this module in aprogram put the DIM for the arrayinto the DIM section. The DIM shouldbe the length of the String }timesthen number of the elements expected.For example, you want to sort 10words and each word is max 10characters long. T}he DIM becomes 10 X10=100 or DIM A$(100). If you want tosort words that have a max of 20letters add 10 to each occurence o}f anumber in the program and adjust theDIM and adjust PAD$ line #40 to 20 empty spaces. The printing sectioncan be detach}ed and used later on inthe program. If you want to printthis out on paper make line #70LPRINT. For screen and printer make} aline #75 the same as 70 except useLPRINT.SORTFONE.LIS -This module is ademonstration module of a relationalsort. In t}his sort one field issorted and the other field is kept inplace with the sort. In this examplewe sort the name and the tel}ephonenumber is kept with the name. Thesort is a bubble sort. SEE thediscussion on DIM in moduleSORTSTR.LIS. This applie}s also tothis module. A$ and B$ must be moveinto the DIM section and be DIMmedcorrectly if it is to be used in aprogram. }You can print out this sort.change line 340 to LPRINT. Theprinting section can be detached andused later on in the program}.SORTMINI.LIS - This is ademonstration of a number sort thatis faster than the Bubble Sort. Inthis sort the smallest num}ber in thearray is always put first. If youwant to use this sort in a programDIM A(k) to the right number ofelements that} you expect to have. Forexample 35 numbers - DIM A(35) andput it into the DIM section. You canprint out the numbers by us}ing LPRINTin line #220. The printout sectioncan be in any part of the programafter the sort.SORTSHEL.LIS - This is the f}asteststring sort in BASIC that I know. Itis a demonstration program. If youwant to use this in a program DIMA$(k*10) the} correct amount (SEESORTSTR.LIS) and put it in the DIMsection. The print section can bedetached and used later in theprog}ram. If you want a hard copy ofthe output make line # 300 LPRINT.** IF YOU FIND THESE TUTORIALS ONMODULES, ARRAYS, MATRI}X AND SORTINGUSEFULL PLEASE SEND ME A NOTE OR ALETTER IT WOULD BE APPRECIATED ** RON FETZER 22 M}ONACO AVE ELMONT N.Y. 11003, USA ** GRAPHICS FUNCTIONS **PICLOAD.LIS - This is a module thatlets you load }picture in GR 7, 7.5and 15 on your screen. It has to be a62 sector picture(MICROPAINT FORMAT).If you don't want to use the} INPUTformat on this module, change Line #30 to 30 CLS:F$="D1:FILENAM.PIC"(Thepicture file name) and delete line40. The p}icture will stay on thescreen until a key is pressed.PIC24.LIS - This module will load a62 sector picture in GR 24, 7 and}7.5. You must change line 30 F$ tothe name of your picture. The picturewill stay on the screen until a keyis pressed. } ** UTILITIES **CENTER.LIS - This is a module to giveyou the coordinates for the POSITIONcommand so you can cen}ter a STRING onthe screen. It will show you theString in its right position on thescreen. It is suggested you run itone t}ime. It will then store itselfin the RAMDISK D8. It will also giveyou the length of the string. Whenyou are finished the p}rogram erasesitself automatically. To use it typeENTER "D8:CENTER.LIS" and type GOTO30000. It will NOT damage yourprogra}m in memory and it will eraseitself from your program when you arefinished. This is a stand aloneutility.CURSOR.LIS - Th}is is a module thatlets you change the shape of thecursor. It stores itself in Page 6 ofthe computer and thus will NOT be}erased by anything except a TURN OFFof the computer. You can use anyATASCII character for the cursor. Try# 60, 95, 94, 30,} 42 etc for somenice cursors. To make a permanetcursor change without an INPUT makeline # 20 CLS:?:?:? A=60(ASCII thatyou} want). You can remove PROCedureENDPROCedure and make it a standalone utility.HEXADECI.LIS - A module that lets youconve}rt Decimal numbers toHexadecimal and Hexadecimal numbersto Decimal. The largest decimalnumber that can be converted is 64K}-1or 65535. The largest Hexadecimalnumber that can be converted is FFFF.You can remove PROCedure andENDPROCedure and make} it a standalone utility.LABEL.LIS - This is a module to beused with a label program and anEPSON printer. It gives you t}heposition of the first line ofprinting on on a label that is 3 1/2X 15/16(Standard mailing labels). Youcan adjust the la}bel by hand andcheck it repeatedly thus wasting onlyONE label.LOAN.LIS - A module to give you themonthly installment pay}ments on aloan. If you have no downpayment thenmake that 0 when the prompt asks you.You can remove the PROCedure andENDPR}OCedure and make it a standalone utility.MEMCHECK.LIS - A module that lets youlook into the memory locations ofinterest }and display their contents.You can remove PROCedure andENDPROCedure and make it a standalone utility.SCROLL.LIS - A modu}le that lets youscroll a program slowly forward orbackward. This program was adaptedfrom Jerry Ilaria of the JACS. Itwill} attach itself to the start ofyour program. To use is just typeRUN. To erase it from your programhit BREAK and type GOTO 3}2000. Thisis a stand alone utility and must beloaded with the ENTER command.VARIABLE.LIS - A module to find thevariables} used AND display the linewhere these variables occur. To clearthe variable name table load in yourprogram 1) LIST to a di}sk 2) type NEW3) LOAD it with the ENTER command.You can remove PROCedure andENDPROCedure and you will have astand alone p}rogram.WORDCNT.LIS - A module that countsthe number of words in a text file.The text file has to be saved to adisk in dr}ive #1. You can removePROCedure and ENDPROCedure and youwill have a stand alone program.*********************************}**** 3. TUTORIAL ___________ I am going to go through thesteps that the DOCUMENTATION READ}ERprogram required. The file name onthe disk is DOCS.ARB. Please pressBREAK and type LOAD "D:DOCS.ARB"and then list it on} your printer - LIST "P:" The first thing you do is makean outline of the things you wantyour program to do. } PROGRAM OUTLINE 1)SHOW MY PICTURE 2)SELECT SCREEN COLORS 3)SHOW TEXT ON SCREEN 4)PRINT TEXT Th}e first module that anyprogram requires is the CONTROLMODULE. The control module is mostlyEXEC commands. Start of with CLS} andEXEC DIM_SEC. Then I want to show mypicture therefore EXEC PIC_LOAD.After this I want to select thescreen colors ther}efore EXEC SCRN_CL.Now I need to have a MENU moduleEXECuted and after that an END orFINI module. The last item in theCONT}ROL MODULE should be the commandEND. Please look at line # 20 to 90.EACH MODULE should be separated bythe -- command. It m}akes it for easyreading by dividing it with 30dashes. Please note that the diskFILENAMES and the PROCedure names arevery }similar. DO NOT confuse them! For the DIM module I willreserve 3 lines. 100 PROC DIM_SEC 140 ENDPROC 15}0 -- I now move the program that Ihave written so far into the RAMDISKD8 with the LIST "D8:WORK.LIS"command. In this} way I save the workI have done so far in the RAMDISK.The next step is: NEW & CLS The next module that I need i}sthe GR. 24 picture load module. Icall this module from the disk withENTER "D:PIC24.LIS". Lines 4,5 and 6are going to be }deleted. This modulehas to start with line # 200. I usethe RENUM command as follows: RENUM10,200,10. The final step is to}combine this module with what I havein the RAMDISK D8. I now type ENTER"D8:WORK.LIS" and the modules are nowcombined. Ple}ase note that F$ has tobe DIMmed for 25 and put into the DIMsection. Line # 110 DIM F$(25). Makesure your picture FILENAME} for F$ isindeed on your disk so that thePROCedure can find it. I now savethis work to the RAMDISK with LIST"D8:WORK.LIS"}. The next module linenumber has to start with 400. NEW & CLS The next module needed is theSCREENCL.LIS module.} I get it withENTER "D:SCREENCL.LIS" from the disk.Next I look at the REM lines and dowhat is required. Then I delete line}s4, 5 and 6 and renumber this moduleas follows: RENUM 10,400,10. I nowcombine my program from the RAMDISKwith this module} by ENTER"D8:WORK.LIS". I now dump everythinginto the RAMDISK with LIST"D8:WORK.LIS". The next module linenumber has to s}tart with 600. NEW & CLS I have to WRITE the MENU module.The user has 2 choices in this menu.To put the text on} the screen or toprint it. I therefore need 2 moremodules, one to display the text onthe SCREEN and one to PRINT it. Seel}ines 410 to 560 of the program. Inow combine the program with ENTER"D8:WORK.LIS". Next I save this workLIST "D8:WORK.LIS".} The next moduleline number has to start with 700. NEW & CLS The next module that I need isto print the text to} the screen. Itype ENTER "D:TEXTSCRN.LIS" to get itfrom the disk. This module will reada 38 column text file and display i}ton the screen. I delete lines 4, 6,6, 7, 8 and 9. Then I renumber themodule. RENUM 10,700,10. I have todefine X$="D1:MOD}ULE.TXT" and put itinto the MENU module. I have to DIMX$(15),A$(120) and they go into line110 of the DIM_SEC module. I cal}l forthe program in the RAMDISK with ENTER"D8:WORK.LIS" and combine it with themodule in the computer. I now storethe com}bined program in the RAMDISKwith LIST "D8:WORK.LIS". The new linenumbers for the next module will be900. NEW & CLS } The next module is the PRINTmodule. I call the module needed withENTER "D:PRNT40.LIS" from the disk.X$ has already bee}n defined andDIMmed from the previous module.YN$(1) has to be DIMmed and put intoline 110. Also the variables T2=0 andT=0} have to be put into the MENUmodule line # 605. I now delete lines4 to 9 and renumber the module withRENUM 10,900,10. Then} I combine mywork by calling ENTER "D8:WORK.LIS".The combined work is stored in theRAMDISK with LIST "D8:WORK.LIS". Thene}w line number for the next moduleis 1200 NEW & CLS The last module is the end orFINI module. ENTER "D:FINI.LIS"} willcall it from the disk. I delete lines4, 5 and 6 and renumber it with RENUM10,1200,10. Then I combine the wholeprogra}m with this module by ENTER"D8:WORK.LIS". The program is now complete. Ido the FINAL renumbering by RENUM10,10,10 and} SAVE it with SAVE"D:DOCS.ARB". I gave it that filename so it will be an AUTOBOOT filewith TURBO-BASIC.*****************}******************** 3 DISK PROGRAMMING PACKAGE This is disk #3 of a programmingpackage that is available as P}ublicDomain or from your Atari ClubLibrary DISK #1 This is the TURBO-BASIC diskwith the COMPILER and} the 37 PAGEEXPANDED DOCUMENTATION MANUAL. Thisdocumentation will give you examplesof how to use each new command. Itexpl}ains the commands in plainEnglish. It was written especiallyfor the beginning and intermediateAtari user. }DISK #2 This disk shows you how to writevery long programs easily. It is adisk on MODULAR or STRUCTUREDprogramming. }Once you know thistechnique you can write programs thateasily exceed the memory of yourcomputer. It is called PROGRAMMING}MADE EASY. DISK #3 This is the present disk. Itprovides programming modules for youruse. It shows you }how to writemodular programs. It is calledPROGRAM MODULES The above 3 disks represent theBEST language for programmi}ng on the8 Bit Atari. It is a COMPLETE programespecially suited for the beginningand intermediate user. Specialattention }has been paid to avoidtechnical words and arcaneprogramming practices. Each disk is available from mefor $3.00 or fro}m your Atari Club. Ifyou have any comments or suggestionsabout these programs, please writeto: RON FETZER } 22 MONACO AVE ELMONT, N.Y. 11003, USA*************************************} INDEX _____ CENTER.LIS.......................9 CNTROL.LIS.......................5} CONVERT.LIS......................4 CURSOR.LIS......................10 DELET.LIS........................3 DELRAM.LIS.}......................5 DENSITY.LIS......................3 DIRCTRY.LIS......................5 DISKDRV.LIS..............}........4 DOS FUNCTIONS..................1,3 ERASE.LIS........................5 FETZER, RON...................9,15 FI }LE.LIS.........................5 FILENAMES........................1 FINI.LIS.........................6 FORMT.LIS....... }.................4 GRAPHICS FUNCTIONS...............2 HALT.LIS.........................6 HEXADECI.LIS.................. }..10 INTRODUCTION.....................1 LABEL.LIS.......................10 LOAN.LIS........................10 LOCKK.L }IS........................4 MEMCHECK.LIS....................10 MENU.LIS.........................6 MODULE DESCRIPTIONS.. }............2 MODULE FUNCTIONS.................1 P.D. DISKS ...................9,14 PIC24.LIS........................9} PICLOAD.LIS......................9 PRINTING FUNCTIONS.............1,6 PRNT.LIS.........................6 PRNT40.LIS..}.....................7 PRNT4080.LIS.....................7 PROGRAM OUTLINE.................11 PROGRAMMING PACKAGE.......}......11 RAMEND.LIS.......................6 RENAM.LIS........................4 SCREENCL.LIS.....................6 SCR}EEN FUNCTIONS.................1 SCROLL.LIS......................10 SORTFONE.LIS.....................8 SORTING FUNCTIONS}................7 SORTMINI.LIS.....................8 SORTNUM.LIS......................7 SORTSHEL.LIS...................}..8 SORTSTR.LIS......................7 TEXTSCRN.LIS.....................6 TUTORIAL.....................11-14 UNLOCKK.}LIS......................4 UTILITIES........................9 VARIABLE.LIS....................11 WORDCNT.LIS...........}..........11 AR1]F:A,"A61AR\<6-6-@W&5-@+%@,83< fL:3$} -%@-LARp= 6. `-@@=PRINT ANOTHER FILE(Y/}N)z737@<@,4Y)7@<@,4y7PQTO6-6-%@Q(@(}@Q(@$ --&-@@"(@& QTO `}AR@2-@@((END OF PROGRAM2M@" +AR"QT D:AUTORU}N.BAS@2-@@((END OF PROGRAM2M@" +AR"QT D:AUTORU ARRAYS ====== by Ron Fetzer There are 3 kinds of arrays thatwe use in TURBO}-BASIC: 1)Onedimensional number array 2)Twodimensional number array or MATRIX3)String Arrays(Pseudo-String Array) Arr}ays are also calledSubscripted Variables. P(2) = "P sub2". The P is the variable and the 2is the subscript. The subscript }isalways in parenthesis P(3), P(4)etc. Arrays are very useful inmanipulating numbers and strings. Itis the ONLY way  }you can sort numbersor alphabetize strings. You also saveon variable names, you can savenumbers or words in a program, you!}can handle large amounts of numbersor strings and you can speed up yourprogram execution. This is a veryuseful technique "}and is frequentlyused in many programs. ONE DIMENSIONAL ARRAYS ---------------------- You can think of #}a ONEDIMENSIONAL ARRAY as a string ofpearls. Each pearl is an element ofthe array. PEARL NECKLACE -O----O--$}--O----O----O----O----O-Element # 0 1 2 3 4 5 6Value $ 25 33 42 50 38 28 22 In n%}umber arrays the 1st elementis 0. In the example above we have 7elements from 0 to 6. When we use anarray we must DIM it. &}The DIM alsostarts with 0, in effect wedimensioned for 7 elements or pearlsif we use DIM P(6) The form of an array is'}: P(X) = VP = The name of the array. You must DIM it for the number of elements you are going to hav(}e in your array.X = The element numbers. Usually a FOR - NEXT LOOPV = Inputs the value into each element as t)}he loop executes ELEMENTS AND THEIR VALUEP(0)=25, P(1)=33, P(2)=42, P(3)=50,P(4)=38, P(5)=28, P(6)=22 Please *}key in the short demoprogram to see how it works 10 CLS:?:? 20 DIM P(6) 30 FOR X = 0 TO 6 40 INPUT "THE+} VALUE OF EACH" PEARL";V 50 P(X)=V:REM <-- ARRAY 60 NEXT X 70 PAUSE 60 80 ? "LETS SEE IF IT WORKE,}D" 90 ?:INPUT "WHAT PEARL DO YOU WANT TO SEE(0-6)";S 100 ? P(S):REM <-- ARRAY 110 GOTO 90 You no-}w can call up any pearl orelement in the array and see itsvalue. You also can print out all thevalues of the pearls .}or elementsautomatically. Change lines 90 to 110as follows: 90 ?: FOR Y = 0 TO 6 100 ? "PEARL #";Y;" = ";P(Y): /} REM P(Y) IS THE ARRAY 110 NEXT Y 2 DIMENSIONAL ARRAY OR MATRIX ----------------------------- 2 Di0}mensional arrays or DoubleSubscripted Variables are also calleda MATRIX. A matrix is a grid whereyou have columns and rows1}. For example lets take a bowlingteam of 3 members and each one plays4 games. This is how you canvisualize the matrix2}: BOWLERS 1 2 3 ---- ---- ---- B(0,0)|250|B(0,1)|220|B(3}0,2)|240|G ---- ---- ---- ---- ---- ----A B(1,0)|210|B(1,1)|190|B(1,2)|250| 4} ---- ---- ----M ---- ---- ---- B(2,0)|240|B(2,1)|230|B(2.2)|270|E ---- ----5} ---- ---- ---- ----S B(3,0)|220|B(3,1)|200|B(3,2)|260| ---- ---- ---- 6}In a matrix the first elementalso starts with 0. In the exampleabove we have a matrix and we mustDIM it DIM(2,3). The 2 in7} the DIM isthe 3 bowlers (0 to 2). The 3 in theDIM is the 4 games (0 to 3). We havea total of 3 x 4 or 12 elements inthis8} 2 dimensional array. The bowling score for the 4games were as follows: BOWLER 1 BOWLER 2 BOWLER 3 ------9}-- -------- -------- 250 220 240 210 190 250 240 230 270 220 :} 200 260 In the matrix the first elementis (0,0). We normally do not consider0 a number but the computer does n;}otmake that distinction. Please key in this short demoprogram to see how it works 10 CLS:?:? 20 DIM B(2,3)<} 30 FOR X=0 TO 2 40 FOR Y=0 TO 3 50 ? "BOWLER ";X+1;" GAME #"; Y+1 60 INPUT "SCORE PLEASE ";S =} 70 B(X,Y)=S:REM <--MATRIX 80 ? 90 NEXT Y 100 NEXT X 110 ?:PAUSE 60 120 ? "LETS SEE IF IT WORKED" >} 130 INPUT "WHAT BOWLER(1-3)";P 140 INPUT "WHAT GAME(1-4)";G 150 ? " ";B(P-1,G-1):REM MATRIX 160?} GOTO 130 We use nested loops to load thematrix. The first element to getloaded is B(0,0). In line 50 we useX+1 for @}the bowler - if the loop is 0then the bowler becomes 0+1 or 1. Wedid the same thing for the games Y+1so when the loop furnA}ishes a 0 isbecomes 0+1 or 1. We did the samething in line 150 except in reverseso the matrix will find the rightelement.B} When you answer for thebowler 1 it becomes P-1 or 1-1 or 0so the right element is accessed. Thesame is done for the game C}G-1 becomes1-1 or 0. ELEMENTS AND THEIR VALUESB(0,0)=250 B(0,1)=220 B(0,2)=240B(1,0)=210 B(1,1)=190 B(1,2)=250D}B(2,0)=240 B(2,1)=230 B(2,2)=270B(3,0)=220 B(3,1)=200 B(3,2)=260 You also can print out all thebowling scores orE} elementsautomatically. Please change lines130 to 180 as follows: 130 FOR T=0 TO 2 140 FOR K=0 TO 3 150 ? "F}BOWLER ";T+1;" GAME #"; K+1; 160 ? " = ";B(T,K):REM<--MATRIX 170 NEXT K 180 NEXT T As a practicG}al matter mostprogrammers do no use element 0either in an array or a matrixbecause it complicates the program. DIM tH}he array or matrix for thenumber of elements you have. The FOR- NEXT loop starts with 1 instead of0. See the program belowI}. 10 -- 20 CLS:?:? 30 DIM B(3,4) 40 FOR X = 1 TO 3 50 FOR Y = 1 TO 4 60 ? "BOWLER ";X;" GAME #J}";Y 70 INPUT "SCORE PLEASE ";S 80 B(X,Y)=S:REM <--MATRIX 90 ? 100 NEXT Y 110 NEXT X 120 PAUSE 6K}0 130 -- 140 ? "LET'S SEE IF IT WORKED?" 150 FOR T = 1 TO 3 160 FOR K = 1 TO 4 170 ? "BOWLER ";T;" GL}AME #";K; 180 ?" = ";B(T,K):REM<--MATRIX 190 NEXT K 200 NEXT T STRING ARRAYS -------M}------ TURBO-BASIC and ATARI BASIC donot allow string arrays. This is nobig problem. We create a PSEUDOSTRING ARRAY N}that looks and acts likea normal string array. We take a longstring and chop it into equalpieces. In order to create thisO}PSEUDO STRING ARRAY we must docertain things. 1)Decide how many elements we need 2)The length of each elemP}ent 3)Calculate the end of the FOR-NEXT loop and the STEP For example, we want to create astring array thaQ}t has 7 elements andeach element is 10 letters long. Wewill call the main string X$. To findout how much to DIM X$ we multR}iplythe number of elements times thelength of each element (7 x 10 = 70).We now DIM X$(70). The FOR-NEXT loopstarts with S}1 and ends with the DIMin this case 70. The step is theelement length(10) 'FOR N = 1 TO 70STEP 10 Since the words we T}put into thestring array will be shorter than 10letters, we use PAD$ which has 10empty spaces to pad each substring oreleU}ment so it is 10 letters long. Wecan visualize this as follows: X$ ----------------------------------- V}| | | | | | | | |EL 1|EL 2|EL 3|EL 4|EL 5|EL 6|EL7| | | | | | | | | --------------W}--------------------- 1 10 20 30 40 50 60 70 Elements or substrings start andend as follows: ELEX}MENTS OR SUBSTRINGS Element 1 = 1 to 10 Element 2 = 11 to 20 Element 3 = 21 to 30 Element 4 = 31 to 40 Y} Element 5 = 41 to 50 Element 6 = 51 to 60 Element 7 = 61 to 70 It looks as if each element isonly 9 lettZ}ers long. These numbersare inclusive so each one is 10letters long If we have a FOR-NEXT-STEP loopwe can generate th[}ese numbers. 10 FOR N = 1 TO 70 STEP 10 20 ? N, N+9 30 NEXT N The result of this loop is asfollows: \} 1 10 11 20 21 30 31 40 41 50 51 60 61 70 This is the way the programw]}ould look. Please key in this shortdemo program. 10 -- 20 CLS:?:? 30 DIM X$(70),SUB$(10),PAD$(10) 40 PA^}D$=" ":REM FOR PADDING THE SUBSTRING 10 SPACES 50 REM ASSIGNING PSEUDO STRING ARRAY VALU_}ES 60 FOR N = 1 TO 70 STEP 10 70 INPUT "GIVE ME A WORD(MAX 10 LETTRS)";SUB$:? 80 SL=LEN(SUB$):REM LENG`}TH OF WORD 90 IF SL<10 THEN SUB$(SL+1)=PAD$:REM PAD TO 10 LETTERS 100 X$(N,N+9)=SUB$:REM PUa}T VALUE INTO ELEMENTS 110 NEXT N 120 -- 130 ?:? 140 REM DISPLAY PSEUDO STRING ARRAY b} 150 FOR N=1 TO 70 STEP 10 160 K=K+1:REM COUNTER 170 ? "ELEMENT ";K;" = "; X$(N,N+9) 180 NEXT N c} 190 -- A line by line explanation ofthis program is as follows:10 Draw 30 dashes20 Clear the screen30 Dim X$ ford} the total amount of all the elements. The SUB$ is the length of an element. The PAD$ is the length of an element40e} PAD$ = is the length of an element(10). It is used to pad a word that is too short - less than 10 letters50 Rem exf}planation60 FOR-NEXT-loop. It starts with 1 and ends with the number of elements(7) times the length of each elemeng}t(10) or (7x10=70).The step is the length of the element(10)70 INPUT the words80 Find out how long each word is.90 Ph}ad each word to 10 characters100 Fill the elements or the SUB$ with words. The sub strings or elements are 1-10, 11-i}20, 21-30, 31-40, 41-50, 51-60, 61-70110 End of loop120 Draw 30 dashes130 Print140 Rem explanation150 FOR-NEXT loop.j} See explanation on line 60160 A counter that counts the number of elements in the array170 Print the elements in Xk}$(N,N+9) The substrings or elements in X$ are 1-10, 11-20, 21-30, 31-40, 41-50, 51-60, 61-70180 End of loop190 l}Draw 30 dashes You can also print outindividual elements of the stringarray. Please change the followinglines. m} 150 N = 0 160 INPUT "WHAT ELEMENT DO YOU WANT TO SEE";N 170 ? "ELEMENT ";N;" = "; X$(N*10-9,N*10n}) 180 GOTO 150 >>>>>>>>>> END <<<<<<<<<<4 ELEMENT ORDER---- ------- ------ -------------1 [3,2],7,1 SWITCH 2,3 2,3,7,12 2,[3,7],1 OK 2,3,7,13 2 p},3,[7,1] SWITCH 1,7 2,3,1,74 [2,3],1,7 OK 2,3,1,75 2,[3,1],7 SWITCH 1,3 2,1,3,76 2,1,[3,7] OK 2 q},1,3,77 [2,1],3,7 SWITCH 1,2 1,2,3,78 1,[2,3],7 OK 1,2,3,79-12 OK 1,2,3,7 If we want r} to sort in reverseorder from HIGH to LOW than we canchange the greater sign(>) in line140 to less(<). Please key in s}this short demoprogram to see how it works. 10 -- 20 REM PUT NUMBERS INTO ARRAY 30 CLS:?:? 40 INPUT "HO t}W MANY NUMBERS TO SORT";K 50 DIM A(K):? 60 FOR X = 1 TO K 70 INPUT "GIVE ME A NUMBER";N 80 A(X)=N u}:REM<--ARRAY 90 NEXT X 100 -- 110 REM BUBBLE SORT 120 FOR T = 1 TO K 130 FOR Y = 1 TO K-1 140 I v}F A(Y+1)>=A(Y) THEN 180 150 TEMP = A(Y) 160 A(Y) = A(Y+1) 170 A(Y+1) = TEMP 180 NEXT Y 190 NEXT T w} 200 -- 210 REM PRINT SORTED NUMBERS 220 ?:? "SORTED NUMBERS":? 230 FOR L = 1 TO K 240 ? A(L);" ";:REM< x}--ARRAY 250 NEXT L 260 -- MINI SORT The MINI sort is faster than thebubble sort. This sort fi y}nds theminimum valued element and places itin the first position of the array.It keeps on doing this until allelements ar z}e arranged from LOW toHIGH. In our program in line 50 weuse E=K. K is the number of elementswe have. The sort reduces K to {} 1. Weneed the value of K to print out thearray, therefore we make it equal toE. Please key in this short demoprogra |}m to see how it works. 10 -- 20 REM PUT NUMBERS IN THE ARRAY 30 CLS:?:?:K=0 40 INPUT "HOW MANY NUMBERS T }}O SORT";K 50 DIM A(K):E=K 60 FOR X = 1 TO K 70 INPUT "GIVE ME A NUMBER";N 80 A(X)=N:REM<--ARRAY ~} 90 NEXT X 100 -- 110 REM MINI SORT 120 Y=A(1):Z=1 130 FOR R = 2 TO K 140 IF A(R)>=Y THEN Y=A(R): } Z=R 150 NEXT R 160 SS=A(K):A(K)=A(Z):A(Z)=SS 170 K=K-1:IF K>1 THEN 120 180 -- 190 REM PRIN }T SORTED NUMBERS 200 ?:? "SORTED NUMBERS" 210 FOR T = 1 TO E 220 ? A(T);" "; 230 NEXT T 240 -- } SORTING STRING ARRAYS ===================== THE STRING BUBBLE SORT For a full understanding of aST }RING BUBBLE SORT please read thesection on PSEUDO STRING ARRAYS andBUBBLE SORT first. First we set up a PSEUDO STRING }ARRAY. Without a string array youcannot sort strings. We are going toenter 4 words: ZERO ALL HOUSE COM }PUTER A String Bubble Sort works thesame way as a number Bubble Sort,except each element is longer. Weswitch element }s if they are not inthe right order - small to large. Theelements or substrings in thisdemonstration are: 1 to 10 (Z }ERO------) 11 to 20 (ALL-------) 21 to 30 (HOUSE-----) 31 to 40 (COMPUTER--) The confusion comes when we ha }veto specify the substrings or elementsfor switching. In order to clarifythis we use line 180 to assignvariables to these } values. B(beginning)=Y E(ending)=Y+9 BB(begin next higher elemt)=Y+10 EE(end higher elemt)=Y+(10+9) } Please type in this short demoprogram to see how it works. 10 -- 20 REM INPUT WORDS INTO ARRAY 30 CLS:? } 40 INPUT "HOW MANY WORDS TO SORT";K 50 DIM A$(K*10),SUB$(10), PAD$(10),TEMP$(10) 60 PAD$=" } ":REM 10 SPACES 70 ?:? "MAX. LETTERS = 10":? 80 FOR N=1 TO K*10 STEP 10 90 INPUT "GIVE ME A WORD";S }UB$ 100 SL=LEN(SUB$) 110 IF SL<10 THEN SUB$(SL+1)= PAD$ 120 A$(N,N+9)=SUB$ 130 NEXT N 140 -- }150 REM STRING BUBBLE SORT 160 FOR T=1 TO K*10 STEP 10 170 FOR Y=1 TO (K*10)-10 STEP 10 180 B=Y:E=Y+9:BB= }Y+10: EE=Y+(10+9) 190 IF A$(BB,EE)>=A$(B,E) THEN 230 200 TEMP$=A$(B,E) 210 A$(B,E)=A$(BB,EE) }220 A$(BB,EE)=TEMP$ 230 NEXT Y 240 NEXT T 250 -- 260 REM PRINT SORTED WORDS 270 ?:? "SORTED WORDS:":? } 280 FOR L=1 TO K*10 STEP 10 290 ? A$(L,L+9) 300 NEXT L 310 -- A line by line explanation ofthis program i }s as follows:10-140 See the section on PSEUDO STRING ARRAYS150 REM explanation160 Outer Bubble Sort loop. K=numbe }r of words X the element length. STEP = element length170 Inner loop must be 1 element less than the outer loop. Th }at is why we have (K*10)-10180-220 We examine each element. If the 2nd element is larger than the first element }then it is OK. (small to large) - no switching. If it is not in the right order then we do the switching, just } as we did with the number bubble sort.230 End of inner loop240 End of outer loop250 30 dashes260 REM explanation27 }0 Print280 Loop to display sorted words290 Print sorted words300 End of loop310 30 dashes If you want to sort larger }strings lets say 20 characters longthen change every reference from 10to 20. They are in lines 50, 60, 70,80, 110, 1 }20(N,N+19), 160, 170(E=Y+19, BB=Y+20, EE=Y+(20+19), 180,280 (A$=L,L+19) If you want to sort from Z to Athen change the } (>) in line 190 to(<) THE SHELL STRING SORT --------------------- The SHELL SORT is much fastertha }n the BUBBLE SORT. The reason itis faster is that the number ofcomparisons to be made is reduced. If you try to sort }2 words orless than you will get an errorbecause in line 90 the FOR-NEXT loopbecomes an illegal reverse loop (FORT=1 TO 0 }) In line 210 we assign variablesto the element beginning andendings. B(beginning of element)=Y*10-9 E(endi }ng of element)=Y*10 BB(Next higher elmt)=Z*10-9 EE(Ending element)=Z*10 Please key in this short demoprogram t }o see how it works. 10 -- 20 REM INPUT STRING ARRAY 30 CLS:? 40 INPUT "HOW MANY WORDS TO SORT"; }K 50 DIM A$(K*10),SUB$(10), PAD$(10),TEMP$(10) 60 PAD$=" ":REM 10 SPACES 70 ?:? "MAX. } NUMBER OF LETTERS = 10":? 80 FOR N=1 TO K*10 STEP 10 90 INPUT "GIVE ME A WORD"; SUB$ 100 SL=LE }N(SUB$) 110 IF SL<10 THEN SUB$(SL+1)= PAD$ 120 A$(N,N+9)=SUB$ 130 NEXT N 140 -- 150 REM SHELL SOR }T 160 X=1 170 X=2*X:IF X<=K THEN 170 180 X=INT(X/2):IF X=0 THEN 300 190 FOR T=1 TO K-X:Y=T 200 Z=Y+X }210 B=Y*10-9:E=Y*10:BB=Z*10-9: EE=Z*10 220 IF A$(B,E)<=A$(BB,EE) THEN 270 230 TEMP$=A$(B,E) 240 }A$(B,E)=A$(BB,EE) 250 A$(BB,EE)=TEMP$ 260 Y=Y-X:IF Y>0 THEN 200 270 NEXT T:GOTO 180 280 -- 290 REM PRINT }SORTED WORDS 300 ?:? "SORTED WORDS:":? 310 FOR L=1 TO K*10 STEP 10 320 ? A$(L,L+9) 330 NEXT L 340 -- } If you want to sort largerstrings, lets say you want 20characters, please change everyreference from 10 to 20. They are i }nlines: 50, 60, 70, 80, 110, 120(N,N+19),210(B=Y*20-19, E=Y*20) and the samefor BB and EE, 310, 320(L,L+19). }RELATIONAL BUBBLE SORT ---------------------- A relational sort is if you have2 arrays and they are related to }eachother in some way and therelationship has to be maintained.For instance, we want to write atelephone directory progra }m. In onearray we store the names and in theother we store the phone numbers. Weare going to sort the names but thephone }numbers always have to beswitched with the name so the properrelationship is maintained. When we sort with the Bubble }Sort the switching is done in lines240, 250, and 260. It is done asfollows: 240 TEMP$=A$(B,E):TEMP1$= B$(B,E }) 250 A$(B,E)=A$(BB,EE):B$(B,E)= B$(BB,EE) 260 A$(BB,EE)=TEMP$:B$(BB,EE)= TEMP1$ A$ is the }name array and B$ isthe phone number string array. TEMP$is in the name array and TEMP1$ is inthe phone number array. As we } switcheach name during a sort so we alsoswitch the phone number array so itmaintains its proper relationship. We use } a string array for thenumbers because many people use a '-'in their phone numbers and a numberarray would not accept it. }A secondreason is that if a number becomestoo large it is expressed inscientific notation. In our demo program we DI }M eachelement of the name and phone numberarray to 10 to make it simpler tounderstand. Please key in this short demo }program to see how it works. 10 -- 20 REM INPUT NAMES AND NUMBERS INTO THE STRING ARRAYS 30 CLS:? } 40 INPUT "HOW MANY PHONE NUMBERS TO SORT";K 50 DIM A$(K*10),B$(K*10), SUB$(10),SUB1$(10),PAD$(10) } TEMP$(10),TEMP1$(10) 60 PAD$=" ":REM 10 SPACES 70 ?:? "MAX. LETTERS OR NUMBERS = 10": }? 80 FOR N=1 TO K*10 STEP 10 90 INPUT "GIVE ME THE NAME"; SUB$ 100 INPUT "GIVE ME THE NUMBER"; }SUB1$ 110 ?:SL=LEN(SUB$) 120 SL1=LEN(SUB1$) 130 IF SL<10 THEN SUB$(SL+1)= PAD$ 140 IF SL1<10 THEN SUB }1$(SL1+1)= PAD$ 150 A$(N,N+9)=SUB$ 160 B$(N,N+9)=SUB1$ 170 NEXT N 180 -- 190 REM RELATIONAL BUBBL }E SORT 200 FOR T=1 TO K*10 STEP 10 210 FOR Y=1 TO (K*10)-10 STEP 10 220 B=Y:E=Y+9:BB=Y+10: EE=Y+(10+9) } 230 IF A$(BB,EE)>=A$(B,E) THEN 270 240 TEMP$=A$(B,E):TEMP1$= B$(B,E) 250 A$(B,E)=A$(BB,EE):B$(B,E)= } B$(BB,EE) 260 A$(BB,EE)=TEMP$:B$(BB,EE)= TEMP1$ 270 NEXT Y 280 NEXT T 290 -- 300 CLS } 310 REM PRINT OUT SORTED PHONE LIST 320 ?:? " TELEPHONE LIST":? 330 FOR L=1 TO K*10 STEP 10 340 ? A$( }L,L+9);B$(L,L+9) 350 NEXT L 360 -- The two arrays can use the samePAD$ (ln #60) because they are thesame size. } They can use the samebeginning and ending element numbersbecause they are the same size (ln#220) If you want a printe }d list pleasechange lines 320 and 340 from PRINTto LPRINT. In a similar manner you couldhave a relational sort between } anumber array and a string array. Forexample you want to sort by score abowling league. The sort would bedone on the sco }res(number sort) andthe names would have to maintaintheir relationship to the score. To get a clear understanding ofre }lational sorts, please read thesection on ARRAYS, PSEUDO STRINGARRAYS, NUMBER BUBBLE SORT and STRINGBUBBLE SORT. If y }ou have any comments orsuggestions about these tutorials,they are welcome. Please write to: RON. FETZER } 22 MONACO AVE ELMONT, NY. 11003 ADDENDUM -------- ********** } Sometimes it is necessary toconstruct a string array in adifferent manner than I have shown.For example we want a string } arraywith 21 letters. This is an alternateway of doing it. 10 DIM ARRAY$(5*21),B$(21), PAD$(21) 20 FOR }X=1 TO 5 30 PAD$=" " 40 INPUT "GIVE ME A NAME";B$ 50 BL=LEN(B$):IF BL<21 THEN B$(B }L+1)=PAD$ 60 ARRAY$(X*21-20,X*21)= B$:REM ARRAY 70 NEXT X In line 60 X*21-20,X*21. Thiswill create }the element length thatwe previously used a FOR-NEXT-STEPLOOP for. In all other respects theprogram remains the same. For }example, when X=1 the elements willbe (1*21)21-20 or 1 the other numberwill be (1*21)or 21. Thus the elementlength will be } 1 to 21 on the firstpass of the loop. In a similar mannerall the other element numbers willbe generated. >>>>>>>>>> }> END <<<<<<<<<< ELMONT, NY. 11003 ADDENDUM -------- ********** Sometimes it is necessary t"}oconstruct a string array in adifferent manner than I have shown.For example we want a string arraywith 21 letters. This "}is an alternateway of doing it. 10 DIM ARRAY$(5*21),B$(21), PAD$(21) 20 FOR X=1 TO 5 30 PAD$=" }