@L|}6CD l0C)HCC WhL/h `CmCDiD`  R@W1  Y0@R !L` D  C D     )16CS S)  C)D1 p p 0 C9DI pCDL~CiCDiD` D  C D     )16CS S)  C)D1 p p }0 C9DI pCDL~CiCDiD` DD˙` d J)L !}D L(( LL()  L| L( S LH 0p n  } CY?  q  L L  ` )} `A! d߰")-݆ "  $G@LLL&0") $G% }H0 3S8`G ȱG ȱG   Gȭ Gȭ GG}GHiH8(()) G$H% `(0 })8` d)L ݆ & LGȘ ݆LL d  ! LL d)N>Q  HH) }  hyhyB q L> Lm JJ  Ln*` dB%' }8  H H` 1 { LL   !L     Hh SY?  q  1L }  !? S   q 1 L   Ll  Lg E`L   !L)  q 1L}) `L0AM݊L݉ ML  N݆LLLNLMLHG!@}1F GȱGLLEEȩÑEȑEEȑE Ed E7EȩE  q} L !,0,0SGɛ L 1 !L EHEh W G gLLSROTCES EERF } G) *Gȩ GȽG GȌd q q G`  8   0G  `D}CEDC0X:Ȣ Y ȱC* ? 0.. , 0%n ?A[ 0 : L`L  `, 0`Y}`piH n0)բY? 08`0 }  0$L GGȽG L `8L`L}8`  05G)݁,G)ȱGȱGHh0})Hh` B! 8`8iiiLE`}E8FEh( l0`ɃLL L8^~jj8jHi hEEEiEȱEiE` dTE} H8EEȱEEȩEh J E8   . m  i`LI!)E1FR}1LJ舩9GIH`LJJ`HGHh l`} S gL   8 rii `дCDCG W  }C  Lq` X٨`DOS SYS IIIIIIIIIIIIIIIC`0 ߩ0}}} HE |||||DOS DOSDOS SYS }}}}CDOS SYS} 0`BDELV !B }`LVUQ   ]   TU J ]L!T  #      TU  } L ? .  t`GBJ V~DEHI B V0dV!}QDEHI VF9 ,0 ,0 s0hhL  L` H hDHEh"}DEL8HI   0 HI,0 0  9 .G VLO#},0 L4*IJ`llD1:AUTORUN.SYSNEED MEM.SAV TO LOAD THIS FILE.D1:MEM.SAV J y08 B|DEHI$} V0 0`B;DELV䌚 !B y`@ʆ v s? F0Ξ05: [ BDEHI%} VY8 B V  @  /DE `E:D1:DUP.SYSERROR-SAVING USER MEMORY ON DISKTYPE Y TO &}STILL RUN DOS B;DE J V (` 9 V⪍ ઍ  -'}LLu DEHILV 9 .l 9 .l  `` s$B VBH(}I|DE V BLV nB,DE J V* \*` B V BLVDEHI BLVL)}1u H232435; 1 ;  hh@2 e1i1LHҍ 00) 08 109hh@ Ҡ2e*}1i1232435ޥ<<8} 3E:}DISK OPERATING SYSTEM II VERSION 2.0SCOPYRIGHT 1980 ATARIA. DISK DIRECTORY I. FORMAT DISKB. RUN CARTRIDGE J. D,}UPLICATE DISKC. COPY FILE K. BINARY SAVED. DELETE FILE(S) L. BINARY LOADE. RENAME FILE M. RUN AT ADDRESSF. LOCK F-}ILE N. CREATE MEM.SAVG. UNLOCK FILE O. DUPLICATE FILEH. WRITE DOS FILES9!&x#!7&p))'&X*./)L''-؆莟.}R'S  vW DEHHI 1A#! @ ~0ɛ8A0.) ȅ 1 1i/}il ! 1L NO SUCH ITEMSELECT ITEM OR FOR MENU! 0 .{z:*{}.|~ 1 0 00}JB 18L^%|DLl%DIRECTORY--SEARCH SPEC,LIST FILE? # 0 0 n&|D! 1L NOT A DISK FILE1}N !B 1L " 1 !BDED:}:1BJ|DE 1DEBH2}I 1 h0ߢ 0.  0?詛 1 ~0YЛ 1 "L<" "L 3} BL1TYPE "Y" TO DELETE...DELETE FILE SPECCOPY--FROM, TO?OPTION NOT ALLOWED COPYING---DN:4}# 0|D .L$A#B#C#JB|DE 1BHIDD#E 1D#0: B5} 1L B#C#C#B# B 1N#$0SYS1}:e#D# d# D# .d#ȽD# d# 𩛙d#X# 1,A#6}PdD#ELO- A.BJdD#E 1 1HH 0hh|DL^%1}:e# Lt% e#dD#EL%7} 1 0 . .0% 1L WILD CARDS NOT ALLOWED IN DESTINATION 0 A.|K@C}//3Hu ξL/L DRIVE TO WRITE DOS FILES TO?WRITING NEW DOS FILESTYPE "Y" TO WRITE DOS TO DRIVE 2.?}D2:DOS.SYSERROR - NOT VERSION 2 FORMAT. , &* բ( 1L `[) 0NΞ 0 L1M) 1@} L BAD LOAD FILELOAD FROM WHAT FILE?) 0 0#B 1L WHAT FILE TO LOCK?) 0 0$B 1L WHAT FILE TO UNLOCK?DUA}P DISK-SOURCE,DEST DRIVES?TYPE "Y" IF OK TO USE PROGRAM AREACAUTION: A "Y" INVALIDATES MEM.SAV. h  ,B}  `)  <0 2 2 0  ,   ,,ޢ* 1L ,K* 1 ~0 0C}FINSERT BOTH DISKS, TYPE RETURNERROR - DRIVES INCOMPATIBLE., 1 ~038  , 1L D}, &*  Lz+, 0 , 1 ~0 + Y,0!,0 ,L+ ,mm  v,"ǭE}0Ξ, 05,Lt+L +,Hh` NOT ENOUGH ROOMINSERT SOURCE DISK,TYPE RETURNF}INSERT DESTINATION DISK,TYPE RETURN`    `L,8,0( rG}L1(`ߢ) 1* 1 ~0Y`hhL S SL1) 8`NAME OF FILE TO MOVE?- 0 0|DLtH}% A., 1 <0 0 .@L# .BJ 1  DEHIB V L1 ,5 1 <0,L. I} JB|,A#Pd#DE 1 HI BDEHHII 1 B 1 , 1 <0,0Lf- B VJ},A#P, 1 <0 0L#L ߢ) 1* 1 ~0Yj383}mm ݭK}}`8}``|* ? ɛ,`|:(|/ 1L `DESTINATION CANT L}BE DOS.SYS0 0H{ $22Δ $28/L /) $2 Π $2 0 ξM}hAΞB,0 J 1 BޝDEHI,HDE 1HIHIDELSAVE-N}GIVE FILE,START,END(,INIT,RUN)O X0 1`BDEPHI V` X0H 1 L O}0 0 1L0`PLEASE TYPE 1 LETTER,0`hhL <0 1L0LA1 ,;ɛ7,"ɛ:ݦ1ݥP}A"D|ݤD|ȩ:|ȩ|ɛ,,(/+.ީ1 1,ɛ`轤{Q}NAME TOO LONG B VL ` L1I H1EӝDL1|mDiE` V0`8d/8 i:"2!22 1R} L ERROR- 128ɛ+,' 20*.. өw2 1``2TOO MANY DIGITSINVALIDS} HEXADECIMAL PARAMETER800 0 8 00`,0'D800H,ɛh`2L1NEED D1 THRU D4uT} HEXADECIMAL PARAMETER800 0 8 00`,0'D800H,ɛh`2L1NEED D1 THRU D4u@aA B VpjB@DE J VR @ B@ @@ @A @A @1A @IA @RPV}?@     Y0  Y0 l `DEHILV@ @`E:W}| BASIC Design Tool || Version 1.0 || Copyright 1983 MECA |@@X}ssLv)u~syuvytLstosjtsssssssssssssssssssssPsQsRss s msmns%vls&vY}mssRsQsPsllsHHH2ҩҩ*Ҡ thhh``H#shlsHHH#s#s stEO%NstEO%N ԌЌЍ5Z}#ssnsv v kttxhhh@    t  )uxu[}vw]]] իͫͫT\}µµ궾ǶʶUUUcccAEEpppzyyɢ ` ns v]} v v L`w v B VpjBwDEwx J VR w Bw rww rww rw̩w rww rw^}w rwRxx sX`DEHILVw w`E:| BASIC Design Tool || _} Version 1.0 || Copyright 1983 MECA |x yH 7 ɟ I&H)?hLRxh`}gɧM0+hh@MsgLRxnsvv ɍxhh@vゥvXɧa} sL} ysQs z/ԍԭs0s1!s"ss" yzs#s$sԩ"/` ysLys zb}ԍ$s/ԍԭ0s1sǍ0z1!s"s t"s#s"t#sԍ ԩ"/`zc}10s0s1ss x`˅̠̦ࠐ z{정 }MECA BASIC Design Toolu }Line#d} BP: }Stack: Level= Top=ǩ˅̩Ls|˩(e˅˩e̅Ls%hs0 gsesfsisjsks lOse}Lss և G`pppŒ´B4ԞBtğAz{|tepunontinueracespeed f} otoapereakpointg} togglebetween"$4"!3)#screen reset||programandbreakpointsh} setorclearvariablebreakpoints ii}nitiateanewvariablelistentryorbreakpointsetting5setheand|}keystoscanvarij}ables logicaloperatorsandvariabledimensions0ressagaintosettheentry˅hhk}Π ]eͨeHH` y )y@_s[s ~Enter command or press ? for help}HHL}~~)?&Ll}L> ~>StepL- ~>Trace (speed=1)YsLÂL6(L0= ~>Goto Lx ~>BreakpointL΃LLXLm}Li,Lԉ s)MjLQjL^jLLL}'ğğ`hhΠ[sȱ ]ğL~~Rs(ʝğRsn}eͩͅeHH` zz{z ~Enter command ) zzz ~Enter command or press ? for helpL}o} xesfsgshsisjsks THTh{I{Ls L  ncs Bncs l G ` # ဩZp}sZs )y` `+0 ()sZs x`0& os xsL7ȄH h  L LLL nsv˽vq}HȱH` s sՅԅ s (hihiHH`Ls s rsL`` s sԅ sƳ rs`esfs聥r}gshsisksjsğ'0)eeȱ0ȱȄ` )y G sL}'Ԟ 4X^Y_ @s}` ԅX^Y_ @` ȱ إ󅕥 s s`'X`$%sʥ%sʭ%sʭ%sʭ%sʭ%sʥ{%sʠ %st}%sʈc%sʵR%sT'SR]UGKsFJsGF`$%sʽ%sʽ%sʽ%sʽ%su}ʽ%sʽ%s{ʠ %sʈ%sʈ%scʽ%sRKsGJsF`US`HHHhKsHJsH`Ys Us8HUsUsVs)v}jjj ! v0:L)y ]ğ8YsYs8VsUs cs) )y`L s x )y'4 l w} GL}  ncs Bncscs)L@ią˩i̩\s]s F` ͆ sLx ٰ0񅡥ԅ s sLȱȄ l`s x}^ )yUs܄Nsjj: [sUs ~variableL ~line numberjjUsLLۄ)? t h_` y} L XL L Lバ sLラUs t`Us h` tNsNsNs _t` tz}NsNsNsLL݄؅sLs )I@HLs ihLsLs )I@ i Ls ytyt` Ls tyt{tyt{t ^{}jjL)? LC XLC LC iLC sLC @ ^LsHUsLs H)I@h) UsUsHhLsLs|}ݢUsjhLsLs @H مԆh)u)u ^jjL9)? )u)u ;L )uL sL}} ^]sLs Ls 䐠0L\s F 蘝)uH h D͈L\s FH h ͆ ssL9͈ ɍLs`~}Nsi it˩i`ՆЇ D `LsbsLsLsLsbsLs` )I@)uLs Lsj}ɠ͙H s hLҩӠ͙ s )ui s s ٥L )u h sbsLs8`ҩ8包}ԥ卅 )uօةׅ s )uӵi/LiLsbsLsLsLs )I@)u ɍLᇭbsLs`Ns iͩivΠ ˆ }e˅˩e̩̅\s]s F ˆ t h_` ͆ sL! ٰ0ԑȥՑ ˆ\s]s FL ͆ sL }ٰԠȑLHNs ˆNs ˆNs я ͈ȉˈͅȱͅ` ̠ȱ0ȱH) ]hȩ ȘHͅԩ }he˅˩e̠̅ȱ0ȱH) ]h`NsdsNsNsdsj` я tLKȱ tLKŠȱšȱͪʊ }ˆ t sdsLKNsNsNs` я͈ɉĊ tLLsLs )I@ )uI)u ɍLs`s' hˮLsLs} )I@ h_` H hL/ h)u)u ;`s) hˮLsLs )I@ h_` Ș)}u  )u)u ;`sL5LsUsPLs Ŋ)I@ ytytLs )u.uLs yt{tyt{tLs0 Us}LsЭUsLs )uLs ytyt `+Ws )@)umUs)u)umVs)u ;`sfLsUs+Ls )u}$uLs ytwtytwtLs )uLs ytytUsLs )I@ `+Ws )@8)uUs)u)}uVs)u)u ;`Ws<Ws(3Usȹ3Vs` d h'ˈ|ˈ Osˈ `H)I@U breakpoint if <}=<>>=< > = hi ] )u y ] OsȽy ] Os`h SsH$ ($hL-LH)u )uʩ)uh ]}tștȌTs h$ TstȌTs TstȌTs8SsTsSs0' ] OsȑSs숱)$"( OsLo)$ ( ] Osȑˮ}SsTsȽt OsTs`LsHLs ; ɍLshLs h_`LsHLs ɍLshLs` he˅˩e̩̅ˈ `H})I@hh h )u  )u ˩e˅˩e̅Ls Ls H h$L)u֩ץͅ΅Lxh 䐰1H)}#hw ]ˈ`not yet dimensioned h0LL͕Ԉ ؠȱ0ȱH) ]h` )uȽ)uͰ%Ƚ)uȽ)uͰ} ⏥ԅͥՅ΢Lȹ ]`element out of range )u)uՠͅȱͅ᥌e्eȱͅȱͅȥȥ }ȥͰeͥeΥee8ͅԥ΅Ր Aˈ0 ]ˈ`) Us mUsiyͩiu`Ns } iͩiv`)u)u)u)u٠ͅȱͅօנJ uveԅԥeՅ&եԤ&eԅԘeՅՠeԅ}ȱeՅեeԅԥeՅ`̭Ls &e˅˩e̩̅e˅˩e̅`Ls mLs)u`?)MsͥΥń兰(Ms0ȱȘe}ͩe΅Lȱ)`8`)MsέMs & & &eͥeΥň`)u)uՊH خTsȹ0ȹH) ]thTsh`}]sˈ ɛ`~]sˈȑLS ]]sLS\s^s@_sas v`sɀLɁ ^sI^sLɂ}_sLɃ@_sLɄ_sLas@`sa{ _s asL`s4 M^s`s\s$  sL`0123456789+-.E~}~}RsH****)h)YRs` @`RsH****)h)rRs`@ `RsRs`lj;k+*opui-=vcbxz436521, .nm/reytwq }hi9!!LETOHEATOEXALINKPTKENPRINAOURPRINSCHITKEGOBASIGOBDBRANCINKEBDSCRSETBDRESTBDKEB }  } 6-@̮d36-AuU6-AuR }'6-AuH36-AuXn(;A,6-@(6-c6-A6-AP'6-A36-A%?6-AP }K6-AW6-Ac6-AP+ 6-6-A!6-AP+ A$67B:,%,.!6-?::A(%@:,,3@ }9 <$)& >:A(%@:7@<@,,,)$,A-@@#= " to move on or for helpA ED- }@@#@ % for ï or for helpD ^>-@@#> # for or for help } 6- )"@:B,'6-&@) AP"@:F,' AP0"@:T,'&6-?:,0  }A*"@:C,' 6-?:,* A>"@:?,)"@:/,6-+%A(46-?:,> A ( $ }'6-&OO%@A AA A0A@APA`Agg&@ABB }B B0B@BPB`BpBBZ@(@@K:5)@@ }@L!A(Z6-&A(!@6-&@2$& + -+11 (ԭ }0]6-?:<,06-F:A ,%F:A!,$AV>-@V%$@A(%Z ]$  ԛ*e%6-F:A },%F:A!,$AV3-@I%$@A(a%$@%@e 48-@1%$@%@@ }A)%5 8$R ԛ\R%6-F:A ,%F:A!,$AV3-@K%$@A(%O R$ 6- }?:, A 6-?:,LIAR!-@@ I " to move on or for helpV 6-  },,6."Look at the following program:_3\\bb67B:,%,.P10 DATA 1,5,7,13,17\20 FOR I=1 TO 5\30 READ NUMBER\40 PRINT NUM }BER\50 NEXT I_0\\jj67B:,%,.XLine 10 contains the to be into the variable in line 30. Line 40 will  }))67B:,%,.print and lines __67B:,%,.M20 and 50 are a ү loop that will step through the five pieces } of DATA.,,67B:,%,.\\5Let's watch it in BDT.*  6-@(    cc6.Y9USING ARRAYS\\The usefulne }ss of and cannot be fully appreciated until we use  mm67B:,%,.[. You know that a variable holds a sing }le value. An holds a .\\ kk67B:,%,.YVariable: Array:\3AGE=17 AGE(0)=12_%\AGE(1 })=14\AGE(2)=29\AGE(3)=2_0\\ dd67B:,%,.RThe AGE actually contains 4 different variables which share the same name. }\\ UU67B:,%,.CWe say for Ũ.\We say for Ũ etc.     LL6.BArrays are } useful because variables can be used to them.\\3dd67B:,%,.RAGE(A) (Pronounced )\\means:_3\\Take the v }089qPBhdA@PBtIAVAD ;AAD'BByAD;6-A<} --6.#5THE DIM STATEMENT\\We tell BASIC hh67B:,%,.Vthat we want an by using the ension statement.\\ } 41D2:E.51 ;@,-- %PLACE A INITIALIZED DISK IN DRIVE ONE## PRESS WH lements 2267B:,%,. 4because the array starts at 0.GG67B:,%,.5\\\But how do we use arrays?\\We're glad you aske }d...   p znn6.dOne way to use is with and statements.\\The next example ensions an array } named mm67B:,%,.[CARPRICE, initial values into the array, and then allows us to look up values in it. #  }  6-@) # @ JUU6.K9SORTING ARRAYS\\It's time to really use arrays to their full advantage.\\Tnn6 }7B:,%,.\ is a technique by which arrays can be , or list can ^KK67B:,%,.9be }.\\By this we mean taking an array like:\\hYY67B:,%,.GA(0)=12 A(0)=-1\A(1)=19 } A(1)=3\rYY67B:,%,.GA(2)=7 and ending up with A(2)=7\A(3)=-1 A(3)=12\|5567B:,%,.#A }(4)=3 A(4)=19   (# 2#mm6.cThere are many ways to . Here's the simplest. It's called } a because out-of-order <#gg67B:,%,.Uelements 'bubble' to the correct place in the array.\\Run the sample pr }ogram several F#\\67B:,%,.Jtimes in BDT and pay careful attention to the that actually sorts.##   6 }-@0 # ' 'PP6.FDid you notice how long the bubble sort took?\\To sort 10 numbers the $'kk67B:,%,.Yprog }ram had to compare 9 pairs of numbers 10 times. The more numbers we wanted to sort, .'WW67B:,%,.Ethe longer it would ha }ve taken.\\And you thought computers were fast!j'   * +::6.0Did you understand the comparison statement?_3\\ }+kk67B:,%,.Y130 IF NUMBS(J)>NUMBS(J+1) THEN_7\HOLD=NUMBS(J):\NUMBS(J)=NUMBS(J+1):\NUMBS(J+1)=HOLD_0\\+]]67B:,%,.KJ }is being varied from 0 to 6. The in the statement looks at +::67B:,%,.(NUMBS(J) and tests if it is larger } than  +dd67B:,%,.RNUMBS(J+1). If it is, then the two are and must be . First, *+ff67B:,%,.TN }UMBS(J) is moved to a variable called HOLD. Then NUMBS(J+1) is moved to NUMBS(J). 4+\\67B:,%,.JThat's why we moved NUMB }S(J) to HOLD. Then HOLD is moved to NUMBS(J+1). >+**67B:,%,.This completes the .R+   . .qq6.gLet's } run this same example under BDT again. This time enter the numbers 1,2,3,4,5,6,7,0 to be sorted..;;67B:,%,.)\\Watch h }ow the 0 bubbles up into place. :/#   6-@0 # 2 2gg6.]You should understand and to } go on. If you have any doubts, please review this 2hh67B:,%,.Vchapter up to this point.\\Let's enter BDT again and ru }n the same sort one last time. 2<<67B:,%,.*This time give it 0,1,2,3,4,5,6,7 to sort."3#   6-@0 # }6 6mm6.cDid you notice that the program went ahead and sorted the numbers even though they were already in 6kk67 }B:,%,.Yorder?\\How dumb!\\The next sort sets a during each pass through the array if any 6ll67B:,%,.Zswaps we }re made. After each pass the switch is checked for swaps. If no swaps were made 68867B:,%,.&then the array is complet }ely sorted.\\6WW67B:,%,.ETry this one several times and see how much smarter and faster it is. 7#   6-@1 } # : :hh6.^Hold onto your hats.\\Now were going to get fancy.\\\Did you notice the preceding sorts could :c }c67B:,%,.Q , but for each pass through the :MM67B:,%,.;array?\\If y }ou didn't notice this, back up and take notice!:   > >kk6.aOur next sort bubbles down and then up. This way }the most out-of-order elements are grabbed and >dd67B:,%,.Rmoved into place more quickly.\\It also its number }of comparisons during >gg67B:,%,.Ueach pass. This is possible because on each pass the most out-of-order element will }>cc67B:,%,.Qbe deposited in its correct place, and we never need to look at it again.\\Enter >ZZ67B:,%,.HBDT and }try to figure out the 2-directional, shortened-path bubble sort.>#   6-@2 # hB |Baa6.WTry to wr }ite some programs in BASIC/BDT on your own. Some ideas for programs are:\\\_4Bqq67B:,%@,.Y(1) In a FOR/NEXT loop }input ten numbers into an array. After the tenth, print them out Bjj67B:,%,.Xin another FOR/NEXT loop.\\0(2) Initiali }ze an array of ten numbers using READ and DATA Bjj67B:,%,.Xinside a FOR/NEXT loop. Use INPUT to read a number from 0-1 }0. If 0, stop. Otherwise, B9967B:,%,.'print that array element and loop back.B  6- PFc c6. }UThat's all for Arrays, if you want to try writing another of the suggested programs, ZF5567B:,%,.#back up and go back i }nto BASIC/BDT.F   8J$%@6-?:,$ AD2:L.07BRANCINKEBDSCRSETBDRESTBDKEB M[\JYLETOHEATOEXALINKPTKENPRINAOURPRINSCHITKEGOBASIGOBDBRANCINKEBDSCRKEB} } 6-@̮d36-AuU6-AuR'6-AuH36-AuXn(};A,6-@(6-s6-A6-AP'6-A36-A%?6-APK6-AW6-Ac6}-APi6-s A$67B:,%,.!6-?::A(%@:,,3@ 9 <$)& >:A(%@:7@<@,,},)$,A-@@#= " to move on or for helpA ED-@@#@ % for ï or f}or helpD ^>-@@#> # for or for help 6- )"@:B,'6-&@) }AP"@:F,' AP0"@:T,'&6-?:,0 A*"@:C,' 6-?:,* A}>"@:?,)"@:/,6-+%A(46-?:,> A ( $'6-&OO%@A AA }A0A@A`ApAOO&@ABBB B0B@BPB`Z}@(@@K:5)@@@L!A(Z6-&A(!@6-&@2$& +} -+11 (ԭ0]6-?:<,06-F:A ,%F:A!,$AV>-@V%$}@A(%Z ]$ 6-?:, A 6-?:,LIAR!-@@ I " to move }on or for helpV 6-  oo6.eIn general, a is used by typing the name of a function, e.g., (wh}ich we'll explain in a **67B:,%,.minute) followed by the ``67B:,%,.Nfunction's in parentheses.\\For e}xample:_5\INT(3.7)9or\INT(6/A)9or\hh67B:,%,.VINT(-17.9)._0\\Think of this whole string of characters as being evalua}ted for you by bb67B:,%,.PBASIC and having its value put back into your expression.\\So, if INT(17.5)=17,\((67B:,}%,.3then 3*INT(17.5)=51.4      ZZ6.P9THE SQR FUNCTION\\A can be used in an expression wherever }a constant  8867B:,%,.&or a variable name can appear. As an  gg67B:,%,.Uexample, the function calculates the} square root of any positive (>0) number._3\\ ff67B:,%,.T10 A=SQR(9)\\0assigns 3 to A.\\10 A=SQR(9)*2\\0assigns 6 to }A._0\\Now we'll enter  0067B:,%,.BDT and observe in action.   6-@6  TT6.J9THE INT F}UNCTION\\Another function is . It returns the integer part ??67B:,%,.-(without the decimal places) of a number._3\}\ee67B:,%,.SINT(3.14159) equals 3\\INT(-17.6) equals -18_0\\( actually returns the greatest ee67B:,%,.Sinteg}er less than or equal to its argument.)_3\\INT(.6) equals 0\\INT(3/4) equals 0   p zcc6.Y9THE RND FUNCTION\}\A very commonly used function is .\\310 X=RND(0)\\moves a random ..67B:,%,.number between 0 and 1 into kk67B}:,%,.YX. The 0 in RND(0) is a dummy argument. It must always be used, but RND(0) will always ll67B:,%,.Zreturn a }different number between 0 and 1.\\Note: INT(RND(0)) always equals 0,\7because kk67B:,%,.YRND(0) is always <1.\\A co}mmon use of is to generate random integers. The following ii67B:,%,.Wexample uses and to simulate a die t}oss and generates a number between 1 and 6.  6-@8 X boo6.eThe next example is something special.} It's also somewhat mathematical and complicated. It derives lmm67B:,%,.[the value of PI (3.14159...) by using , }, and . (This is the Monte Carlo method.)vgg67B:,%,.U\\If you don't understand the following explanation, don't w}orry. Just skip over it ii67B:,%,.Wand run the example program in BDT. Watch PI get closer and closer to it's true v}alue.   @ J::6.03A DESCRIPTION OF MONTE CARLO PI\\Assume a 2*2 T\\67B:,%,.Jsquare containing a circle} with radius equal to 1. The program generates ^ll67B:,%,.Zrandom points in the square centered on the origin of the x},y-axis. For each point, 1 is hll67B:,%,.Zadded to DENOMINATOR. If a point is less than 1 unit from the origin (insid}e the circle) rhh67B:,%,.V1 is added to NUMERATOR.\\The area of the square is 4 while the area of the circle is |ee6}7B:,%,.SPI. Thus NUMERATOR/DENOMINATOR=PI/4 or PI=4*NUMERATOR/DENOMINATOR.\\Enter BDT and KK67B:,%,.9race to watc}h several hundred loops as PI is calculated.  6-@9 (# 2#mm6.c9MORE FUNCTIONS\\Now we'll quickly r}un through some additional functions.\\_5 (expression) 7#67B:,%,. returns the <#cc67B:,%,.Qabsolute value }of expression, that is expression with it's sign removed.\\ABS(3) F#ff67B:,%,.Tequals 3\ABS(-3) equals 3\\0 Ǩ} returns the base 10 logarithm of P#JJ67B:,%,.8expression. CLOG(0) gives an error.\\CLOG(100) equals 2#  } ' 'kk6.a_5 Ш returns e (2.71828) raised to the power expression.\\EXP(1) equals 2.71828$'bb67}B:,%,.P\EXP(3) equals 20.0855\\0 Ǩ returns the natural logarithm of .']]67B:,%,.Kexpression. LOG(}0) is an error.\\LOG(1) equals 0\LOG(20.0855) equals 3\\08'aa67B:,%,.O Ψ returns\-1 if expression <0,}\0 if expression =0 or\1 if B' 67B:,%,.expression >0.t'   * +^^6.T5TRIGONOMETRIC FUNCTIONS\\There ar }e also some in BASIC.\\_5+8867B:,%,.& Ψ returns the sine  +__67B:,%,.Mof } expression.\\0 Ө returns the cosine of expression.\\0 +dd67B:,%,.R Ψ returns the } arctangent of expression\\0 tells BASIC  +dd67B:,%,.Rto treat all expressions in trig functions as .\\ }0 tells BASIC to *+((67B:,%,.treat them as .\+   . .kk6.aDid you notice that there is no  }gent function? For this and other trig functions you have to .ee67B:,%,.Scalculate what you need from , , and} .\\For example,_3\\TAN=SIN/COS\SECANT.67B:,%,. =1/COS\etc.D/   2 2ee6.[THE PEEK FUNCTION AND POKE }COMMAND\\There is an additional function to look at, and a 2JJ67B:,%,.8associated command, . lets you lo}ok into your 2kk67B:,%,.Ycomputer's memory -- one (8 ) at a time. lets you change what's in memory.2dd}67B:,%,.R\\As an example of we have programmed a digital clock. It works like this:\\2ee67B:,%,.SMemory locat}ions 18, 19 and 20 together keep the number of 60ths of a second since 2ii67B:,%,.Wyou turned on the computer. The pro}gram asks for a starting time and then keeps track 34467B:,%,."of elapsed time. Watch it in BDT.,3  6-@@} 6 6oo6.eWell that's pretty much it for functions. Why not try using them to write these suggested programs: }6hh67B:,%,.V\\\_4(1) In a FOR/NEXT loop, print out the square (SQR), the sine (SIN) and any other 6ff67B:,%,.Tfunct}ions you care to of the numbers 1-100.\\0(2) Roll a 20 sided die, 100 times.\\6KK67B:,%,.90(3) Input NUMBER. Roll a }NUMBER-sided die. Try again.7  6- :i i6.[Well, you can probably function pretty well on a comput}er now! If you need more practice, :;;67B:,%,.)back up and try to write another program.:   >$%@}6-?:,$ AD2:L.08PTKENPRINAOURPRINSCHITKEGOBASIGOBDBRANCINKEBDSCRKEB!hi9%%LETOHEATOEXALINKPTKENPRINAOURPRINSCHITKEGOBASIGOBDBRANCINKEBDSCRSETBDRESTBDKEB} } 6-@ ̮d'6-AuU6-AuR}'6-AuHn46-AuX;A,(6-@46-c6-A6-AP'6-A36-A%?6-AP}K6-AW6-Ac6-AP+ 6-6-A!6-AP+ A$67B:,%,.!6-?::A(%@:,,3@  }9 <$)& >:A(%@:7@<@,,,)$,A-@@#= " to move on or for helpA ED-!}@@#@ % for ï or for helpD ^>-@@#> # for or for help"}6- )"@:B,'6-&@) AP"@:F,' AP0"@:T,'&6-?:#},0 A*"@:C,' 6-?:,* AD"@:?,)"@:/,#6-@1%A(:6-?:,D A$} ( $'6-&@ww%@A AA A"A%A0A@APA`Ab%}AdApA//&@ABBB Z@(@@K:5)@@&}@L!A(Z6-&A(!@6-&@2$& +-+11 ('}ԭ0c6-?:<,06-F:A ,%F:A!,$AVD-@\%$@A(%` c$ (} ԛ*{%6-F:A ,%F:A!,$AV9-@O%$@A(w%$@%@$@ %@)}{ 4\-@ 7%$@%@%A)%U%$@%@&Y \$R ԛ\v%6-F:A*} ,%F:A!,$AV9-@Q%$@A(%o%$@%@s v$"6+}-?:," A 6-?:,LIAR!-@@ I " to move on or for helpV6-@ ,} gg6.]5STRING VARIABLES\\Strings become really useful when we can use string variables. A string ee67B:,%,-}.Svariable is a variable that can hold a string. For example,\\10 A$=`Hello there`\\mm67B:,%,.[would move the string.} into the variable . A string variable's name must end ll67B:,%,.Zwith a . The string m/}ust be enclosed in quote marks. The quote marks are ii67B:,%,.Wnot part of the string; they just tell BASIC where the0} string starts and where it ends.*    mm6.cYou can use a string variable in a similar fashion to numeric va1}riables.\\You can to them,\\ff67B:,%,.T310 A$=`Hello there`\\you can into them,\\310 DATA Hello there\32}20 READ A$\\UU67B:,%,.Cyou can into them,\\310 INPUT A$\\and you can them\\6667B:,%,.$3IF A$<`H3}ello There` THEN GOTO 100.      <<6.2When we compare numbers, one number is said to be  jj67B:,%,.Xles4}s than another number if it is numerically less. In the case of strings, one string  bb67B:,%,.Pis less than another i5}f it alphabetically comes before the other.\\The computer  ii67B:,%,.Wcompares strings from left to right, one characte6}r at a time. It stops as soon as one  oo67B:,%,.]character is less than or greater than the other.\\The computer recog7}nizes the letters of the oo67B:,%,.] alphabet because each letter has a distinct numeric code called (pronounced 8}ASKY). An ZZ67B:,%,.H example program demonstrating these codes appears later in the chapter.      TT69}.J5THE DIM STATEMENT\\Like arrays, we need to ension string variables.  ff67B:,%,.TDimensioning string variables :}performs a slightly different function than for array  ff67B:,%,.Tvariables. Executing the following statement:\\310 ;}DIM A$(10)\\tells the computer  ii67B:,%,.Wto save space for a maximum of 10 characters and name this space A$. Unlike<} an array,  ..67B:,%,.there would be no element 0.    bb6.XNotice that we can put a string constant=} into a string variable that is larger than the gg67B:,%,.Uensioned size of the variable. This won't cause an erro>}r, but part of the string SS67B:,%,.Awill be lost. For instance, if we ran the following program:\_3\mm67B:,%,.?}[10 DIM A$(7)\20 A$=`Hello there`\30 PRINT A$\40 END\_0\We would see only seven characters, 7767B:,%,.%i.e. d@}isplayed on the screen.    bb6.X9SUBSTRINGS\\BASIC allows us to refer to a part of a string, () A}very easily. kk67B:,%,.YIf we ran the following program,\_3\10 DIM ST$(10)\20 ST$=`ABCDEFGHIJ`\30 PRINT ST$(3,7)\cB}c67B:,%,.Q_0\we would see displayed on the screen. The general way of refering to a hh67B:,%,.V isC} Ǥͬϩ where is the first character, and is the last. ff67B:,%,.TThe parameter is optional and D}if it's left off BASIC will use the present length.FF67B:,%,.4\\Let's enter BDT and see some substrings in action.E}  6-@C p zkk6.a5THE LEN FUNCTION\\There are also string functions, the first one we'll learn about F}is gth. dd67B:,%,.R returns the actual length of a string as opposed to it's dimensioned length. CC67B:,%G},.1For example, if we ran the following program,\_3\oo67B:,%,.]10 DIM ST$(10)\20 ST$=`ABCD`\30 PRINT LEN(ST$)\_0\We H}would see displayed on the screen. HH67B:,%,.6The actual length can range from 0 to the dimensioned II67B:,%I},.7length. Let's go into BDT and see a simple use of .  6-@D 8 Bnn6.d5CONCATENATING STRINJ}GS\\Using we can 'add' strings together, or them. Look at the L^^67B:,%,.Lthe following program:\_3\10K} DIM A$(20),B$(10)\20 A$=`Hello `\30 B$=`there`\VVV67B:,%,.D40 A$(LEN(A$)+1)=B$\_0\Statement 40 actually does the concaL}tenating.`ii67B:,%,.W It says take the present length of A$, add one to it, and store B$ into A$ from that jWW67B:M},%,.Epoint on. After statement 40 executes, A$ would equal .\\tFF67B:,%,.4Let's go into BDT and see some N}string concatenating.  6-@E   ]]6.SNow its time to have some fun. The next example program plaO}ys a game of hangman.\\mm67B:,%,.[After you enter BASIC, RUN the program a few times before you enter BDT. To do thisP}, just ll67B:,%,.Ztype and RETURN. When you understand what it does, go into BDT by pressing - ++67B:Q},%,.and discover its secrets.Z#   6-@F # X bYY6.O5MORE STRING FUNCTIONS\\_5Ҥ ҤR}\takes an arithmeticlvv67B:,%@,.^ expression and returns a string.\\10 A$=STR$(7+6+5+4+3+2+1)\\S}assigns a string, `28`, to A$.\\vpp67B:,%@,.X0 ̨\takes a string expression and returns iT}ts numerical value.6667B:,%@,.\\20 A$=`500`\30 ABC=VAL(A$)/2KK67B:,%@,.3\\assigns 250 to ABC.\\0U} and are opposites.   @ Joo6.e_5 è\takes the first character of a string expresV}sion and returns its T--67B:,%,.code.\\ASC(`A`) returns 65\h;;67B:,%,.)ASC(`ABC`) returns 65\ASC(`a`) retuW}rns 97gg67B:,%,.U\\0Ҥ Ҥ\takes an arithmetic expression as an code [[67B:,%,.X}Iand returns the character represented by that code.\\CHR$(65) returns `A`kk67B:,%,.Y_0\\ and Ҥ are opposites. Y} Let's go into BDT and examine a program that uses these ##67B:,%,.string functions.  6-@H (# Z}2#qq6.g5A STRING SORT\\As a final string example, we include a . This program an array <#qq67B:[},%@,.Yof strings by treating each 10 characters of a long string as a separate .\\F#pp67B:,%@,.\}XThe sort method used is the . The 'array' is always sorted. As each new P#ss67B:,%@,.[string is ad]}ded it is inserted in its proper place by moving elements down from the bottom Z#VV67B:,%@,.>until the correct slot^} is found.\\Enter BDT and sort this out.##   6-@G # ' 'nn6.dWell, that's how strings work. T_}o make sure you understand them, why not practice by writing these $'oo67B:,%@,.Wsuggested programs:\\\_4(1) Input `}a 10-character long string. Print it out reversed. .'oo67B:,%@,.WI.e., ABCDEFGHIJ gives JIHGFEDCBA.\\0(2) Read ia}n a string up to 100 characters long. 8'@@67B:,%@,.(Print out how many A's it has, B's, etc.t'  6-b} * +jj6.`This completes the chapter on strings. You may want to review this section several times.\\Try  +PP6c}7B:,%,.>rewriting some examples to better understand how strings work.R+   .$%@6-?:,$ Ad}D2:L.09%%LETOHEATOEXALINKPTKENPRINAOURPRINSCHITKEGOBASIGOBDBRANCINKEBDSCRSETBDRESTBDKEB [\q&&LETOHEATOEXALINKPTKENPRINAOURPRINSCHITKEGOBASIGOBDBRANCINKEBDSCRKEBf} g} 6-@̮d36-AuU6-AuR'6-AuH36-AuXn(q}B'DOS SYSB*+DUP SYSBGUAUTORUN SYSBDL 07 B?L 08 BKL 09 BMeL 10 B>L 11 B@L 12 B9E 28 B:E 29 B=E 30 B@E 31 BDE 32 BIE 36 BKE 38 BLE 39 BOE 40 BTE 43 BWE 44 BYE 45 B[E 46 BcE 47 BiE 48 BmE 51 BpE 52 BsE 53 BuE 58 BwE 59 ByE 60 BE 61 BE 62 BE 63 BE 64 BE 65 B E 67 BSAMPLE BASCKONGFUM BSAMPLE DAT;A,6-@(6-s6-A6-AP'6-A36-A%?6-APK6-AW6-Ac6r}-APi6-s A$67B:,%,.!6-?::A(%@:,,3@ 9 <$)& >:A(%@:7@<@,,,)$,t}A-@@#= " to move on or for helpA ED-@@#@ % for ï or for helu}pD ^>-@@#> # for or for help 6- )"@:B,'6-&@) APv}"@:F,' AP*"@:T,' 6-?:,* A*"@:C,' 6-?:,* A>"@:?,w})"@:/,6-+%A(46-?:,> A ( $'6-&WW%@A AA A0A@x}APA`ApA__&@ABBB B0B@BPB`BpBy}&Z@(@@K:5)@@@L!A(Z6-&A(!@6-&@z}2$& + -+11 (ԭ0]6-?:<,06-F:A ,%F:A!,$AV>{}-@V%$@A(%Z ]$ 6-?:, A 6-?:,LIAR!-@@ I "|} to move on or for helpV 6-  YY6.O9SAVING PROGRAMS\\Saving programs is simple if you follow t}}hese few steps:\\_4cc67B:,%,.Q(1) Come up with a name that you want to call your program. It should be 1 to 8 gg6~}7B:,%,.Ucharacters long and start with a letter. In addition it can have an optional 1 to 3 ll67B:,%,.Zcharacter '}extension'. Examples of valid program names are:\\MYPROG.BAS\TEST.1\CHECKING\\*      gg6.]_4(2) Put a } (see your manual on formatting) non-write protected disk into your  dd67B:,%,.Rdisk drive.\\0(3) Type in\\SAVE} `D:MYPROG.BAS`\\(assumming your program is to be  gg67B:,%,.Ucalled Ǯ) and press .\\0(4) Wait for the }busy light to go out on the  --67B:,%,.drive, and remove the disk.    ll6.b9LOADING PROGRAMS\\Load}ing programs is the opposite of saving them:\\_4(1) Put the disk with the hh67B:,%,.Vprogram you want into the drive.\}\0(2) Type in:\\LOAD `D:MYPROG.BAS`\\(assumming you ii67B:,%,.Wcalled the program Ǯ when you saved it) and p}ress .\\0(3) Wait for the HH67B:,%,.6busy light to go out on the drive and remove the disk.    }ii6._?DATA\\Before you learn how to store data, you need to understand exactly what data is.\\Data __67B:,%,.Mis }. It can be simple like a number or more complicated like 100 jj67B:,%,.Xnames, addresses and phone numbers}. A collection of data on a disk is usually referred hh67B:,%,.Vto as a , and the name given to a file the }. File names follow the same nn67B:,%,.\conventions as program names, that is 8 characters plus an optional 3 char}acter 'extension'.   p zll6.b9STORING DATA\\There are three steps to storing data in a file on disk.\\First} you must the ee67B:,%,.Sfile. This is so the computer can create an entry on the disk and reserve an area nn}67B:,%,.\in memory () to put the data on the way to the disk.\\This 'buffer' is called an cc67B:,%,.Qwh}ich is short for an Input Output Control Block. You don't need to worry about MM67B:,%,.;what it's used for, just tha}t it is needed by the computer.   X v''6.As an example, if you wanted ii67B:,%,.Wto create a file ca}lled Ů on disk you would execute the following statement:\\pp67B:,%,.^10 OPEN #1,8,0,`D:SAMPLE.DAT`\\The firs}t three parameters in this open statement are as followpp67B:,%,.^s:\\ is the number which refers to the buff}er area to use. It can range from 1 to 5.hh67B:,%,.V\\ tells the computer to open the file for output.\\ isn't }used, but it must be 67B:,%,. included.   @ Jgg6.]The second step in storing data on the disk is ac}tually telling the computer what to store. Tee67B:,%,.SFor this we use a variation of the statement. For instan}ce, if we wanted to ^cc67B:,%,.Qstore a number contained in a variable named , we would execute the following hdd6}7B:,%,.Rstatement:\\20 PRINT #1,A\\where is the same number we used in the OPEN ree67B:,%,.Sstatement. W}e could execute as many PRINT statements as we wanted to and the data |;;67B:,%,.)would be stored sequentially in the f}ile.   (# 2#gg6.]The last step in storing data in a file is to the file. For instance, the following:\\}<#VV67B:,%,.D30 CLOSE #1\\would close the file that we opened using IOCB .\\\F#ee67B:,%,.SNow let's enter BDT a}nd execute an example program which will create a file called P#PP67B:,%,.>Ů on this diskette and write a secre}t number into it.#  6-@Q ' 'ee6.[9RECALLING DATA\\Recalling data is the opposite of storing data}. However the sequence of $'ff67B:,%,.Tsteps is similar.\\First we the file, but for , not . For examp}le, .'ll67B:,%,.Zif we wanted to recall data from a file named Ů, we would use the following OPEN 8'ff67B:,%},.Tstatement.\\10 OPEN #1,4,0,`D:SAMPLE.DAT`\\The only change from the OPEN we used to B'll67B:,%,.Zstore data is in t}he second parameter which changed from to . This is how we tell L'SS67B:,%,.Athe computer how we plan to use the} file, in this case for input.j'   * +ii6._The second step in recalling data is also like the second step in s}aving data. The difference  +ff67B:,%,.Tis that instead of out data, we want to it in from the disk. For }this +hh67B:,%,.Vwe use a version of the statement. For instance if our file contained a number  +ii67B:,%,.}Wwe could use the following:\\20 INPUT #1,A\\This would get the first number out of the *+mm67B:,%,.[file and store it }into variable . As before, must be the same number that we 4+--67B:,%,.used in the statement.R+  } . .ll6.bThe third step in recalling data is identical to the third step in storing data. That is we have .hh6}7B:,%,.Vto the file. For this we use the identical statement as we used before. .gg67B:,%,.UThat is,\}\30 CLOSE #1\\Again insure that is the same number we used in the /jj67B:,%,.X statement.\\Now let's go i}nto BDT and execute an example program which will recall /KK67B:,%,.9the secret number that we stored in the previous e}xample.:/  6-@R 2 2ll6.bThere are more disk commands than the ones that we have presented here. H}owever these get fairly 2jj67B:,%,.Xcomplicated and involved. So if you want to learn more about using disk files, con}sult 2--67B:,%,.your and manuals."3   6 6gg6.]9THE GET STATEMENT\\The statement is not r}eally a disk command (although it can be used 6ii67B:,%,.Wwith disk files) however using it involves similar steps to u}sing disk files. This is 6gg67B:,%,.Ubecause before we can execute a statment, we have to execute an statemen}t. 6QQ67B:,%,.?After we are done ing we have to execute a statment.\\6YY67B:,%,.GThe GET statement fetc}hes a single character from the keyboard without 6ii67B:,%,.Wmaking the user press . This is very useful if we n}eed a response to a question 6))67B:,%,.like ٠, or Ԡ. 7   : :mm6.cA peculiarity of GET is tha}t it returns the character as its code, rather than the character :ii67B:,%,.Witself. If the character is desire}d, use the Ҥ function on the number returned. :``67B:,%,.NThe following is an example program that would GET a ch}aracter and print it:\\:PP67B:,%,.>10 OPEN #1,4,0,`K:`\20 GET #1,A\30 PRINT CHR$(A)\40 CLOSE #1\\:jj67B:,%,.XNoti}ce in the OPEN statement that the 'file name' is ˺. This is how we refer to the :UU67B:,%,.Ckeyboard. Now let's go} into BDT and watch a program that uses GET.:  6-@S > >[[6.QWhy not test your knowledge and try t}o write these sample programs.\\_4(1) Write >cc67B:,%,.Qa program to write your name, address and telephone number to a} disk file called >jj67B:,%,.XDIRECT.DAT.\\0(2) Read in DIRECT.DAT and print your name, address and telephone number.}>hh67B:,%,.V\\0(3) one of the programs you wrote above. Type (the command to clear the >ii67B:,%,.Wprog}ram in memory) and the program back in. it to make sure you got it back.>  6- hBb b6.TT}hat concludes our chapter on DISK I/O. Back up if you still have more programs to rB]]67B:,%,.Kwrite. Otherwise, press} the space bar and we'll go on to the next chapter.B   PF$%@6-?:,$ AD:L.10qab:LETOHEATOEXALINKPTKENPRINABOURPRINSCHITKEGOBASIGOBDBRANCINKEBDSCRKEBJP} } 6-@̮d36-AuU6-AuR}'6-AuH36-AuXn3;AP,;@%,'6-@36-s6-A6-AP'6-A36-A%}?6-APK6-AW6-Ac6-APi6-s A$67B:,%,.!6-?::A(%@:,,3@ 9 <$})& >:A(%@:7@<@,,,)$,A-@@#= " to move on or for helpA ED-@@#}@ % for ï or for helpD ^>-@@#> # for or for help 6- })"@:B,'6-&@) AP"@:F,' AP*"@:T,' 6-?:,* A*"@:C,}' 6-?:,* A>"@:?,)"@:/,6-+%A(46-?:,> A ( $'6-&%@}A AA A0A@APA`ApAAABBB&}Z@(@@K:5)@@@L!A(Z6-&A(!@6-&@2$&} + -+11 (ԭ0]6-?:<,06-F:A ,%F:A!,$AV>-@V}%$@A(%Z ]$ 6-?:, A 6-?:,LIAR!-@@ I " to m}ove on or for helpV 6-  6-6-qq6.gLets start by looking at the joystick and paddl}es, because we can use them when we demonstrate sound.\\* 4(>(Do you have paddles?H(Answer ٠ or Π --}>R% @F:@,&% >:,\e"@:Y,)"@:y,6- (F(!Plug your into controller[(jack numbe}r .e A"fF@:N,*@:n,(<(***Type ٠ or Π only -->F A!0"("(Do you have a joystick?}(Answer ٠ or Π -->% @F:@,&% >:,e"@:Y,)"@:y,6- ([(6Plug your into c}ontroller jack number .e A#F@:N,*@:n,(<(***Type ٠ or Π only -->F A"0( S "*}"S AYou'll have to use your keyboard to substitute in the examples.     oo6.e7USING THE PADDLES\\The pad}dles return a number between and with corresponding to the  ff67B:,%,.Tpaddle turned all the way to the r}ight and corresponding to the paddle turned  gg67B:,%,.Uall the way to the left. The paddles in controller jack }number are numbered  aa67B:,%,.Oand .\\The switch on the paddles also return a number, if the switch is } 4467B:,%,."being pressed and if it isn't.    mm6.cYou 'read' the paddles and trigger switches w}ith . This allows the number returned to be gg67B:,%,.Uused in arithmetic expressions. For instance, to pri}nt the value of paddle number 1 __67B:,%,.M(the second paddle plugged into controller jack number 1) you would execute}\\0067B:,%,.10 PRINT PADDLE(1)\\Likewise, cc67B:,%,.Qto print the state of paddle one's trigger you would exec}ute\\10 PRINT PTRIG(1)\\(   APOO67B:,%,.=Lets enter BDT and see how we would use the paddle functi}ons.^  6-@X  ff6.\8USING THE JOYSTICKS\\The joysticks return a number which indicates the dire}ction that the LL67B:,%,.:stick is being pushed. The actual direction numbers are:\LL67B:,%,.:>14\;10  6\}= \911157\= \<9  5\>13\\kk67B:,%,.YThe joysticks are referenced by a number one less then the number} of the controller jack  67B:,%,.that they are ll67B:,%,.Zplugged into. The joysticks also have trigger butt}ons that work like the paddle triggers.   p zii6._Like the paddles, you use functions to 'read' the joystick}s and trigger buttons. For instance 5567B:,%,.#to print the value of joystick gg67B:,%,.Uyou would execute}\\10 PRINT STICK(1)\\Likewise, to print the state of joystick one's @@67B:,%,..trigger you would execute\\10 PRINT STR}IG(1)\\(   ApNN67B:,%,.The sample program you just ran changed sound by means of the <#6.F#}6.P#6.Z#67B:,%,.d#bb67B:,%,.P.\\There are interesting techniques to be learned in the} examples which use the n#6. and x###6. and #""6. and }#67B:,%,.#67B:,%,..#   #f f6.XThe next example program plays a few different tunes.\\The pitch v}alues used are from a #jj67B:,%,.Xtable found on page 58 of the BASIC manual. Like the last program, this one depends }on $ll67B:,%,.Ztiming so that it may not appear to work right when run using BDT. Therefore, you should $MM67B:,%},.; it from BASIC, then enter BDT and examine how it works.J$  6-@g T$-@2 'k} k6.]It's that time again, time to write your own programs.\\\_4(1) Using two FOR/NEXT loops, one 'ii67B:,%,.Wcoun}ting up followed by another counting down, play every pitch from 0 to 255 then 255 $'[[67B:,%,.Ito 0.\\0(2) Get a value} from a paddle when the user presses the trigger .'SS67B:,%,.Aswitch. Play pitches from 0 to that value using a FOR/NEX}T loop.j'  6- *e e6.WWell we hope that the mysteries of Joysticks, paddles and sound have been cle}ared up.\\+ii67B:,%,.WIf you need more practice, back up, review, and try writting the other example program.R+   } N$%@6-?:,$ BD2:L.11PRINSCHITKEGOBASIGOBDBRANCINKEBDSCRKEBJP5]^& LETOHEATOEXALINKPTKENPRINAOURPRINSCHITKEGOBASIGOBDBRANCINKEBDSCRBKEB!} !} ̮6-@d'6-AuU6-AuR'6-AuHn(!}6-AuX;AP,(6-@c6-A6-AP'6-A36-A%?6-APK6-AW6-Ac!}6-AP 6-;@%, A*67B:,%@,.'6-?::A(!}%@:,,9@ ? B$)& >:A(%@:7@<@,,,)$,A-@@#= " to move on or for "}helpA ED-@@#@ % for ï or for helpD ^>-@@#> # for "}or for help6- )"@:B,'6-&@) AP"@:F,' AP0"@:T,'"}&6-?:,0 A*"@:C,' 6-?:,* AD"@:?,)"@:/,#6-@1%A(:6-?:"},D A ( $'6-&@%@A ABBB B0B@BPB"}`BpBBBB&Z@(@@K:5)@@@L!A("}Z6-&A(!@6-&@2$& +-+11 (ԭ"}0c6-?:<,06-F:A ,%F:A!,$AVD-@\%$@A(%` c$"6-"}?:," A 6-?:,LIAR!-@@ I " to move on or for helpV6-@ "}' 'ii6._5THE GRAPHICS STATEMENT\\The statement tells BASIC what of it should be $'ii67B:,%" },.Win. BASIC has 9 different modes, 3 text modes (0,1 and 2) and 6 graphic modes (3-8). .'^^67B:,%,.LTo select a mode" }, for instance number 4, you would execute:\\10 GRAPHICS 4\\8'hh67B:,%,.VNormally all modes are split screen with 4 line" }s of normal text at the bottom and the B'ff67B:,%,.Tselected mode at the top. To get a full screen of the selected mode" }, add 16 to the L'ii67B:,%,.Wmode in the GRAPHICS statement. In addition, the GRAPHICS statement clears the screen V'$" }$67B:,%,.unless you add 32.j'   * +ll6.b5TEXT MODES 0,1 AND 2\\The normal BASIC screen is text ."} This screen is organized as 40  +hh67B:,%,.Vcharacters across by 24 down.\\ has characters that are twice as w"}ide as mode +__67B:,%,.M0. This means that a screen of mode 1 will only have 20 characters across.\\ +ii67B:,%,.W"} has characters that are twice as wide and twice as tall as mode 0. Therefore *+NN67B:,%,. >ii6._5THE CO"$}LOR STATEMENT\\The color that we draw in is set by the statement. The color can >aa67B:,%,.Orange from 0 to 3, h"%}owever not all modes support all colors.\\When you execute >jj67B:,%,.Xa COLOR statement you are telling BASIC which "&} it should use. The actual >cc67B:,%,.Qcolor displayed is dependent upon the value in that register. Unfo"'}rtunatly, the >WW67B:,%,.Ecolors are numbered differently than the register numbers. That is\\>ll67B:,%,.ZCOLOR "(}0 would use register 4.\COLOR 1 would use register 0.\COLOR 2 would use register 1.\>//67B:,%,.COLOR 3 would use regis")}ter 2.>   hB rBjj6.`5THE SETCOLOR STATEMENT\\The way you change the value in a color register is with the "*} |Bee67B:,%,.Sstatement.\\10 SETCOLOR REGISTER,HUE,LUMINANCE\\sets the specified to the BZZ67B:,%,.Hs"+}pecified (must be between 0 and 15) and (must be an even Bll67B:,%,.Znumber between 0 and 14).\\Let's go ",}into BDT and watch a program execute in mode 5. Mode Bjj67B:,%,.X5 is a 4 color, 80 column by 40 row graphics mode. T"-}he first time through the program, Bee67B:,%,.Sleave the screen ed over to the BASIC screen as you tep through t".}he program.B  6-@d PF ZFdd6.ZThe last example program we have is a drawing program.\\It draws verti"/}cal, horizontal and dFii67B:,%,.Wdiagonal lines. You should it first to understand what the program is supposed to "0}nF67B:,%,. be doing.F  6-@e DH NHmm6.cWell, it's time to write your own graphic programs. A"1}fter you enter BASIC/BDT, try writing one of XHll67B:,%,.Zof these suggested programs.\\\_4(1) In GRAPHICS 5, use the RN"2}D function to generate and PbHmm67B:,%,.[LOT random points on the 80 by 40 screen in a random COLOR from 0 to 3.\\0(2) "3}In GRAPHICS lHnn67B:,%,.\3, use nested FOR loops to print a series of color bars vertically down the 40 by 20 screen.H"4}  6- 8J BJhh6.^9ӡ\\\This completes the BASIC BUILDING BLOCKS lesson. We hope you'v"5}e enjoyed LJkk67B:,%,.Yit. Remember you can always go back and review.\\If you need more specific information, VJpp67"6}B:,%@,.Xyou should consult the ATARI BASIC and DOS manuals.\\You are now ready to make yourself `J``67B:,%,.Nfam"7}iliar with the stand alone BASIC Design Tool which is included on disk 2. jJBB67B:,%,.0Instrucions for its use are in t"8}he user's guide.J   Hq"6-?:," AD:L.12BRANCINKEBDSCRBKEB LUdNUMBE 1,5,7,13,17-@@"( 2 D2:E.28cions for i$r56ECARPRICETEMNUMBE@ 9@,004995,6215,6999,7885,9500,10750,11250,*;}11995-@("2 68,-< F)) !WHAT CAR PRICE DO YOU WANT? (0-7)PZ6 )!@*<}, ILLEGAL NUMBER6 @pd CAR  COSTS 8,n @pD2:E.29995,6215,6999,7885,9500,10750,11250,(Y9GVNUMBSNUMHOL@  ENTER 8 NUMBERS9@,-.>}@( ENTER NUMBER #2< 68,-F dSORT STARTS HEREn-@x-@.?}E8,!8%@, 6-8,468,-8%@,E68%@,-  D2:E.30,-,jFNUMBSNUMSWAPHOL@  ENTER 8 NUMBERS9@,2A}-@( ENTER NUMBER #2< 68,-F dSORT STARTS HEREn-@x6-2B}-@Q8,!8%@, 6-8,468,-8%@,E68%@,-Q6-@ "2C}A D2:E.31  ENTER 8 NUMBERS9@,0,S9GNUMBSNUMTOBOSWAPHOL@  ENTER 8 NUMBERS6E}9@,-@( ENTER NUMBER #2< 68,-F dSORT STARTS HEREn6-66F}-@x6- - A "A@6--&@6@ 6G} A "A@6-%@6-&@ A0 COMPARISON/SWAP SUBROUTINEQ6H}8,!8%@, 6-8,468,-8%@,E68%@,-Q6-@$D:E.32  ENTER 8 NUMBERS4aNUM   ENTER NUMBERS"" TO FIND THEIR SQUARE ROOTS ENTER NEGATIVE TO STOP(:J}2 &< 6-M:,F"" SQUARE ROOT OF  IS P @@D2:E.36 ENTER NEGATIVE TO STOP(8_P_DI 6-H:,6-@%P:$@, @D2:E.38B50 IF NUMB<0 T<mA NUMERATODENOMINATOP 6-6-$$6-+H:BM},$@,&@($$6-+H:,$@,&@26-%@<&M:$%$, @&6-%@F6-@BN}$'P @0D2:E.39P 6-6-$$6-+H:@!EHOURMINUTESECONDOTIMTIM ## ENTER CURRENT TIME AS HOURS FP}MINUTES AND SECONDS (GOSUB TO GET ATARI'S TIME2 A < 6-d A n"Ax 6-%&FQ} @`A6-&@`6-%@ @`A6-&@`6-%@!@FR}#6- 6- AII6-P:++F:@,$BU6,%+F:@,$AV,%F:@ ,,'@`,$FS}D2:E.40HOURMINUTESECONDOTIMTIM ## ENTER CURRENT TIME AS HOURS D /STRINGTEMP ;@ ,;@,6.THE QUICK BROWN FOX6.JU}7@<@ ,(6.7@,267@,.CAT<6-@F6-@P67<,.GREENZD2:EJV}.43/STRINGTEMP ;@ ,;@,6.THE QUICK BROWN FOX6.H kzSTRINGLENGT ;@, ENTER 0-10 CHARACTERS( 6-B:,2 @ NX}D2:E.44zSTRINGLENGT ;@, ENTER 0-10 CHARACTERS( 6-B:,2 @ L *STRING1STRING2 ;@,;@,6. Hello there 6.(-B:,RZ}@6@267B:,%@,.7<,< FD2:E.45@,6. Hello there 6.(-B:,PJTWORDSWORDTESTGMISSES 11;A,;@,V\};@,;@,(-@A$67<,. ( -@@("2UUANIMAL,JOYSTICK,PENCIL,SEASHV]}ORE,JUPITER,FOOTBALL,SHOELACES,TRUMPET,SCHOOL,EAGLE<0067+&@,$@%@<$@,.F P%%6-P:H:V^},$@,%@d006.7+&@,$@%@<$@,n-@@s67<,. x7<,0 6V_}7<,._ 6-*  * ENTER YOUR 1-LETTER GUESS  4  A@6--V`}@@%7<,46-@%67<,. "@ Ap6-%@ WRONG. MISS #Va} @ A@ YOU ARE HANGED.  THE WORD WAS  A  GOOD GUESS."% 4  THAT'S ITVb}. % A, A@6.  . DO YOU WANT TO PLAY AGAIN (Y,N)@J 4N&T @D2:E.46,T{<WORDSWORDBLANK &&;A,;@,;@,6. Zd} -@ (..67$@%@<$@%@,.2 Z## ENTER 9 WORDS TO BE SORTED:d-Ze}@@ n  ENTER WORD # -->x A INSERTION SORT ROUTINEPRESENTLY I-1Zf} STRINGSIN WORDS$""-&@6@6627@$%@<@$%@,A..67@Zg}$%@<@$%@ ,...67@$%@<@$%@ ,.$..67@$%@<@$%@ Zh},."SS67@$%@<@$%@ ,.7@$%@<@$%@,, 6$D2:E.47. XuIkzSTRINGCHARACTERCOD !!ҤĠ̠Π^j};@,6-@(6.=:%@,2 6-A:,d!!àĠҤΠn;@,x-@@^k}A,B,C,a,b,c,1,2,3,#,$,%" 6-@:, -@3A" 6.>:,  OF  =  ^l}D2:E.48INGCHARACTERCOD !!ҤĠ̠Π\   WAITNUMBE ;@,-- %PLACE A INITIALIZED DISK IN DRIVE ONE## PRESS WHbn}EN YOU HAVE(2--@@ D:SAMPLE.DAT<"" ENTER YOUR SECRET NUMBER:FP @Zbo}@dD2:E.51 ;@,-- %PLACE A INITIALIZED DISK IN DRIVE ONE## PRESS WH` (<KWAITNUMBETES ;@,%% PLACE THE DISK THAT YOU SAVED## Ů fq}ON IN DRIVE ONE.( PRESS RETURN WHEN READY2<--@@ D:SAMPLE.DATF@P@fr}Z ENTER SECRET NUMBER:dn@x CORRECTD2:E.52T YOU SAVED## Ů d_  ##@@K: SHOULD I STOP?)@("@:Y, @`2 jt} @ <@FD2:E.53K: SHOULD I STOP?)@("@:Y, @`2 h,3PADPADTRIGTRIG $$ Experiment with your paddles6-Q:,6nv}-Q:@,(6-S:,26-S:@,< @ D2:E.58riment with your paddles6-Q:,6lLn}JOTRI %% Experiment with your joystick6-R:@,6-T:@,( @ rx}D2:E.59JOTRI %% Experiment with your joystick6-R:@,6-T:@,( @ p#$dIOUAPPENINOUVOICPITCVOLUMKE "" Presvz}s  to increase pitch"" Press  to decrease pitch## Press  to increase volume(## Press  to decrease volumv{}e2%% Voice starts at 0 and changes< when you press F36-@6-@'6-@ 36-@Pv|}@K:Z'6-6-A('6-@d)@n="@:,)"@:-,%6-&@1 v}}=6-x="@:,)"@:=,%6-%@1!AU=6-AU="@:,)"@:*,%6-%@1!@v~}=6-@="@:,)"@:+,%6-&@1 @=6-@4"@: ,6-%@(!@46-v}2@ AD2:E.60 "" Prest1@VOICPITCVOLUMSTTRI ,, $Push stick forward to increase pitch#z}# backward to decrease pitch... &Push stick to right to increase volume( left to decrease volume.2%% Voice stz}arts at 0 and changes< with each trigger press.F6-P6-A(Z6-@d6-R:@,n6-Tz}:@,x5"6-%@)!@56-I#"@)"@)"@16-&@= Iz}6-I#"@ )"@)"@16-%@=!AUI6-AUI#"@)"@)"@ 16-&z}@= @I6-@I#"@)"@)"@16-%@=!@I6-@2@z} AD2:E.61UMSTTRI ,, $Push stick forward to increase pitch#x@VOICPADPADTRIGTRIG && Use paddle 0 to control volume%% an~}d paddle 1 to control pitch  Distortion=10(%% Voice starts at 0 and changes2"" with each trigger press on< ~}either paddle 0 or 1Z6-d6-Q:,n6-Q:@,x6-S:,6-S:@,?")~}"'6-%@3!@?6-QQ2+&@,$AU'A'@++&@,$@'A',%@~} AD2:E.62TRIG && Use paddle 0 to control volume%% an|  +@ @THE MODE 1 PART THE NORMAL TEXT PART( +@2 @THE MODE} 2 PART< THE NORMAL TEXT PARTA-@@F @NORMALK-@@P @}U-@@Z @ lower case_-@@d## @n+@%@}x00 @THIS IS FULL SCREEN TEXT MODE  +D2:E.63 PART( +@2 @THE MODER +@ COLOR 1@" PLOT 0,0",( COLOR 2@2$  PLOT 7}9,39$,@y@9< COLOR 3@F#  PLOT 79,0#,@yP%  DRAWTO 0,39%/@9Z }COLOR 1@d#  PLOT 1,39#,@@9n%  DRAWTO 79,1%/@y@x COLOR 2@#  P}LOT 79,2#,@y@%  DRAWTO 2,39%/@@9 COLOR 3@#  PLOT 3,39#,@@9}%  DRAWTO 79,3%/@y@ COLOR 0$  PLOT 79,39$,@y@9$  DRAWTO 0,0$/} COLOR 1@%  DRAWTO 0,15%/@&  DRAWTO 15,15&/@@%  DRAWTO 15,}0%/@$  DRAWTO 0,0$/0 SETCOLOR 0,9,800@ @0 SETCOLOR 0,9,0}00@ 1 SETCOLOR 0,9,1410@ @"D2:E.64OR 2@2$  PLOT 7aW9HIOUAPPENINOUCO  Use keys to draw} -up -up&right -right -down&right( -down -down&left2 -left -up&left< ኚ} color changeF P Press any key to begind36-@6-@'6-@ 36-@n@}K:x)@ +@'6-@@6-@ '6-@)@5"@26-%@)!@}56-I#"@)"@s)"@y16-&@= I6-I#"@y)"@u)"@D}16-%@=!@yI6-@yI#"@x)"@w)"@D16-%@=!@9I6-@9I#"@})"@t)"@x16-&@= I6- , APD2:E.65 Use keys to drawhHSPEECHOICDELATEMP   ** !Enter speed to play at, 1-}100 -->< @)!A2 Enter 1 to 100 only.< @'' Which tune do you want to hear?!! 1 }Mary had a Little Lamb(&& 2 Twinkle Twinkle Little Star2 3 Happy Birthday< Enter your choice -->FP}AA A0Z Enter 1,2 or 3 only.d @٠Ǜ""$"2}@@-@-@! & +%%20 A}٠ĠŠ› #A FF64,4,72,4,81,4,72,4,64,4,64,4,64,8,72,4,72,4,72,8,64,4,53,4,53,8HH64,4,72,4,8}1,4,72,4,64,4,64,4,64,4,64,4,72,4,72,4,64,4,72,4,81,8,0 A @!!ŠŠŠқ #A }RR121,4,121,4,81,4,81,4,72,4,72,4,81,8,91,4,91,4,96,4,96,4,108,4,108,4,121,8,0 A @ ٠Ҏ}ٛ #A0  AA81,3,81,1,72,4,81,4,60,4,64,8,81,2,81,1,72,4,81,4,53,4,60,8 HH81,3,81,4,40,4,47,4,60,4,64,4,72,8,4}5,3,45,1,47,4,60,4,53,4,60,8,0 A @D2:E.67   ** !Enter speed to play at, 1-H907~8<>fhdgsaLJ:K\^OPUI_|VCBXZ$#&%"![ ]NM?REYTWQ()'@}FHDGSA {  `  }}XsŐ呐L%ͥ8ͥΠ# ]!GOSUBFOR/NEXT from ] }>zSTRINGCCOUNTDIGI@ &&;@P,;@,9@ ,-}@ 68,-( 2** "ENTER A STRING OF UP TO 50 DIGITS:<F-@B:,P6.7<,Z}-@ d- 4=:, 68,-8,%@#'- A n x -@ ##  THERE ARE 8,} 'S.  D:SAMPLE.BAS@ &&;@P,;@,9@ ,-% ]Hͅȱͅ hȱ0ȱH) ]hXs 8 ͥΥͥΰ8ͥLXs } ؠȱ0ȱH) ]h` s yj`sIs!  )I@)uOs ;LOs ; ɍjj`s }xL )yjjj`vjB@DE J VR @ B@ @@ @A @A @1A @IA @RP