home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / basic / basictut.ark / TUTR.02 < prev    next >
Encoding:
Text File  |  1985-02-10  |  5.3 KB  |  125 lines

  1. 3000    rem   TUTR.02         Ver 2.0   01AUG83
  2. 3010 quote$ = chr$(34)
  3. 3020 gosub 4220
  4. 3030    print "Well, I'm glad you made it. I've been waiting for you so that"
  5. 3040    print "we could continue our lesson. So far, we have covered the"
  6. 3050    print "'INPUT' statement, the 'LET' statement (and its symbols), and"
  7. 3060    print "the 'PRINT' statement. Our sample program looks like this:"
  8. 3070    print
  9. 3080    print "10 INPUT X, Y, Z"
  10. 3090    print "20 LET R = SQR (X^2 + Y^2 + Z^2)"
  11. 3100    print "30 PRINT R"
  12. 3110    print "40 END"
  13. 3120    print
  14. 3130 gosub 4190
  15. 3140 gosub 4220
  16. 3150    print "We can do much more with the 'print' statement: besides printing"
  17. 3160    print "the value of a variable of interest (in our case, 'R') it can also"
  18. 3170    print "be used to type out labels.  Anything in quotes following the"
  19. 3180    print "'PRINT' statement will be typed out literally on the screen. So, we add:"
  20. 3190    print
  21. 3200       print "30 PRINT ";quote$;"The radius vector equals"quote$";R"
  22. 3210    print
  23. 3220 gosub 4190
  24. 3230 gosub 4220
  25. 3240    print "By using statement number 30 again, we replace the earlier "
  26. 3250    print "statement 30. This is one way to correct a program. The phrase in"
  27. 3260    print "quotation marks will 'label' our value of R which follows."
  28. 3270       print "(Note the ; character.  The ; is used as a separator.)"
  29. 3280 gosub 4190
  30. 3290 gosub 4220
  31. 3300       print "We can do the same kind of thing to the front of our program"
  32. 3310    print "to explain it to a user:"
  33. 3320    print
  34. 3330       print"9 PRINT ";quote$;"What are your values of X, Y, and Z";quote$";"
  35. 3340    print
  36. 3350    print "(The 'INPUT' statement which follows will supply the ?)"
  37. 3360    print "Notice the '9' statement number: this will be executed before"
  38. 3370    print "the 'input' statement in '10'. This demonstrates why it is so"
  39. 3380    print "handy to number statements in increments."
  40. 3390 gosub 4190
  41. 3400 gosub 4220
  42. 3410    print "Our new program now lists as follows:"
  43. 3420       print
  44. 3430       print "9 PRINT ";quote$;"What are your values of X, Y, and Z"quote$";"
  45. 3440    print "10 INPUT X, Y, Z"
  46. 3450    print "20 LET R = SQR (X^2 + Y^2 + Z^2)"
  47. 3460       print "30 PRINT ";quote$;"The radius vector equals";quote$";R"
  48. 3470    print "40 END"
  49. 3480    print
  50. 3490 gosub 4190
  51. 3500 gosub 4220
  52. 3510    print "When 'RUN' is typed, the program does this:"
  53. 3520    print
  54. 3530    print "What are your values of X, Y, and Z"
  55. 3540    input x, y, z
  56. 3550    print "The radius vector equals";sqr(x^2+y^2+z^2)
  57. 3560    print
  58. 3570    print
  59. 3580    print
  60. 3590       print
  61. 3600 gosub 4190
  62. 3610 gosub 4220
  63. 3620       print "Now, if you have a string of values to compute and want to"
  64. 3630    print "automatically repeat a portion of your program, you can to this by"
  65. 3640    print "using the statement:"
  66. 3650    print
  67. 3660    print "35 GOTO 9"
  68. 3670    print
  69. 3680 gosub 4190
  70. 3690 gosub 4220
  71. 3700    print "This will cause the computer to return to the beginning and"
  72. 3710    print "repeat as long as you have values of X, Y, and Z to type in."
  73. 3720       print "(Typing ctrl/c -- holding down the ctrl key and typing the"
  74. 3730       print " C key, then releasing both, will halt the program)"
  75. 3740       print
  76. 3750 gosub 4190
  77. 3760 gosub 4220
  78. 3770    print "   A few final items and I'll turn you loose to try your own hand"
  79. 3780    print "at writing a program. Whenever you start a new program,"
  80. 3790    print "you tell the system by typing 'NEW'. This will clear any old program"
  81. 3800    print "from memory.  The system will automatically number your statements"
  82. 3810    print "for you if you type 'AUTO'.  Line numbers will automatically appear"
  83. 3820    print "after each carriage return, until you type ctrl-c"
  84. 3830 gosub 4190
  85. 3840 gosub 4220
  86. 3850    print "To store a program you have typed in on the disk, type:"
  87. 3860    print
  88. 3870    print "SAVE ";quote$;"FILENAME"quote$;",A"
  89. 3880    print
  90. 3890    print "Where the 'FILENAME' is any name, up to 8 letters and numbers, not already in use."
  91. 3900 gosub 4190
  92. 3910 gosub 4220
  93. 3920    print "You can recall it later by typing 'RUN' and calling it by the"
  94. 3930    print "name you assigned. (If you forget the names of your files,"
  95. 3940    print "type 'FILES' and the system will list the programs on the disk you are using.)"
  96. 3950 gosub 4190
  97. 3960 gosub 4220
  98. 3970    print "     If you want to remove a program from your disk,"
  99. 3980    print "type the command 'KILL' followed by the name of the program you want deleted."
  100. 3990    print "the computer will erase the file and return with 'Ok' and be again available for use."
  101. 4000    print
  102. 4010 gosub 4190
  103. 4020 gosub 4220
  104. 4030    print "When you want to return to the operating system, i.e. get out of MBASIC."
  105. 4040    print "type ctrl-C until you get the 'Ok', then type 'SYSTEM' to return to CP/M."
  106. 4050       print
  107. 4060 gosub 4190
  108. 4070 gosub 4220
  109. 4080       print "    You have now completed another lesson with your computer"
  110. 4090    print "Tutor and are ready to try a few things on your own."
  111. 4100    print "The best way to become comfortable with the system is to try"
  112. 4110    print "it on some of your own problems."
  113. 4120       print
  114. 4130    print "When you are ready for the next lesson, run 'TUTR.03'.
  115. 4140    print 
  116. 4150    print "Hit any key to return to the main menu -->";
  117. 4160    gosub 40800
  118. 4170    run "MENU"
  119. 4180    end
  120. 4190 print:print "Hit any key to continue: ";
  121. 4200 gosub 40800
  122. 4210 return
  123. 4220 print cls$;fnposcur$(10,1)
  124. 4230 return
  125.