8L2C)pJJJJ IH(ȱH:=IH[H`@HcH  $ +   I/H`JLNGȄBȄF aK  haaFF  mJm# KKJ UJ )J ۈ) ;J3ȱJFȱJGJKaȄM  aaNNJFLGJL LCe! H$q!r! c&L*!M8tl # ) y!s!(&s!t! c&E )?  @ e!l!0 $l!0u!v! c&-) &ύw!x! c&Эb)0I0 ( d!N)Gi/ h!4  F4 G1 4G2 G3 G4 G5G6E2E3E4F1,F2=F3D3D4MD5D6uD7 D8FE1bH#L.GH#L.CHC2"#L.D&HD1oD2*SMALL.FONTaKTOCHHELP}H#L.F<H#L.AHC1)#L.B% #L.EL H)OPENMECA1Y K*OPENSCREENj K#BDT{ B2k*LARGE.FONT aDISK1' -&PRODOS<! !,BASIC.SYSTEM'(! oB1;'STARTUP=} PREBDTB`&HIRESCD >dLԡm#i㰼m#iЕOLԡȱfg hi !dLԡ憦  Ljmkm l y`2 Lԡ8(Je稽)ʈ@LLnSOS BOOT 1.1 SOS.KERNEL SOS KRNLI/O ERRORFILE 'SOS.KERNEL' NOT FOUND%INVALID KERNEL FILE: xةw,@  ȱlmi8#)!)? &PRODOS `DaElH$?EGvѶK+`L HHLy XP LM ŠϠĠӠS)*+,+`F)) (*=GJFjJJA QE'+ '== `@ STSP8QSS8 m P o R(8Rn!o!p! k! iL X%>!L;!ΠΠҠ`}!!!"!!!l4"# G$YO!-e(eR9B}PBiB  !"#$%@~@}J@` ߩ%S @ ~`EhhhѺ0 h ѐ# ѐ ѐ ѐ 0 HϭэLпllllhh8` QSTV'P،h@ihAiȱ@JJJJq@)@%vȱ@Hȱ@Ah@E@c%e J) LxL LxJiB LxJ) <ҩxNhHHHHL(  аƠx@BEOD  а(`( C)CJJJlBJ,~آ <B*IBGF08Lé'+8H <(h`@؍L3<>=?<>CAB@?A` / L  <>` ڢF]PL8i m L   4< L  BLRAM' hLDLHB-4F 1"aɿ LL@ Nϰ H  @h( L Lh  @`bLJCAB@=?,<ʆ>*=?BC8 é&'112` ( < *? ( < (? ( < (? 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ɾM$ mHݓǾ phϾ A ԟ ` ])Y 񩢍`Ⱦɾ0Ǿ p)莼 * 6 w= l& l8Hh l` 6Y׾ؾ+پھ p|پɾʾ`HV)jh츾$-ˌھپLp k V)@W0!XY aX6Y7` a YX`X:Y;τ<:: <`:8`'OV)Jj *f a  ԟ  ԟ ⟭ + +:ji  ԟɃ B , ԩ p`SW)0پȾھɾ p p 3LjÍ L I 9 1׾ؾ  p p 3 H h(`׾ؾ`  ߭׾t8퍼mؾŰ펼t폼 L8` `F`4W)ɐ/XYjV) *8` h e`l׾ XYW0V):W׾ؾ_`)0%I0)3]8X^YȰ8` 8` p Ⱦɾʾ8`پھW)@%ZȾ pSɐ"jÍgh I @8gȾhɾʾg׾hؾ  p hgͺ칾`L3V)jC mMjà Lp `VJJ°LyLp *)< LA * LAW)8VJưϥ3 ⟢BT eօ ܬ L s򩣍S3 Ly B# e $L? L Y kimljn`  pg׾mȾXhؾmɾYtѮȾɾ YX`8gM CgIY2m*b6>BSAVERIFYBLOADELETECATALOGOPENWRITEXECREATEFRESBLOCKS ";:R:" "J V'L:" ";:M:" ";:R:" "{ `'L:" ";:M:" COPYRIGHT 1983 ";:R:" " j'L:" ";:M:" MECA ";:R:" " t'L:" ";:M:" ";:R:" " ~'L:" ";:R:" " 'L:" ' 'L8:R31:3::M10@ 'L:" "U $'L:" ";:R:" " .'L:" ";:M:" ";:R:" " 8'L:" ";:M:" BASIC ";:R:" " B'L:" ";:M:" BUILDING ";:R:" " L'L:" ";:M:" (16302) 30000 1 (4);"BLOAD BDT"B MARK:768,2M 4105h (4);"OPEN SESAME,D2" (4);"READ SESAME" 4100 DRIVES (4);"CLOSE SESAME" (4);"BRUN HIRESC,D1" (4);"DELETE SESAME,D2" 768,1:4030 3:<>?@A,P:1,TL:MUSIC:2 200:0,P:1,TL:MUSIC:= 10000~ (4);"BLOAD OPENSCREEN":100:(4);"BLOAD OPENMECA1,A$4000" 100 I(16304):I(16297):I(16302):I(16299) 20000 I1400:I I(16300):I(16297):I(16304):I :332801 **********************N * 13-JAN-84 *k ********************** 768,0:CHECK24612:MUSIC24592:MARK24576:(4);"BLOAD PREBDT":1000dCHECK:(768)03000nCHECK:(768)04000 ,100:0 PRESS "E" TO EXIT BDTL5LLL"L  KN)_ `@S8` ԠŬLL<[B?I>孓`仫6VtCicQĿUKqtVt Nʮq$6,⨁ K6, VtI=v!gNVt Vt  lg~TŠӠŠҠüϠž(+@ABCDEFGHIKLMNPSV     T[fouu~ՠٯ* PWN*]ĿNTz @n6VC/+A>@I5gN Oz @n[Dz @nd0,~z @`$仫@v$⩔,CTORENAMEBRUNLOCKCHAIN#FLUSHREADPOSITIONOMONPR#PREFIXCLOSEAPPENDx{[{0ǭ0hЫ}wA Xw­孶׭fl@@ -!S    !C- !ABELSDFRV@@ !$(19@E "" ':18:6F '"PROGRAM LOADING, PLEASE WAIT"w ':2:"PRESS ANY KEY TO BYPASS INTRODUCTION" '(637)255ĺ:8::"BE SURE CAPS LOCK IS DOWN" ' NT50:P191:L1:300:P101:L3:300 *NP152:L1:300:P128:L3:3004NP171:L1:300:P114:L2:300>>NP135:L1:300:P85:L3:300zHNP101:L1:300:P95:300:P85:300:P95:300:P101:300RNP114:L2:300:P101:L1:300\NP128:L3:300:P203:L1:300fNP191:300:P171:300:P255:L5:300pN*0uT23:P191:L1: ` %  Lm ɿ  ` Jm e L L  `  L 8 L L &( ` ` ` ` ` ` ` ȱɁ#ɨ8   m e   a `= LSM LS   t0 1 ?@ԍALn  , A $  , D 1: /  H2/ 1! 2:  0 1 R ɍ  L0 1 `s  `  Ɂ ` RH 2 m       I       H   hI  hhh  0L# L`) H H`hh`n      &~        ӌ Ȅ L8    u  c0- ) c8   m m     ` / (      L        8 HH eȱe`  JJJ`   JJJL! s@t 1 A ` Z SV Q Slef4@A W,R,W,T,Pghgg K CEFGHIJIC/BDT or ? for help Place disk in drive and press any key ;:MACHIDMACHID48:INSLOT$(0)L$:500 MACHID32ĺ"64K ";:MACHIDMACHID32:E:OVm%3J( #5@Uu 3-jLgLLARGE.FONT6E00SMALL.FONT7E00TOC6C00HELP8420L. 44001800BLOADSpace bar to move on or ? for help Space bar for example or ? for help Space bar for BASîӠhh`0 L``,\,, a0 ɑH aH?QT X`0&aa ȘeiLT`(L}``ĠٺͮˮǮ95:400:P85:400:P63:400WuP67:400:P85:400:P114:400:P128:400:P135:400uuP171:400:P255:L6:400{u1:400:P171:400:P101:L2:400bbuP114:400:P128:400:P152:400:P128:400:P114:L1:400luP152:400:P101:L2:400:P95:400::P85:400:P75:400vuP85:400:P95:L1:400:P152:400:P101:L8:400:P1:L1:400uP152:400:P101:L2:400:P400:P135:L2:400:P128:400:P114:400^:uP101:400:P114:400:P128:L1:400:P191:400DuP135:L2:400:P128:400:P114:400:P101:400:P114:400NuP128:L1:400:P171:400:P101:L2:400:P114:400:P128:400#XuP152:400:P128:400:P114:Lө8JfL@0``00`,@ 8@ 8,) ,  8 8* + ȱ ` `1( TCB F?/ ɞ La`" # Lk 8HHhHhh` &I&( L   LZ, - y LT LT , -  T lhhLC DhhLB0 ׭. /   ɟɠhhLF LM ɟhhL/?Y, - , -  TB). We can also test conditions other than equality like A>7 which tests if A is greater than 7. Altogether there are 6 possibilities to test:A=777?L,`& ' L" # ɀɝ`* + `( ) `, - $ % `, - & ' `( ) `, - `   ɡɧ ɢ `hhL ` ɢ `P =BC<>?L,Ph j      L W   Hi0 r hi0r . / r . /  L    e :  e⨥ : 8 ʤ : 8 : L H hL:$ % L0F,B(C$/? Ly . / hhLLa ` )hhL>  P Lh  g  i d SDhhL H  , - r 詎r 詆r r r Ɂr 󩃝r r  r .r  詀r , - 4r equal to 7A>=7=7, we can test for combinations using the operators AND and OR. These work in a way consistent with their names. This expression:(A>0) AND (A<11)would only be true if A were greater than zero AND less than 11. That is 1, 2, 3... 9, 10. Similarly we would use OR to test if one OR the other of two conditions were true:(A=3) OR (A>=10)would be true if A were equal to 3 OR A were greater tharogram using BDT to help you.(1) Input a number and print it out only if it is greater than zero.(2) Input two numbers and print out the smaller of the two.(3) Print out the numbers 1-10 using GOTO and a loop.Well, that's it for thisons of a program based on a variable's value.Execute the following temperature conversion program which is an extension of the one in the last chapter.E4CHCFNow write your own program. Pick one of the examples below, go into BASIC and write the prough the program in BDT.E3COUNTSUMGAVERAGEYou've seen the IF...THEN command act as a filter -- a device to reject values it doesn't like.The IF...THEN command can also be used as a switch to direct the computer to process different secti This program calculates change for a cashier.E2CPCHANGEThe next example will calculate your grade average. An IF...THEN command is used to leave the loop that is accumulating your test scores when you enter "-1".Observe this as you Step th:10 A=3 : B=6 : C=A+BThis is useful with the IF...THEN command because it allows for more than one command to be executed if the condition is true.10 IF N=6 THEN PRINT "N EQUALS 6" : GOTO 100Step through the following program in BDT. am. Use the P key to see how the IF...THEN commands control the printing on the BASIC screen.E1ABCBefore we go on, a little something extra. BASIC allows you to put more than one command on a line by separating them with a ":". For example15 AND B=3) THEN A=4550 END 1 A equals 7 2 A equals 15 3 A equals 45What is your choice?1232We will now enter BDT and see some of these IF...THEN commands in action.Step through the following sample progrls 44 2 A equals 43 3 $ There is no way of knowing what A will equal as it must be input when the program is RUN.What is your choice?1233Space for more.-10 A=720 B=330 IF NOT(A=7) OR B=3 THEN A=1540 IF NOT(A=40 END 1 A equals 2 2 A equals 10 3 $ This example will never end because A will never be greater than 9.What is your choice?1231Space for more.-10 INPUT A20 IF A<44 THEN GOTO 1030 END 1 A equa-10 A=320 IF A=3 THEN A=A-230 IF A=1 THEN A=4440 IF A>42 THEN A=1250 END 1 A equals 3 2 A equals 44 3 A equals 12What is your choice?1233Space for more.-10 A=020 A=A+230 IF A>9 THEN GOTO 20Space for more.-10 A=720 A=A+130 IF A<14 THEN GOTO 2040 END 1 A equals 7 2 A equals 14 3 $ This program will never end as we will keep branching to line 20.What is your choice?1232Space for more.---------------------------------------------Right! Wrong, try again.Enter 1, 2, or 3 only.10 A=720 IF A=7 THEN GOTO 4030 A=2340 END 1 A equals 7 2 A equals 23 3 A equals 40What is your choice?~1231instance:NOT (A=7)is true if it is NOT true that A equals 7, or in other words if A is not equal to 7. From this you see that:NOT (A=7) is equivalent to (A<>7).Let's see if you understand how the IF...THEN command is used in a program.n or equal to 10.There is one last operator to consider, NOT. We can use this with any condition to achieve the opposite effect of the condition. That is, if we placed the NOT operator before a true expression then the result would be false. For chapter. If you want to write a another program, backup and pick a different example.Writing programs and testing ideas is the fun part of using computers.+U:+Uj,U*U*U:@U*U.U*+uV*UzU*+U,U:0U*U*U*U*U*U*U:+U*@U*+U,U:0U*U*UX*U*U*00U*UNU*+U,U:0U*U*U*U*U*U*U:X*U*@U*@U*U:,U*U^*U*upU*U:V*U*FcCq0<pAGcC0`x<00U*@Acp`8||0@CAc@0pxx cx|~+U,U:0UjW*U:0U*U>`*U*,U*U*+U,U:0Uj+U*U*U*X*U*U*UX*U*F1~@aAq`8x`G+U,U:0U*U*u*U*Uj@,U*u@U*+U,U:0U*U*U*U*U*U*UjV*U:x@U*,U*U*g*U*U:,U*U*Uj`*U*U*0U*U*~aCqp<pAaC`?x<0`+up|`?~|x@cq0|~p@GcA0`x|?cx|U *A@T*Q T"P*U *A@(UQ T"P*@(*U* T@(P P U *A@(*(U"P D*P A*U @(P* T@(*U* T*U@(U*Q*U"U*D*U U**U*@(*A* (U(P Q*@ (*U* T*U@(U*Q*U"U*D*U U *A@(*(U"P D*P  U*( *A@( Q@"U *U@T(U"PD U  @D@U *U@T(U" D*l@PU *A@T*Q T"P*U @@(UQ T"P**U*T*U(U*P*U U*@*U U *A@(*(U"P D*P A U *U*T*U(U*P*U U*( P@( "D A* (*U*T*U(U*P*U U*@*U U**U*( @@( Q@"P D U *A@(*(U"P D*P (U*( *A@( Q@"U *U@T(U"PD U 2 x80U *U@T(U" D*D|@B U *A@T*Q T"P*U @@(UQ T"P**U*T*U(U*P*U U*@*U iklmnopqrstuvwxyU *A@(*(U"P D*P A U *U*T*U(U*P*U U*( P@( "D A* (*U*T*U(U*P*U U*@*U U**U*( @@( Q@"P D U *A@(*(U"P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? ? J J ? ? ? --???-M ->;.MI)d !)19GOdlt|,k2r>px@HPX`hpxQ =N 'Lf   " " I 7 > ) ? ! STEP THIS PROGRAM 6 TIMES+Q104C7?(WQCN2GCQ100i<PRESS "E" TO EXIT BDT mjn``ֆֆՆԆ$HH hՆh$Ԇ$$(H ( Ԑh$(ɠ.ֆɰɺ 䙬Ԇ  @ȌԆՆ ؙLNɈ ؙLNɕ ʙLNɍУ ؙH hՆ `ԆՆԆ$`ԆԆ$`)@)$($`LLOCATED` 'ELEMENT OUT OF RANGE`Ɇhh`hh eeHH`ȱekHȱelh`ȱHȱh``HH hmhm`0E:A)H9Æ .Æ .ÆmÆm.hmmL`h8`ʎJȱ iee8klLKꥃȑ0ȱ%0Bȱ0`Ɇ` WHȱh LyɆ` W 4 L~`Ɇ` WÆ8ÆÆ5ÆȱeeÆ  Æ[ ` 'NOT YET ALSL=jiklLiȥiL=iiLlkmnL LeHȱehL[򆩗H1Hȱ( HH)L Æ ʱL Æܥ ɐ 8` `ÆĆ J i 8ÆĆ(`H nhL k((): ( } (`ɆH Ɇh` k(i)i  yLx`ȱ }Æ ȔLLÔA Ȕ07  Ȕ0,% ȱ Ȕ0LT$( HhL Ȕ0U:Q0,)E Ȕ0>:,8$1 Ȕ0,*:&1" Æ ÆLÔ` 8`ÆÆ [ A :0`8` ȌÆ`L k(` k (` L LÆ' y yÆ ˒ VLÆ! y y ˒Æ VLÆ k$ }Æȩ " 瓰 ` y 񆩐 } کe` ˒` y ` 񆩐 }ȑCARPRICE(1) CACARPRICE(2) CACARPRICE(3) CACARPRICE(4) CACARPRICE(5) CACARPRICE(6) CACARPRICE(7) II NN >;.MI)>;.--m5???.MI)>;.MI)>;VIII---????.MI->;.MI);. --??7mI)57mI 5?7m--??III --->???-7575757?---5???VII----????.MI->;.MI)>;.MI)>;.MI)>;.MI)>;. --??III- ? --->???-757---5???757575III ---5????7 ߳RI NI??MI vRR-53M1smN56-3M13-u mR-3v-NI1*-n -u?R-3---u 3?w6N R-53M1?w ?M >6-3M13Mq)66N 56o )6M.nq)566-N5-n n N -n1nq)R-3M1s-N-3M?7nIR-53M1?w n5 76NIM17 n n NIM13m1n)n N )3M13M1s-N -3M?76NI )3M13 mN -3M?7 n N )3M:w -N --66vIMM13M13M1s-N M13M13MN IM13M1n >7MqM1s  3MqJM1s 6vI---.-uJ--;.>.>.-u5rVw-->.>.>*-u3M1?w *uIR >RMIN---ޛ-- *NI.)s N )3 -n--u M13--n N -3M?7M13-u J)36Ms-N -n1n1-u J--n?76--NJ--n?76NII)36M5s-uJM13M1??n n N -66-N I166s-N Mn7 n N 666-u ?wqImmw M:N)N-n mN-6R 6N56N 5 --NN n:?w1VIM7R?RINIVI 5)3M5.M-Nm1w6-N)sI.-u-->N-N>I> 3--v 5--.-6s-N -޻M:?n -N.--6NI))3M?M1s-N.)d )/9BS^ent'2=HZl}'8FXiy ,:DUdo(5DQan{" 66N nR>i----nN> ? ?> 7 > - ?          @@@@;.>MII ?J-5??-757575IIJ --->???.>.--???NI5---???VII55757--5??75757?-->?VI*MI5;.MI5;.MI5;.MI5?---5???VII* ߒ ߒ*m ->??w)-?.5?.??-m-5?;III;*MI5;.MI5;.MI5?-- 5?wI)>--??MII ? >.>.>.>.>V5 >5757mI57mI7--???.M)57mI5۷II 75757575757575 *-m)???7m)m)57m m 57m m 57m m 5IIII*--???7mI->7mI)>7mI)>7mI)>۷IIIJ--???-M)5;.MI5;.MI5?;w---??VII*--???7mI->7mI)>7mI-??7m->???-757?---5???VIIII 575-- 5??-MI57mI 57mI 5;w---->???VII J---5????-MI5?7mI-?;.M-?---->???VII- -5??-757--5??757575IIIJ---5????-MI57mI 5;w--m5??NI)>--??MI?5757---???7mI->7mI)>7mI)>7mI)>۷III57*mmI 57mI 57mI 57mI 57mI 57mI 5;w---->???VII  ; ; 7 ? 5 w 7 - - J---5????-MI57mI 57mI 5;w--m5??VIIm5757m--??7mI)57mI 57mI 5?7----???IIIJ---7 --???-M ->;.MI)>;.MI)>;.MI)>;.MI)>?---??II ----????.MI->;.MI)>;.MI-??7m--;.>.>VIII ---????.MI->;.MI)>;.MI-??7m--?7mI 57mI 5III ---5????-7?---???NI->.>ۛ----???III----5????wI57575757575II-7mII:??7m)-->;.MI)>;.MI)>?---->???VII5mI 57mI 57mI 57----5????7mI 57mI 57mI 5III55757575757575 ? 7 I575757575757---5???II ---M-???7m)m)57m m 57m m 57m m 57m m 57m m 5IIII5 )R---u -1-3vu?M13M1smNM13MN 5M13  NMMq-M13M1?w ?M .----N) ?--66M6 666n 66??-MiNI---5??7--5??7--5??7--u@@@C information. The stack in a computer can be compared to the device used in cafeterias to store plates. The device stores plates in a stack where only the top plate is available. When we put a plate on top of the stack (push in computer terms) the oStepping the last example that some information appeared in the stack window of BDT. Before you can understand what BDT was trying to tell you, you need to understand what a stack is and how it is used by the computer.A stack is a way of storinggative. For instance, the following would be a valid FOR command:10 FOR NUMBER=10 TO 0 STEP -1The first time through the loop NUMBER would equal 10, the second time 9 and so on until it reached 0.The StackYou may have noticed while you were ount by 2 instead of 1? There is an optional part of the FOR command, the STEP parameter. For example, to count from 0 to 10 by 2's we would use the following FOR command:10 FOR NUMBER=0 TO 10 STEP 2The STEP value can be any number, even ne1020 PRINT NUMBER30 NEXT NUMBERLine 10 tells BASIC that we are going to loop and count NUMBER from 1 to 10. Line 30 marks the end of the loop.Step through this program in BDT to see it work.F1NUMBERThe STEP ParameterWhat if we wanted to cize NUMBER to 1, line 30 to add 1 to it (increment it) and line 40 to test to see if our goal has been reached.The FOR/NEXT CommandThe FOR/NEXT command allows us to repeat a series of instructions within a loop. Look at:10 FOR NUMBER=1 TO More BranchingFOR/NEXT/STEP GOSUB/RETURN ON...The following program would count from 1 to 10 using IF...THEN and GOTO.10 NUMBER=120 PRINT NUMBER30 NUMBER=NUMBER+140 IF NUMBER<11 THEN GOTO 20In this program we use line 10 to initialeturns From Help ScreenTCBF T, C, B, F, or Space bar onlyEnter option or space bar to return Apple BASIC Help ScreenPress any of these keys, at any time, to jump around the lesson.Key-Jumps To: T -Table of Contents C -Beginning of Chapter B -Back One Screen F -Forward One ScreenSPACE-RhingZArrayscFunctionslStringsuPaddles and Sound~Lo-Res GraphicsHi-Res GraphicsDisk BasicsBASIC Disk ProgrammingText FilesABCDEFGHIJKLMNORE-ENTER! Press A-O onlyEnter your choice Apple BASICTable of ContentsDTable of Contents$ A - B 6 C ? D H E Q F Z G c H l I u J ~ K L M N O d$Introducing BASIC-BASIC Design Tool6Branching/Using BDT?Input/OutputHDecisionsQMore Brancther plates move down one position. When we get a plate off the top of the stack (pop in computer terms) the other plates move up one position.The difference between a computer and a cafeteria stack is that a computer stack holds information, not plates.If you backup and reenter BDT with the FOR/NEXT example, you will see the following appear in the stack window when you execute the FOR command:STACK: LEVEL=1 TOP=FOR/NEXT FROM 10What BDT is telling you is that the stack has one piece of infothe stack. When a RETURN command is executed, the program branches to the command on top of the stack. After the command is executed, it is popped off the stack and the command below is now on top.Watch the stack as you Step over the GOSUB and GOSUB/RETURN.F4ABCDid you notice the stack window while you were Stepping the program? The GOSUB/RETURN commands share the stack with the FOR/NEXT commands.Every time a GOSUB command is executed, the computer saves the next command on RINT "AVERAGE=";CIf we want to repeatedly access this routine from a program which changes the values of A and B, we just add:1030 RETURNWe can use the routine anytime we want with a GOSUB 1000 command.Now enter BDT and watch a program that uses command after GOSUB.You should use GOSUB/RETURN when you have a commonly used routine or subroutine. For example, assume we have a routine that averages two variables, A and B and prints the average.1000 REM SUBROUTINE1010 C=(A+B)/21020 Ped a GOTOcommand we've gone to a new area of the program. If we came back we used another GOTO.Using the GOSUB and RETURN commands, a segment of a program can be accessed from different locations. After each use, a RETURN sends you back to thegreater than the number of line numbers, than GOTO is not executed. The line following the ON...GOTO is executed next.The next example in BDT shows the ON...GOTO command in action.F3NThe GOSUB/RETURN CommandsSo far every time we've executThe ON...GOTO works with I acting as a counter or index for a list of line numbers.If I=1, then GOTO the 1st line (in this case 100).If I=2 then GOTO the 2nd line (in this case 200). This follows for all lines.However, if I is less than 1 or I 0 IF I=2 THEN GOTO 20040 IF I=3 THEN GOTO 30050 IF I=4 THEN GOTO 400Based on the value of the variable "I", we are going to branch to line 100 or 200, etc.We can perform the same function with ON...GOTO10 INPUT I20 ON I GOTO 100,200,300,40000:NEXT I30 PRINT "GOODBYE"The word "GOODBYE" would appear approximately one second after the word "HELLO". The ON...GOTO CommandNow for another shortcut. Look at the following segment of a BASIC program:10 INPUT I20 IF I=1 THEN GOTO 1003 backup and Step through the example again.By the way, a FOR/NEXT loop can be used as a delay in your program:50 FOR I=1 TO 500:NEXT Iwill take about 1 second. For example, if you ran the following program:10 PRINT "HELLO"20 FOR I=1 TO 50. The inner loop was from lines 20 through 40.Each time the outer loop executed, the inner loop executed 3 times. That is why the program added 1 to COUNT 12 times.4 outer loops * 3 inner loops = 12If you don't understand nested FOR/NEXT loops,sted FOR/NEXT loops. You should see the stack level go to 2 at certain points in the program. Try to understand how the stack is being used.F2N1N2COUNTThis program contained a loop within a loop. The outer loop was from lines 10 through 5It uses FOR/NEXT to perform its looping.10 FOR N1=1 TO 420 FOR N2=1 to 330 COUNT=COUNT+140 NEXT N250 NEXT N1Pay particular attention to the stack window as you Step. This program has one FOR/NEXT loop within another. They are called nermation on it (LEVEL=1) and the top of the stack is recording the fact that a FOR/NEXT command is in progress (TOP=FOR/NEXT FROM 10).As we go through this chapter we will refer to the stack window often.Now enter BDT and watch this program execute. RETURN commands.F4ABCThe ON...GOSUB CommandSimilar to the ON...GOTO there is an ON...GOSUB/RETURN command.The format is:10 ON ABC GOSUB 100,200,300,400Somewhere after the line 100, 200, 300 and 400 there is a RETURN command. The RETURN will be to the command following ON...GOSUB.Now that you've gotten through More Branching, why not write one of these sample programs before continuing.(1) Using a FOR/NEXT loop and STEP, print 10,9,8,7,6,5,4,3,2,1,0,BLAST OFF!instructions tell the computer to do something, but not REM. The REM instruction is a remark to anyone reading a program.10 REM THIS PROGRAM WAS WRITTEN20 REM ON 10/12/84 BY MARY JONES.REM instructions are not executed by BASIC; it passes oinstructions by 10's (10,20,30,...), but you can use any numbers you want in the range 0 to 63999.This is a typical line in a BASIC program:10 PRINT "HELLO"{ {*A BASIC instruction.*The line number.x(x(The REM InstructionMost l not do anything with these instructions until you tell it to. You do this by typing RUN and pressing RETURN.Numbered InstructionsEach BASIC instruction is numbered. BASIC always executes instructions by line number order. We usually number s and data in its memory. When the computer is on, its memory is active. When you turn it off it forgets. That's why programs and data must be stored on disks.When you type a BASIC program, you are storing the instructions in memory.The computer wilhave written or you can write your own.Before you are introduced to the power of BASIC Building Blocks you need to learn the basics of BASIC.The Computer RemembersA computer does exactly what you tell it to do and nothing more.It holds instructionr to return to this screen.Why don't you give it a try...but be sure to come back here.After you know some elementary commands you will learn to interact with the computer in a controlled environment.You can experiment with actual example programs we here the similarity ends. The benefit of a computer for teaching BASIC is the simple and rapid movement anywhere in the tutorial.Movement commands are located on the help screen. Press ? or / to see them. From the help screen press the space ba concepts from simpler ones, so become comfortable with each chapter before moving on.Now we'll show you how easy it is to review any topic as often as you like.Getting AroundThink of this lesson as a book. Each screen is like a page. But here is wIntroducing BASICLine Numbers REM END STOP Variables LETThis program has been carefully designed to present key BASIC concepts by allowing you to observe actual programs while they execute.BASIC Building Blocks is constructed to build advancedckup.Otherwise, it's time to move on to the next chapter.(2) Write a subroutine that will take NUMBER and set SQUARE equal to NUMBER*NUMBER. In a FOR/NEXT loop GOSUB this subroutine and print NUMBER and SQUARE for NUMBER=1 to 100.Did your program work? If you want to try again or write another, baver them. All programs should have some REMarks to explain what they do.The END and STOP InstructionsThe END and STOP instructions stop a program.They don't have much other effect but they do let you know that the program will stop when it gets to them.The difference between the two is that STOP prints the line number the program stopped on, while END does not.The program example below won't do anything, but it is a valid program.10 REM A USELESS PROGRAM20 ENDVariablesVariables13 into X 3 #Is incorrect because only a single number can be on the right of the = What is your choice?1232Space for more.P10 LET X+6=7 1 Moves 7 into X 2 Moves 13 into X 3 #Is incorrect becau3Space for more.P10 LET B=7000 1 Moves B 7000 times 2 Moves 7000 into B 3 Executes line 7000 nextWhat is your choice?1232Space for more.P10 LET X=6+7 1 Moves 6 into X 2 Moves the = What is your choice?1233Space for more.P10 LET 7=X 1 Moves 15 into X 2 Moves 7 into X 3 #Is incorrect, because there must be a variable on the left of the = What is your choice?123 1 into X 2 Moves X into X 3 Moves 0 into XWhat is your choice?1231Space for more.P10 LET A= 1 Moves 10 into A 2 Moves 0 into A 3 #Is incorrect because there must be something on the right of you test your understanding of the LET instruction. In each case choose the number which explains the instruction.---------------------------------------------Wrong, try again.Right! Enter 1, 2, or 3 only.P10 LET X=1 1 MovesET instruction. * We read this instruction: Store 1 in Variable A. In other words, a LET instruction takes what is on the right side of the = and moves it into the variable on the left side of the =.The following multiple choice questions will help to the left.The LET InstructionAs we noted above, variables hold numbers. We tell BASIC to store a number in a variable with the LET instruction.Let's examine the following BASIC instruction:10 LET A=1* 10 is the line number* This is a LE+09. This is the computer's way of saying 1 with the decimal point shifted 9 places to the right. Similarly if you told it to PRINT .000123, the computer would display: 1.23E-04. In this case the exponent is saying shift the decimal point 4 places te on Real NumbersA variable name that doesn't have a % is a real variable.Real variables store real numbers. Depending on the size of the number, you may see an exponent displayed. If you told the computer to PRINT 1000000000, it would display: 1ore integers between -32767 to 32767. Integers are numbers without a fraction. You tell the computer that a variable will hold integers by putting a % at the end of the name. These would all be integer variables:TEMP1% RESULT% G127% etc.A Noter and can consist of letters and numbers only.Some valid variable names are:COUNT2 SC XYZ123 A B C,but not:12 23SKIDOO #NUMBER (NAME).The Apple computer has two kinds of numeric variables, integer and real.Integer variables can st Apple understands as commands. For instance, the variable named "SCORE" would confuse the Apple because "OR" is a BASIC reserved word. You can be safe most of the time by using one or two character variable names.A variable name must begin with a letiable. For instance the two variable names "CALLS" and "CATTLE" refer to the same storage location "CA".Applesoft BASIC can be very fussy with variable names because reserved words cannot be part of a variable name. Reserved words are words that the are named areas in the computer's memory that hold numbers. A variable named "X" can hold the value 17 or 15.234 or -343.32.Variable names can be up to 238 characters long. However, the Apple only uses the first 2 characters when it references a varse only a variable can be on the left of the = What is your choice?1233The next questions show a sequence of instructions. Choose the correct answer assuming the sequence is executed.---------------------------------------------<10 LET A=620 LET A=7 1 A equals 13 2 A equals 6 3 A equals 7What is your choice?x1233Line 10 moved 6 into A. Then line 20 moved 7 into A, replacing the old value.Space for more.<10 LET A=720 LET B=Alike this:)1 Lesson * BASIC  BDTYou are now in the lesson. In a moment we will switch you into BASIC, and from BASIC you can activate BDT to watch a BASIC program execute on a line by line basis.We will show you commands that let you m that is running, you would hold down the CTRL key and press the C key.In this chapter and those following, 3 different environments exist. They are: the lesson, Apple BASIC, and BDT.If you could look into your computer's memory, it would look .We will load an example BASIC program, and go into BASIC to let you run the example using BDT.Before you use BDT, you should understand a normal RUN.Assume you are in BASIC with a program in memory. You would type RUN and RETURN. To stop a prograto your speed while observing program variables and their values.BDT hides in your computer's memory along with your BASIC program. In fact, it's there right now.We'll use BDT quite often in this lesson to demonstrate BASIC instructions and techniquesBASIC Design ToolBDT Expressions LET againAs part of this package we have included an exciting new program called BDT (BASIC Design Tool). BDT acts as a window into your computer letting you take a normal BASIC program and slow it down  COUNT0COUNTCOUNT1'20 pter.We've covered Line Numbers, REM, END, STOP, LET and variables.If you are not sure of something, backup and read it again.In the next chapter you'll learn about the BASIC Design Tool. 1 A equals 15 2 A equals 115 3 #Line 20 is incorrect, A does not equal A+100What is your choice?1232Line 20 took the value out of A, added 100 to it, and stored it back in A. Well we've covered a lot in this cha10 LET A=720 LET B=1630 LET C=A+B 1 A equals 7; B equals 23; C equals 16 2 A equals 7; B equals 16; C equals 23 3 A, B and C equal 23What is your choice?1232Space for more.<10 LET A=1520 LET A=A+100able) into the variable on the left of the =.Space for more.<10 LET A=2520 LET B=A+15 1 A and B equal 25 2 A equals 25; B equals 40 3 A and B equal 15What is your choice?x1232Space for more.< 1 A and B equal 7 2 A equals 0; B equals 7 3 #Line 20 is invalid because there must be a number on the right of the =What is your choice?1231LET moves what is on the right of the = (including the value of another variswitch from one environment to another.We will take you through them, but this is how they look as an overview:v E @}|)1 Lesson * BASIC  BDT@|s{|{>Space barCTRL-BWe'll show you this step-by-step.DVVDsusssGetting Into BASICWhen we have an example program for you to run with BDT, the message at the bottom of the screen will be:Space bar for example or ? for helpWhen you press the space bar we'll enter BASIC, load the example program and liing S . Also watch the variable window.For your convenience all examples are listed in Appendix I of the User's Manual.REMINDER:CTRL-B Enter BDT from BASIC S Step one instruction E Exit back to the lessonB2QCWGDid you notice BDTNow it's time to run a program with BDT. This program has 6 lines numbered 10 through 60. After you enter BDT from BASIC with CTRL-B, you'll need to Step 6 times to see the whole program. Remember to watch the statement window as you're pressR PRESS ? FOR HELP"is displayed. However, when you type a command the command name will appear on the line. For instance, if you Step through a program, the word "STEP" will be momentarily displayed on this line each time you press S .Let's Useline will display the next statement.The Stack WindowThis window is used to study more advanced BASIC programs.We will examine this window later.The Command LineThis is where commands to BDT are displayed. Normally the message:"ENTER COMMAND Otop line is the statement that was last executed. The bottom line is the statement about to be executed.When you press S , the statement about to be executed will be executed, and will then move up to the just executed line. The about to be executed ted with BDT you can watch the values of variables change as commands affect them.This window also displays BDT help when you press the ? .The Statement WindowThe statement window is just below the variable window. It consists of two lines. The the top of the BDT screen just below the title.It is divided into halves by a line down the center. On the left will be the names of the variables used in the program. On the right will be the values those variables contain. As a program is being execu you did not notice these areas and try to figure out where they are. If you have trouble identifying them, look in the User's Manual. Remember to press the space bar to load the example.The Variable WindowThe variable window is the large window at from BDT.B1You Made It!Did you examine the BDT screen? You should have noticed a couple of things. The BDT screen has four separate areas.(1) The variable window(2) The statement window(3) The stack window(4) The command lineBackup iff these steps:(1) Press the space bar. This will enter BASIC, load the example and list it.(2) From BASIC press CTRL-B to enter BDT.(3) Look at the BDT screen and familiarize yourself with it.(4) Exit back to the lesson by pressing Enter BDT then press E to exit.D[[Let's Try BDTYou are now ready for your first use of BDT. For this first time through don't worry about Stepping the program. We just want to familiarize you with getting in and out of BDT. Make a note oant, you will exit back to the lesson by pressing E .v E @}|)1 Lesson * BASIC  BDTNote: You must be in BDT to return to the lesson. This means if you are in BASIC looking at the BASIC screen you must first press CTRL-B to e BDT|{CTRL-B(2) To run your program in BDT one step at a time by pressing S each time you want to execute an instruction.PPReturning to the LessonWhen you have Stepped to the end of the example program or have seen all you wst it on the BASIC screen.)1 Lesson * BASIC  BDT@|s{>Space barDuOnce we are in BASIC, your part will be:(1) To enter BDT by holding down the CTRL key and then pressing the B key.)1 Lesson * BASIC  the line40 LET W=Q-C ?The computer evaluated an expression and stored the expression's value in "W". Expressions can be as easy as 10-7 or as difficult as (10*2)/(30-26).Let's look at (10*2)/(30-26). The / means divide, the + means add, the - means subtract and the * means multiply. Parentheses mean evaluate first.So (10*2)/(30-26) is evaluated:120/(30-26)120/4?5Parentheses inside parentheses are evaluated before anything else.Look at: ((10+4)/7)-28(14/7)-22-20It's best rrays are useful when variables are used to index them.AGE(A)means:Take the value of A and use that element of array AGE.So,10 A=320 AGE(A)=7Sets the third element in array AGE, AGE(3), equal to 7.The DIM CommandWe tell BASIC thatay holds a list of values.Variable:xArray:AGE=17xAGE(0)=12xAGE(1)=14AGE(2)=29AGE(3)=2The array AGE actually contains 4 different variables which share the same name.We say AGE sub zero for AGE(0),AGE sub one for AGE(1), etc.Acause the RESTORE command would force the next READ to get the first piece of DATA, again.Using ArraysThe usefulness of READ and DATA cannot be fully appreciated until we use arrays. You know that a variable holds a single value. An arrndA command sometimes used with READ and DATA is RESTORE. This command resets READ to start with the first piece of data in the DATA command.In this program:10 DATA 1,2,320 READ A30 RESTORE40 READ BA would equal 1, but so would B bee'll see printed is 1, 5, 7, and so on.Eventually the program will run out of DATA to READ and will stop with a BASIC error OUT OF DATA. After the error, press CTRL-B to get back into BDT. Let's watch it in BDT.G1NUMBERThe RESTORE Comma to variables.Look at the following program:10 DATA 1,5,7,13,1720 READ NUMBER30 PRINT NUMBER40 GOTO 20Line 10 contains the DATA to be READ in line 20. Line 30 will print the value of NUMBER, and line 40 will loop back to line 20. What wArraysREAD DATA RESTORE DIM SortingREAD and DATA provide another way to assign values to variables:10 READ A,B,C20 DATA 2,4,6will do the same as:10 A=2:B=4:C=6READ and DATA together provide a shorthand way to assign valuesl, you might want to RUN the programs after chapter C before entering BDT to see what they do.ourself so far.One final note before we move on to the next chapter. The programs in the beginning of this tutorial are designed to be seen using BDT. If you RUN these programs from the BASIC screen you would not see anything on the screen. In genera optional in these examples. We can write:10 A=76or10 LET A=76They both assign the value 76 to the variable "A". The LET command is also called the assignment command because it assigns a value to a variable.We hope you're enjoying yto use parentheses to indicate the order of evaluation. Look at: 4*7-8/4(4*7)-(8/4) ((4*7)-8)/4 (4*(7-8))/428-(8/4) (28-8)/4 (4*-1)/428-2 20/4 -4/426 5 -1Parentheses make a difference!By the way, LET is we want an array to have a certain number of elements by using the DIM (dimension) command:10 DIM AGE(4)Tells BASIC to create:AGE(0), AGE(1), AGE(2), AGE(3) and AGE(4).*** Notice there are actually 5 elements because the array starts at 0.But what can we do with arrays?We're glad you asked...One way to use arrays is with the READ and DATA commands.The next example program dimensions an array named "CARPRICE", READs values into the array, and then allows us to access those5NUMBS(0)NUMBS(1)NUMBS(2)NUMBS(3)NUMBS(4)NUMBS(5)NUMBS(6)NUMBS(7)IJSWAPSHOLDHold on to your hats!We're going to get fancy!Did you notice the preceding sorts could bubble down very quickly, but bubbled up just one step for each pass threts a switch during each pass through the array if any swaps were made. After each pass the switch is checked for swaps. If no swaps were made then the array is completely sorted.Try this one several times and see how much smarter and faster it is.Gis time input the numbers 0, 1, 2, 3, 4, 5, 6, 7 to sort.G4NUMBS(0)NUMBS(1)NUMBS(2)NUMBS(3)NUMBS(4)NUMBS(5)NUMBS(6)NUMBS(7)IJHOLDDid you notice the program sorted the numbers even though they were already in order?How dumb!The next sort swhat we have shown you before continuing.The rest of the chapter deals with advanced sorting concepts. If this doesn't interest you, skip ahead to the end the chapter for the sample programs.Let's enter BDT again and run the same sort one last time. Th2, 3, 4, 5, 6, 7, 0 to be sorted.Watch how the 0 bubbles up into place.G4NUMBS(0)NUMBS(1)NUMBS(2)NUMBS(3)NUMBS(4)NUMBS(5)NUMBS(6)NUMBS(7)IJHOLDYou should understand arrays and sorting to go on. If you have any doubts, please review ) is moved to a variable named HOLD. Then NUMBS(J+1) is moved to NUMBS(J). That's why we moved NUMBS(J) to HOLD. Then HOLD is moved to NUMBS(J+1). This completes the swap.Let's run the last example again under BDT. This time enter the numbers 1, NUMBS(J)=NUMBS(J+1):NUMBS(J+1)=HOLDJ is being varied from 0 to 6. The condition in the IF command looks at NUMBS(J) and tests to see if it is larger than NUMBS(J+1). If it is, then the two are out of order and must be swapped. First NUMBS(Jrogram had to compare 9 pairs of numbers 10 times. The more numbers we wanted to sort, the longer it would have taken.And you thought computers were fast!Did you understand the comparison statement?1130 IF NUMBS(J)>NUMBS(J+1) THENHOLD=NUMBS(J):ple program several times in BDT and pay careful attention to the routine that actually sorts.G4NUMBS(0)NUMBS(1)NUMBS(2)NUMBS(3)NUMBS(4)NUMBS(5)NUMBS(6)NUMBS(7)IJHOLDDid you notice how long the bubble sort took?To sort 10 numbers the p)=19A(1)=3A(2)=7 and ending up withA(2)=7A(3)=-1A(3)=12A(4)=3A(4)=19There are many ways to sort. Here's the simplest. It's called a bubble sort because out-of-order elements "bubble" to the correct place in the array.Run the sam(9,9)YXSorting ArraysIt's time to use arrays to their full advantage.Sorting is a technique by which unordered arrays can be ordered, or unalphabetized lists can be alphabetized.By this we mean taking an array like:A(0)=12A(0)=-1A(1 or matrix.Let's go into BDT and watch a program create a multiplication table and store it in a two dimensional array.G3MULTTABLE(1,1)MULTTABLE(2,2)MULTTABLE(3,3)MULTTABLE(4,4)MULTTABLE(5,5)MULTTABLE(6,6)MULTTABLE(7,7)MULTTABLE(8,8)MULTTABLErencing array elements. BASIC allows you to create multiple dimension arrays which can have up to 88 indices. The following would create a two dimensional array with 100 elements:10 DIM A(9,9)A two dimensional array can be thought of as a table values.G2CARPRICE(0)CARPRICE(1)CARPRICE(2)CARPRICE(3)CARPRICE(4)CARPRICE(5)CARPRICE(6)CARPRICE(7)INMultiple Dimension ArraysThe arrays we have seen so far have been single dimension arrays. This means the array had one index for refeough the array?Backup and go through the sort again if you did not notice this.Our next sort bubbles down and then up. This way the most out-of-order elements are grabbed and moved into place quicker.This sort also shortens the number of comparisons during each pass. This is possible because on each pass the most out-of-order element will be deposited in the correct place, and we never need to look at it again.Enter BDT and try to figure out the two-directional, shortened path bubble sort.G6Non by pressing the E key as this example will never end.C1COUNTThe BDT Trace CommandThere are times when pressing the S key can be tedious. In this case you can trace the program by pressing the T key while in BDT. While you are trao the bottom line in the statement window. This displays the line to be executed next. You will be able to see the effect of the GOTO command in a visual way.Step through the program until you understand what it is doing, and then return to the lessogram also loops forever, but at least line 20 accomplishes something. Each time line 20 is executed, 1 is added to the value in "COUNT". This program will count forever -- until you stop it.We will watch this program run under BDT. Pay attention tprogram back to line 10. The program is now in a loop. Line 10 will execute and move 7 into "A" again and so on until you stop the program by pressing CTRL-C.Let's look at another small program:10 COUNT=020 COUNT=COUNT+130 GOTO 20This prest line number. The GOTO command lets us alter the sequence in which instructions are executed. Look at:10 A=720 GOTO 10First, line 10 is executed. This will store the value 7 in variable "A". Then line 20 is executed which will send the er BDT. In BDT see if you can figure out what effect the next instruction (the one on the second line of the instruction window) will have before it executes.The GOTO CommandSo far, the programs you've seen have executed from the lowest to the highBranching/Using BDTGOTO Entering programs LIST NEW DELYou have reached the third leg on your journey through BASIC.You should read every screen of this lesson carefully. When you enter BASIC try to understand the example program before you ent back.Why not backup and write the other suggested program if you have not already done so.That's all for ARRAYS. Time to move on to the next chapter.fter the tenth, print them out using another FOR/NEXT loop.(2) Initialize an array of ten numbers using READ and DATA inside a FOR/NEXT loop. Use INPUT to read a number from 0-10. If it is 0 then stop. Otherwise, print that array element and loopnteger array by ending the name with % . For instance, I%(10) would be a valid integer array element.Practice the concepts covered in this chapter by writing these suggested programs.(1) In a FOR/NEXT loop input ten numbers into an array. Am, however as programs get larger you may want to use integer arrays. Integer array elements take only 2 bytes of storage, while reals take 5 bytes (a byte is the basic unit of storage in a computer).You tell the computer that an array will be an iUMBS(0)NUMBS(1)NUMBS(2)NUMBS(3)NUMBS(4)NUMBS(5)NUMBS(6)NUMBS(7)ITBSWAPSHOLDInteger ArraysAll the arrays we have been using were real arrays. This means that each element of the array was a real number. This is fine for a small progracing a program you can vary the speed of the trace by pressing a digit from 0 to 9 where 0 is pause and 9 is full speed. To stop a trace, press any key except the number keys. You can't press E to exit the lesson until you've stopped the trace.REMINDER: T Trace a program 0 ... 9 Vary the speed of a trace.C1COUNTThe GOTO command doesn't just loop. Look at:10 A=620 GOTO 4030 A=1240 ENDLine 10 will move 6 into "A". Line 20 will branch to line 40, skipping lveral times.(4) Enter BDT with CTRL-B.(5) Notice the variable window is empty.(6) Step through the program.(7) Exit back to the lesson.Note: One program line must be entered before CTRL-B will switch you to BDT.Entering Variables In BDTDid start over with a "clean slate".Now you'll enter a simple program to get used to entering and editing a program. Make a note of these steps.(1) Press the space bar to enter BASIC.(2) Type in the following two lines:10 A=720 B=A(3) LIST it se You can pause and then restart a listing by pressing CTRL-S.You should also know how to clear a program from the computer's memory.The command to use is NEW. This command deletes any program that is in memory. It is useful any time you need to LIST 100, would list all the lines from 100 to the end of the program.LIST ,100 would list all the lines from the beginning of your program to 100.You can substitute a dash (-) for a comma in the LIST command. You can stop a list with CTRL-C.u should know how to use the LIST command to see the program in the computer's memory. This command has several formats:LIST would list the whole program.LIST 100 would list line 100 only.LIST 100,200 would list all the lines from 100 to 200.lines. To delete a single line type the line number of the line to be deleted and press the RETURN key.To delete a range of lines, use the DEL command. To delete all the lines from 100 to 150 inclusive type:DEL 100,150 and press the RETURN key.Yohe program, the computer finds an error, it will display: "?SYNTAX ERROR IN" followed by the line number. To correct the line, figure out what is wrong and retype the line using the same line number.The second thing is to delete a line or a range of w to enter and edit a program.Entering and Editing a ProgramThere are several things you need to do.First you need to enter a program line. Do this by typing the line number followed by the BASIC command(s) and pressing RETURN.If when you run tt BDT is that it can be used to work on programs you write.When we plan to go into BASIC/BDT, the message at the bottom of the screen will read:Space bar for BASIC/BDT or ? for helpBefore we let you use BDT on your programs, we must teach you horam will loop forever, so the value of A is indeterminant.What is your choice?1233Using BDT With Your ProgramsSo far when we have gone into BASIC/BDT we've loaded the program for you to run. However, one of the best things abou0 GOTO 5040 END50 A=1460 END 1 A equals 7 2 A equals 14 3 A equals 21What is your choice?1231Space for more.<10 A=020 A=A+130 GOTO 2040 END 1 A equals 1 2 A equals 0 3 This prog20 GOTO 5030 D=740 END 1 D equals 4 2 D equals 7 3 This program is incorrect because line 20 sends the program to line 50 which doesn't exist.What is your choice?1233Space for more.=10 A=720 GOTO 403onse assuming each program was run.---------------------------------------------<10 A=720 GOTO 4030 A=2340 END 1 A equals 23 2 A equals 7 3 A equals 30What is your choice?1232Space for more.=10 D=4ine 30. Line 40 will end the program. This means that line 30 will never be executed.Let's enter BDT and Step through it.C2AWrong, try again.Right! Enter 1, 2, or 3 only.We will show you a small program. Choose the correct respyou try to enter BDT before you typed in a program line? If you did you would have returned to the lesson without going into BDT. This is because at least one BASIC line must be typed in to use BDT.To use BDT effectively on your own programs, you must learn how to set up the variable window. You should have noticed that the program you typed in did not have any variables showing in the variable window.In the examples that we load, we set up the variable window.After you have typed in your program, plows you to see the value of a variable. This is the PRINT command. For example, if we ran this program:10 A=720 PRINT AWe would see a 7 displayed on the BASIC screen.The PRINT Command and BDTIf you are Stepping a program in BDT andd or display information on the video screen, you will need these commands.The PRINT CommandPretend for a minute you do not have BDT. If you wanted to know what value a variable had you would have a problem. However, BASIC has an instruction that alInput/OutputPRINT TAB SPC INVERSE NORMAL FLASHSPEED HOME VTAB HTAB INPUT GETIn this chapter you'll see the commands that are used in BASIC for input and output. That is, anytime in a program you wish to get information from the keyboar  A640A12 ( and.When you're in BDT, you can press the ? or / key to display the BDT commands we have discussed here.If you think you're ready, let's move on to the next chapter. key. You use ESC to get back into BASIC from BDT. Don't confuse this with E which you use to return to the lesson.uESC}|)1 Lesson * BASIC  BDT<{|| E @You might want to backup and try the ESC comm before CTRL-B will switch you to BDT.The BDT ESC CommandDid you have trouble entering the variables? If you did Backup and review the steps for entering variables and try again.There is another BDT command that you will need to know, the ESC(2) Type in the following two lines:10 A=720 B=A(3) LIST it several times.(4) Enter BDT with CTRL-B.(5) Enter "A" and "B" in the Variable Window.(6) Step through the program.(7) Exit back to the lesson.Note: One program line must be enteredPPLE.Note: Remember to press V before entering a variable name and be sure to use a valid variable name.Now you'll enter BASIC/BDT again, but this time you'll set up the variable window. Follow these steps:(1) Press the space bar to enter BASIC. inverse line will disappear and the words "NOT YET ALLOCATED" will appear on the right side of the screen.To add another variable, move the pointer to a blank line using the UP/DOWN arrow keys on an APPLE //e or the < and > keys on a standard Aress CTRL-B to enter BDT. The variable window will be blank except for a pointer ">". If you press V the left half of the line with the pointer on it will be displayed in inverse. Type the name of the variable you want to see and press RETURN.The you execute a PRINT command, you won't see anything displayed on the BDT screeen. This is because it will be printed on the BASIC screen which you are not looking at.To see the BASIC screen press the P key. To return to the BDT screen press P again. Because you never left BDT, you can execute any BDT command regardless of which screen you're looking at.)1 Lesson * BASIC <-----> BDT P The PRINT command can do more than just print a single variable. Assume we've VTAB and HTAB CommandsA command related to printing is HOME. HOME clears the whole text screen, and moves the cursor to the upper left hand corner of the screen.If you wish to move the cursor to any point on the screen, you would use the VTAB andppear at whatever speed was last set. The same is true of INVERSE and FLASH. If you set INVERSE printing, you will have to use the NORMAL command to restore normal output.The following example will show how these commands are used.D2HOME,printed on the screen. SPEED=0 would cause letters to appear at the slowest rate, while SPEED=255 would be the fastest rate. If you don't tell the computer, it will set SPEED=255.If output speed is not returned to the normal 255, all output will at to switch from white on black to black on white and back again approximately once a second. NORMAL will reset the output to white on black from flashing or inversed.The SPEED CommandSPEED is used to set the relative speed at which letters are d FLASH CommandsThere are several commands that change the way PRINT will display output on the screen.INVERSE will change any subsequent PRINT command to output in black on white text rather than the normal white on black.FLASH will cause outpuT, ESC or any other BDT command no matter which screen you're looking at.Note: When a PRINT command outputs something to the BASIC screen while you are in BDT, the screen will flicker to indicate that output has occurred.D1AINVERSE, NORMAL anNow it's time to see some PRINT commands in action with BDT.Step through the following program example in BDT. After several lines press P to see the output on the BASIC screen and then again to return to the BDT screen.You can use the S, ted to print a number starting in column 10, you would execute a PRINT command as follows:10 PRINT TAB(10);NSimilarly, if you wanted to print two numbers separated by 5 spaces you would use the following PRINT command:20 PRINT N1;SPC(5);N2tput will be printed is shown on the screen by the blinking box. This is called the cursor.TAB and SPCTAB and SPC are used in conjunction with a PRINT command to position the cursor (the point where the next output will appear). If you wancomputer will move to the next line and continue printing. If it is at the bottom line of the screen it will scroll (move each line up one on the screen). The screen is made up of 24 lines. Each line can have 40 characters.The point where the next oualue.Space for more.~70 PRINT "A="A" B="BA=100 B=1000The ";" is normally not needed.The Screen and the CursorWhen a program prints on the BASIC screen it will keep printing on a line until it reaches the right hand edge.Then the for more.~60 PRINT "THE ANSWER IS",A+B+CTHE ANSWER IS 1067Characters between quotes are printed exactly as they appear.Space for more.~70 PRINT "A=";AA=100The ";" prevents spaces from being printed between the "A=" and A's v100Space for more.~40 PRINT A,B,C100p1000-33The "," causes numbers to be printed at the tab stops at column 0, 16 and 32.Space for more.~50 PRINT A+B+C1067The variables are added. Expressions are permitted.Space executed the following lines.10 A=10020 B=100030 C=-33Press the space bar to simulate each of the following PRINT commands and observe the many ways that the PRINT command can work.----------------------------------------------PRINT A HTAB commands. VTAB positions the cursor vertically to a row of the screen where 1 is the top, and 24 is the bottom. HTAB positions the cursor horizontally to a column of the screen where 1 is the left and 40 is the right.Let's go into BDT and see how to use these cursor positioning commands.D3IThe INPUT CommandSo far, our programs have calculated using assignment commands, looped using GOTO commands, output using PRINT commands, and even reminded you with REM commands. Now we'll you did at the end of the last chapter.Your program should input two numbers and store them in variables "A" and "B". Calculate the average and store it in variable "C". Print out the average.See Appendix II of the User's Manual for solutions to the suThe following program would GET and PRINT a single digit from the keyboard.10 GET A20 PRINT ALet's go into BDT and watch a program that uses the GET command.D8ANow it's time to write your own programs.You should enter BASIC/BDT like we need a response to a question like Y or N or T or F. When we learn about strings we'll see how to GET an alphabetic character. Just like the INPUT command, BDT will flip to the BASIC screen when the GET command is waiting for a response.until you are in the loop, lines 100-140. Then use T to start the program moving on it's own.D7BIYEARThe GET CommandThe GET command fetches a single character from the keyboard without making the user press RETURN. This is very useful if program will continue.D6FCThis sample program computes the growth of a bank account assuming annual compounding of interest.Even with the small number of commands that we've learned we are able to write useful programs.In BDT use S to execute ing an INPUT command you will not exit as the INPUT command received the E not BDT.) Remember, if you make a mistake in an INPUT command, the "?REENTER" error message will appear on the BASIC screen. Just type in a number, press RETURN and the tep through the program as many times as you wish.D5MGMPGThe next sample program converts Fahrenheit to Celsius.Run the program, and then enter BDT to watch it execute on a line-by-line basis.From BDT, press E to exit (if you press E dur in BDT as we demonstrate how to use the commands presented in this chapter.After you have Stepped through the program in BDT you can rerun the program by pressing ESC followed by CTRL-B. This will restart the program in BDT. You can do this to Sd the program will continue.Now let's test some INPUT commands under BDT.D4N1N2ABCYou can also use a PRINT command before an INPUT command instead of including a message with the INPUT command itself.Step through the following programlip back to BDT.Note: If you input a letter when the program is expecting a number, the error message, "?REENTER", will appear on the BASIC screen. The INPUT command will be repeated in the BDT statement window. Just type in a number, press RETURN, anthe computer that you are finished typing a response by pressing the RETURN key.The INPUT Command and BDTWhen you use BDT, executing an INPUT command will flip you from the BDT screen to the BASIC screen. When you press RETURN the screen will f The difference is the first would display a question mark, while the second would display "A MESSAGE TO PRINT" and no question mark.When an INPUT command is looking for input from the user, the computer will wait until you type something in. You tell white box. The "?" tells you that your program wants you to type in some information.There are two forms of the INPUT command:10 INPUT A8or10 INPUT "A MESSAGE TO PRINT";ABoth would get a value from the user and store it in the variable "A". show you how to communicate with your program using the INPUT command:10 INPUT GRADEtells BASIC to ask you to type in a value which will be stored in the variable named "GRADE". A question mark, "?", will appear on the BASIC screen along with a ggested problems.Let's write one more program. This program should do the following:Input your age and store it in a variable called "Y". Calculate your age in months (Y*12), and store it in a variable called "M". Print out your age in months.Modifying ProgramNow you're ready to experiment with another powerful feature of computers.Try reviewing example programs, but this time modify them by adding or changing lines to better understand how they operate.For example, you can add lines which' "ENTER DEGREES FAHRENHEIT -->";F9C(F32)59?m(F;" DEGREES FAHRENHEIT IS ";C;" CELSIUS"s2 * "ENTER NUMBER OF MILES DRIVEN -->";4"";M_"ENTER GALLONS OF GASOLINE USED -->";i("";Gu2MPGMG<"MILES PER GALLON = ";MPGF  "ENTER A NUMBER";N10"AND ANOTHER";N27A>(BE2CK<  %LOOK AT THE BASIC SCREEN1I1108(IA2"X"H<IPF10]P"HELLO"eZ20td"GOODBYE"|n15x10"IN THE MIDDLE" AR FASTEST"  "THIS IS INVERSE"$:("BACK TO NORMAL"@2X<"THIS IS FLASHING"^FtP"BACK TO NORMAL"ZPRESS "P" TO SEE BASIC SCREENd10n"THIS WILL APPEAR SLOWLY"x200"THIS WILL APPEAR FAST"255 "THIS WILL APPE+ "THE FOLLOWING IS A LIST OF NUMBERS"3A0=AA1D(Ae2"P" TO SEE THE BASIC SCREENm<30 utput. Careful use of the cursor moving commands combined with PRINT and INPUT can result in very attractive displays.Now it's time to move on to the next chapter. print out variables or substitute your own variables in place of the ones you've been given.Most programmers like to modify existing programs to meet their unique needs. It's easier than starting from scratch.This concludes our chapter on input and o0 "ENTER STARTING BALANCE IN DOLLARS -->";B^ "ENTER INTEREST RATE (.07 FOR 7%) -->";Ii YEAR0s dLOOP nYEARYEAR1 xBB(1I) "BALANCE AFTER ";YEAR;" YEARS IS ";B 100  N114N213+COUNTCOUNT13(N2;2N1  NUMBER110NUMBER*NUMBER DEGREES FAHRENHEIT -->";F,C(F32)5963000C C TO Ff"ENTER DEGREES CELSIUS -->";CuFC9532{  "FAHRENHEIT ";F;" = ";C;" CELSIUS"  20  2"ENTER '1' FOR FAHRENHEIT TO CELSIUS"]" OR '2' FOR CELSIUS TO FAHRENHEIT"w(" OR '0' TO STOP."2"ENTER YOUR CHOICE --->";CH<FCH0ĀPCH1ī1000ZCH2ī2000d"INVALID CHOICE"n20 F TO C"ENTER ' "ENTER YOUR TEST SCORES (0-100)"B"STOP BY ENTERING -1"NCOUNT0X(SUM0j2COUNTCOUNT1<"ENTER GRADE #";COUNT;" -->";F"";GPG1110ZSUMSUMGd50nAVERAGESUM(COUNT1)x"YOUR AVERAGE IS: ";AVERAGE  +"ENTER COST OF PURCHASE -->";CJ"ENTER AMOUNT PAID -->";Pr(PCĺ"THAT'S NOT ENOUGH MONEY":202CHANGEPC<CHANGE0ī80F"YOUR CHANGE IS $";CHANGEP"THANK YOU"Z  A1B2C36(ABĺ"A IS LESS THAN B"S2"P" TO SEE BASIC SCREENu<BCĺ"THIS SHOULDN'T HAPPEN"FABCĺ"EXPRESSIONS CAN BE IN CONDITIONS"PA1ĺ"A IS EQUAL TO ONE"Z(A)ĺ"ONE IS CONSIDERED TRUE"d  ""ENTER 0 TO END -->";)A0(A>2A0ī20D< & "ENTER A NUMBER FROM 1-4 -->";N3N0ī40JN100,200,300,400^("OUT OF RANGE"f210yd"WENT TO 100"n10"WENT TO 200"10,"WENT TO 300"610"WENT TO 400"10  "ENTER 8 NUMBERS"& NUMBS(7)1 I07Q ("ENTER NUMBER #";I;" -->";b 2"";NUMBS(I)i <I dSORT STARTS HERE nT0:B6 xSWAPS0 ITB 1000 I SWAPS0240 SWAPS0 IB1T1 1000 I SWAPS0ī24WAPS0180 I  "ENTER 8 NUMBERS"&NUMBS(7)1I07Q("ENTER NUMBER #";I;" -->";b2"";NUMBS(I)i<IdSORT STARTS HEREnI07xSWAPS0J06NUMBS(J)NUMBS(J1)HOLDNUMBS(J):NUMBS(J)NUMBS(J1):NUMBS(J1)HOLD:SWAPS1J S "ENTER 8 NUMBERS"&NUMBS(7)1I07Q("ENTER NUMBER #";I;" -->";b2"";NUMBS(I)i<IdSORT STARTS HEREnI07xJ06NUMBS(J)NUMBS(J1)HOLDNUMBS(J):NUMBS(J)NUMBS(J1):NUMBS(J1)HOLDJI  MULTTABLE(9,9) Y19+X19B(MULTTABLE(X,Y)XYI2XP<Yjd PRINT OUT THE TABLEunY19xX19X31MULTTABLE(X,Y);XY  CARPRICE(7)B4995,6215,6999,7885,9500,10750,11250,11995MI07^(CARPRICE(I)e2Id"WHAT CAR PRICE DO YOU WANT? (0-7) -->";NnN0N7ĺ"ILLEGAL NUMBER":100x"CAR ";N;" COSTS ";CARPRICE(N)100  1,5,7,13,17NUMBER*NUMBER2(20  A10B301000&(A21/2B679<1000EFA6.023SPB3.14159]Z1000cdt SUBROUTINEC(AB)2"AVERAGE=";C 0 TT1:BB1 120" C  COMPARISON/SWAP SUBROUTINE NUMBS(I)NUMBS(I1)HOLDNUMBS(I):NUMBS(I)NUMBS(I1):NUMBS(I1)HOLD:SWAPS1