home *** CD-ROM | disk | FTP | other *** search
/ Generous Efforts of Many / gemcd.zip / GEM.CD.A.po / FEATURES:BEAGLE / BEAGLEBASIC.DOC / T.BEAGLE.BASIC
Text File  |  1990-02-15  |  33KB  |  861 lines

  1. BEAGLE BASIC INSTRUCTIONS
  2. -------------------------
  3.  
  4. What is BASIC?
  5. --------------
  6. BASIC is your Apple's native language.  Apple IIe's and
  7. II+'s are equipped with Applesoft Basic, while ancient (pre-
  8. 1980) Apple II's came with Integer Basic hardware.
  9. Applesoft, by far the most common "resident" language,
  10. determines exactly which words (or "commands") your Apple
  11. understands.  It also determines what actions your Apple
  12. will take when each command or combination of commands  is
  13. typed.  Since Applesoft is stored in ROM (Read-Only Memory),
  14. it is normally unchangeable.  The abilities and vocabulary
  15. given to your Apple by Applesoft are set in concrete.
  16. Permanent.  Period.
  17.  
  18. What is BEAGLE BASIC?
  19. ---------------------
  20. Beagle Basic is a set of programs that let you enhance
  21. Applesoft and use new commands and features in your
  22. programs.  It also lets you rename standard commands and
  23. error messages, for whatever reason you might have.  Beagle
  24. Basic gets around Applesoft's "permanency" by moving it from
  25. ROM into RAM (Random-Access Memory) or changeable memory.
  26.  
  27. A NEW BASIC IN AUXILIARY MEMORY
  28. -------------------------------
  29. When you boot a System Master disk on an Apple IIe (or an
  30. Apple II or II+ with a RAM card), the Hello program loads
  31. the "other" BASIC (Applesoft or Integer, whichever one is
  32. not built into your Apple) into memory "above Apple's normal
  33. 48k.  On an Apple IIe or II+, you would then have Applesoft
  34. in ROM and Integer in RAM.  You can switch between these two
  35. languages with DOS's FP and INT commands.
  36.  
  37. Well, don't tell anyone where you read this, but Integer
  38. Basic is a worthless dinosaur!  Nobody writes programs in
  39. Integer anymore.  Yeah, sure, it's faster than Applesoft and
  40. it has a MOD function, but look at all it's missing. (See
  41. Appendix M of the Applesoft II Reference Manual or Appendix
  42. L of the equivalent IIe Manual.)
  43.  
  44. So, let's not load Integer as our second language in RAM.
  45. Instead, let's put an enhanced version of Applesoft, called
  46. "NEWBASIC", there.  Newbasic is loaded into memory by the
  47. "NEWBASIC LOADER" program, select the Applesoft enhancements
  48. that you want and save them on disk as "Newbasic".  Just
  49. like you can use cousin DOS Boss to change DOS, you can
  50. alter Apple's Applesoft vocabulary, and modify the way the
  51. Apple behaves when commands are typed.  Beagle Basic gives
  52. you options of twenty brand new commands and two modified
  53. commands.
  54.  
  55. If you program in Applesoft, you're going to have some fun
  56. with Beagle Basic.
  57.  
  58. How to Use Beagle Basic
  59. -----------------------
  60. Your original Beagle Basic disk is a normal DOS 3.3 disk.
  61. You can boot it, catalog it, save to it...and run it- Make a
  62. back-up copy please.
  63.  
  64. Beagle Basic requires your Apple to have at least 64k of
  65. memory.  If you have an Apple IIe, you are set.  If you have
  66. an Apple II or II+ (normally 48k), it must be equipped with
  67. extra memory in the form of a RAM card (or "language"
  68. card").
  69.  
  70. ENHANCING APPLESOFT
  71. -------------------
  72. Before you can program with Beagle Basic's new features, you
  73. must first enhance Applesoft, then save the enhanced version
  74. on disk under the name "NEWBASIC".  Here's what you do:
  75.  
  76.      1.  Boot the Beagle Basic disk.
  77.      2.  Run the program called "CREATE NEWBASIC",
  78.      3.  Use CREATE NEWBASIC to customize Applesoft by
  79. changing its vocabulary and adding new commands.
  80.      4.  Save your enhanced version of Applesoft on disk
  81. under the name "NEWBASIC".
  82.  
  83. USING NEWBASIC
  84. --------------
  85. To use your version of Newbasic, you must run the program
  86. called "NEWBASIC LOADER", which will load NEWBASIC into your
  87. Apple's auxiliary memory (our way of saying "RAM card" or
  88. language card" or "bank-switched memory").
  89.  
  90. ENHANCING APPLESOFT WITH BEAGLE BASIC
  91.  
  92. CREATE NEWBASIC
  93. ---------------
  94. CREATE NEWBASIC is the program on the Beagle Basic disk that
  95. lets you customize Applesoft and/or save it onto disk under
  96. the name "NEWBASIC".  Boot the Beagle Basic disk and select
  97. (C), the CREATE NEWBASIC option, from the menu, or (Q),
  98. Quit, and type:
  99.  
  100.      RUN CREATE NEWBASIC (return)
  101.  
  102. Create Newbasic's first job is to load some form of
  103. Applesoft (modified or unmodified) into your Apple's
  104. auxiliary memory.  Here's what happens when Create Newbasic
  105. runs:
  106.  
  107. A.  Create Newbasic will look for some form of Applesoft
  108. (normal or modified) in your Apple's auxiliary memory.  If
  109. found, step D is next.
  110.  
  111. B.  Create Newbasic will look on the disk for a modified
  112. Applesoft file called "NEWBASIC" to be loaded into auxiliary
  113. memory.  Note:  This file was not on your original disk (see
  114. page 3).  If found, step D is next.
  115.  
  116. C.  Create Newbasic will give up and transfer Applesoft from
  117. its normal ROM location into auxiliary memory.
  118.  
  119. D.  Create Newbasic will now display its Main Menu.
  120.  
  121. THE MAIN MENU
  122. -------------
  123. Create Newbasic's Main Menu offers you five Applesoft change
  124. options on the screen, plus Save and Quit.  Details for each
  125. option are printed on the page shown:
  126.  
  127.      (C) COMMAND EDITOR............page 13
  128.      (E) ERROR MESSAGE EDITOR......page 15
  129.      
  130.      (L) LIST FORMATTER............page  5
  131.      (B) ADD NEW BASIC COMMANDS....page  6
  132.      (O) OTHER FEATURES............page 11
  133.  
  134.      (S) SAVE NEWBASIC.............page 11
  135.      (Q) QUIT......................page 11
  136.  
  137. You can usually return to this Menu from Create Newbasic's
  138. various modes by pressing the ESC key or 1 (see keychart
  139. notes on page 12).
  140.  
  141. COMMAND EDITOR
  142. --------------
  143. Every Applesoft command may be renamed to almost any word
  144. you want.  See "Changing Commands and Error Messages" on
  145. page 12 for instructions.
  146.  
  147. ERROR MESSAGE EDITOR
  148. --------------------
  149. Applesoft error messages may be reworded too, for clarity or
  150. just for fun.  See "Changing Commands and Error Messages" on
  151. page 12.
  152.  
  153. LIST FORMATTER
  154. --------------
  155. Selecting option L from the Main Menu presents you with
  156. three choices for changing Applesoft's rigid list format.
  157. Typing the letter (A,B or C) turns the corresponding feature
  158. On or Off ("YES" or "NO" printed in inverse) in your Apple's
  159. memory.
  160.  
  161. (A) INVERT REM STATEMENTS
  162. -------------------------
  163. This is the most useful list-format option.  Turning this
  164. feature On ("YES") causes your program remark statements to
  165. be displayed in inverse type when listed.  The word "Rem"
  166. will be inverse too (try renaming it to "]" to tone it down
  167. a bit).
  168.  
  169. (B)  CHANGE LIST WIDTH
  170. ----------------------
  171. The width of your listings can be altered to be from 1 to 40
  172. characters wide.  Normal is 33.  Select option B and enter
  173. the width you want to try.  If you change the list-width to
  174. 40, extra spaces won't be added in quote statements, and you
  175. won't have to POKE 33,33 before ESCaping editing.
  176.  
  177. (C) LIST INDENTATION
  178. --------------------
  179. The list indentation under each program line number may be
  180. changed from the standard 5 to any value from 0 to 39.
  181. Select C and enter the number you want to try.  The less the
  182. indentation, the more code you can squeeze on the screen.
  183.  
  184. ADD NEW BASIC COMMANDS
  185. ----------------------
  186. Newbasic gives your Apple more power by offering twenty
  187. all-new commands and two slightly-new ones, each one
  188. completely optional.  Since the machine-language
  189. instructions for every command must occupy a certain amount
  190. of memory space (the amount depends on the complexity of the
  191. command), memory is "stolen" by writing over the space used
  192. by the least-used Applesoft commands.  I'll bet my $64.95
  193. joystick that you never use the cassettes at all?  Applesoft
  194. has several cassette commands that waste space.  Let's put
  195. all that space to better use.
  196.  
  197. Here is a list of optional Newbasic commands and the old
  198. Applesoft ones that they replace.  Type the letter to the
  199. left of the command to turn it On or Off ("YES" or "NO" in
  200. inverse).  And remember, these commands may be renamed any
  201. time you want.  See page 12.
  202.  
  203. (A) ELSE (replaces cassette SHLOAD command)
  204. -------------------------------------------
  205. We've saved the best for first.  ELSE is a common command in
  206. many programming languages, but missing from Applesoft until
  207. now.  It completes the IF-THEN statement but remains
  208. optional.  This is how you use ELSE:
  209.  
  210.      10 PRINT "TYPE Y OR N";:GET A$
  211.      20 IF A$ = "Y" THEN PRINT "YES": ELSE PRINT "NO"
  212.  
  213. ELSE Makes Applesoft more "English-like" and friendly.  It
  214. omits the need for another program line after an IF
  215. statement.
  216.  
  217. Notice how ELSE's may be nested just like for-next loops:
  218.  
  219.      10 PRINT "TYPE Y OR N: ";: GET A$: PRINT
  220.      20 PRINT "TYPE 1 OR 2: ";  GET B$: PRINT
  221.      30 IF A$ = CHR$ (3) OR B$ = CHR$ 9#) THEN END
  222.      40 IF A$ = "Y" THEN PRINT "YES":
  223.         IF B$ = "1" THEN PRINT "ONE":
  224.         ELSE PRINT "TWO":
  225.         ELSE PRINT "NO":
  226.         IF B$ = "1" THEN PRINT "ONE":
  227.         ELSE PRINT "TWO"
  228.      50 GOTO 10
  229.  
  230. The next two commands replace the cassette LOAD and SAVE
  231. commands, not DOS's LOAD and SAVE.  The commands "LOAD
  232. filename" and "SAVE filename" will still work fine.
  233.  
  234. (B) SWAP (replaces cassette LOAD command)
  235. -----------------------------------------
  236. Here's the normal way to swap variable values X & Y:
  237.  
  238.      TEMP=X: X=Y: Y=TEMP
  239.  
  240. Notice how a third variable was necessary (and an extra
  241. split-second of execution time).  SWAP makes swapping
  242. (common in many sorting routines) much simpler.
  243.  
  244. 10 A = 1.11:B = 2.22: PRINT A,B
  245. 20  SWAP A,B: PRINT A,B
  246. 30  SWAP A,B: PRINT A,B
  247.  
  248. Notice that you can SWAP not only variables, but integers,
  249. strings, array values, and combinations of the above:
  250.  
  251. 10 A% = 1.B% = 2:PRINT A%,B%
  252. 20  SWAP A%,B%: PRINT A%,B%
  253. 30  SWAP A%,B%: PRINT A%,B%
  254.  
  255. 10 A$ = "A": B$ = "B": PRINT A$,B$
  256. 20  SWAP A$,B$: PRINT A$,B$
  257. 30  SWAP A$,B$: PRINT A$,B$
  258.  
  259. 10 A(1) = 1:B(1) = 2: PRINT A(1), B(1)
  260. 20  SWAP A(1), B(1): PRINT A(1),B(1)
  261. 30  SWAP A(1), B: PRINT A(1), B(1)
  262.  
  263. 10 A(1) = 1:B = 2: PRINT A(1),B
  264. 20  SWAP A(1),B: PRINT A(1),B
  265. 30  SWAP A(1),B: PRINT A(1),B
  266.  
  267. (C) TONE (replaces cassette SAVE command)
  268. -----------------------------------------
  269. Use TONE to play music without having to use any clunky
  270. Pokes or Calls.  To play a note, use this command:
  271.  
  272.      TONE P, L
  273.  
  274. The note's pitch P may be any value from 0 to 255.  The
  275. length L may range form 0 to 65535.  Some complete song
  276. recipes are printed in the tips section of this book.
  277.  
  278. (D)  HSCRN (replaces cassette RECALL command)
  279. ---------------------------------------------
  280. HSCRN tells you the "color" of any hi-res coordinate.  If
  281. performs similarly to lo-res's SCRN (function. Just type
  282. "HSCRN" followed by the hi-res coordinates you want to
  283. check.  Then "PRINT PEEK(234)".  0(Zero) means the point is
  284. black (off).  1. means the point is white (on).  For
  285. example, to check location 275 (X), 10(Y), do this:
  286.  
  287.      HSCRN 275, 10: PRINT PEEK (234)
  288.  
  289. Here is a program that shoots a white "bullet" at a white
  290. line.  Give it a try:
  291.  
  292. 10  HOME : TEXT : HGR : PRINT "POW!!!": PRINT
  293. 15  X = 17:Y =  INT  ( RND  (1)  *  99) + 5
  294. 20  HCOLOR =  3:  HPLOT 0,Y to 279,Y
  295. 30  FOR Y = 159 TO 1 STEP  -  1
  296. 40  HSCRN X,Y:HIT = PEEK (234)
  297. 50  IF HIT THEN PRINT "A HIT!": HPLOT 12,Y - 3 TO
  298.      18,Y + 3: HPLOT 12,Y + 3 TO 18,Y - 3: END
  299. 60  HCOLOR= 0: HPLOT X,Y + 1
  300. 70  HCOLOr= 3: HPLOT X,Y:  NEXT
  301.  
  302. Since Apple's hi-res colors are made up of black and white
  303. dots (the program below proves it by reading each dot in a
  304. green line), you won't be able to determine any colors with
  305. HSCRN.
  306.  
  307. 10  HOME : TEXT : HGR
  308. 20  HCOLOR=  1:  HPLOT 0,99 TO 279,99
  309. 30  FOR X = 0 TO 279:  HSCRN X,99
  310. 40  PRINT  PEEK  (234);:  NEXT
  311.  
  312. (E)  SCRLDN (replaces cassette STORE command)
  313. ---------------------------------------------
  314. Each SCRLDN command scrolls the text screen down one line,
  315. not a common occurrence these days.
  316.  
  317. 10  TEXT : HOME : NORMAL
  318. 20  PRINT "STAND BY. I'M POLISHING THE TV SCREEN..."
  319. 30  FOR I = 1 TO 23 : SCRLDN : NEXT : VTAB 24
  320. 40  FOR I = 1 TO 23 : PRINT : NEXT : GOTO 30
  321.  
  322. NOTE:  Selecting "YES" to add a new function automatically
  323. replaces some old command in the Command Editor.  After
  324. that, you may rename the new command if you want.  View
  325. changed commands with options C (from the Main Menu) and 6
  326. or 7 (see keychart).
  327.  
  328. The following two commands replace BASIC's IN# and PR#
  329. commands, not to be confused with DOS's IN# and PR#.  It is
  330. always best to use the DOS versions of these commands from
  331. within programs.  For example, PRINT CHR$(4)"PR#1"
  332.  
  333. (F) TXT2 (replaces Basic IN# command)
  334. -------------------------------------
  335. TXT2 reveals page 2 of text and lets you do everything there
  336. that you can do on page 1.
  337.  
  338. Since Applesoft programs normally use the same memory space
  339. that text page 2 uses, you must make your programs re-locate
  340. (actually re-RUN) themselves.  Do that by adding the first
  341. line shown in this example.  Warning:  SAVE before you RUN!
  342.  
  343. 10  IF PEEK (104) < 12 THEN POKE 104,12: POKE 3 072,0: PRINT
  344. CHR$ (4) "RUN TEXT TEST": REM THIS PROGRAM
  345. 20  A$ = "PAGE ONE.": TEXT : HOME : GOSUB 90
  346. 30  A$ = "PAGE TWO.": TXT2 : HOME : GOSUB 90
  347. 40  VTAB 23:  HTAB 22:  GET A$: PRINT A$
  348. 45  IF A$ = "1" THEN TEXT  :  GOTO 40
  349. 50  IF A$ = "2" THEN TXT2  :  GOTO 40
  350. 60  PRINT  :  PRINT "HUH?":  END
  351. 90  FOR I = 1 TO 93: PRINT A$;: NEXT  :  VTAB22:  PRINT  :
  352. PRINT " SELECT PAGE (1 OR 2):": RETURN
  353.  
  354. (G)  G2 (replaces Basic PR# command)
  355. ------------------------------------
  356. G2 works like GR but lets you access page 2 of lo-res.  The
  357. same rules apply for lo-res page 2 as for the text page 2
  358. (see above).
  359.  
  360. 10  IF PEEK 9104)  < 12 THEN  POKE 104,12: POKE 3 072,0:
  361. PRINT  CHR$ (4) "RUN LO-RES TEST": REM THIS PROGRAM
  362. 20  TXT2  :  HOME  :  G2  :X = 8:Y = 9
  363. 30  FOR H = X TO 30 STEP 4: IF H <  > 24 THEN  FOR V = Y TO
  364. 13: COLOR= 5: HLIN H,H + 2 AT V: NEXT  :  COLOR= ): PLOT H =
  365. 1,10: PLOT H = 1,12
  366. 40  NEXT H: FOR I = 1 TO 10: READ H,V: PLOT X + H,Y + V:
  367. NEXT  :  DATA 1,4,2,3,2,4,5,4,9,2,10,1,14,1,14,3,20,1,22,3
  368.  
  369. (H) CLRKEY (replaces Applesoft WAIT command)
  370. --------------------------------------------
  371. Use CLRKEY instead of POKE -16368,0 to clear the keyboard
  372. buffer.  Like this:
  373.  
  374. 10  TEXT  :  HOME  :  PRINT ">";
  375. 20 KEY = PEEK  ( - 16384) : IF KEY < 128 THEN 20
  376. 30  CLRKEY : REM TEST WITHOUT THIS COMMAND.
  377. 40  PRINT CHR$ (KEY - 128);: GOTO 20
  378.  
  379. Since options I, J, and K (below) replace the same set of
  380. lo-res commands, only ONE of these options may be used at a
  381. time.  (For example, if option K displays "---/NO" instead
  382. of "YES/NO", you need to turn OFF option I or J before you
  383. can use K.)
  384.  
  385. (I)  TEXT & BELL COMMANDS
  386. -------------------------
  387. (replace PLOT, HLIN, VLIN and COLOR=)
  388.  
  389. CLLN (for "CLear LiNe") replaces CALL -868 or ESC-E.  Clears
  390. a text line from the cursor position to the bottom of the
  391. text window.
  392.  
  393. CLDN (for "CLear DowN") replaces CALL -985 or ESC-F.  Clears
  394. the text from the cursor position to the bottom of the text
  395. window.
  396.  
  397. SCRLUP replaces CALL -912.  Scrolls text up a line.
  398.  
  399. BELL replaces CALL -198 or PRINT CHR$(7).  Rings Apple's
  400. control-G bell.  You can even customize the bell itself; see
  401. next page.
  402.  
  403. (J) HI-RES COMMANDS
  404. -------------------
  405. (replace PLOT, HLIN, VLIN and COLOR=)
  406.  
  407. MODE1 replaces POKE -16304,0 (graphics switch).
  408. MODE2 replaces POKE -16303,0 (text switch).
  409.  
  410. MIX0 replaces POKE -16302,0 (full- screen graphics).
  411. MIX1 replaces POKE -16301,0 (split graphics & text).
  412.  
  413. PAGE1 replaces POKE -16300,0 (page 1 switch).
  414. PAGE2 replaces POKE -16299,0 (page 2 switch).
  415.  
  416. RESL1 replaces POKE -16298,0 (lo-res switch).
  417. RESL2 replaces POKE -16297,0 (hi-res switch).
  418.      
  419. (K) CURSOR COMMANDS
  420. -------------------
  421. (replace PLOT, HLIN, VLIN and COLOR=)
  422.  
  423. CRSU moves the cursor up one line.
  424. CRSD moves the cursor down one line.
  425. CRSL moves the cursor left one character.
  426. CRSR moves the cursor right one character.
  427.  
  428. 10   TEXT : HOME : HTAB 6: SPEED= 255
  429. 20   PRINT "<USELESS DATA. PLEASE FILE>"
  430. 30 VTAB 11: FOR I = TO 40: PRINT "-";: NEXT :SPEED= 150
  431. 40 N =  INT (RND (1) * 3): IF N THEN S = PEEK (49200)
  432. 50  IF N = 0 THEN  CRSU  : REM CURSOR UP
  433. 60  IF N = 1 THEN  CRSD : REM CURSOR DOWN
  434. 70  PRINT "+";: IF NOT PEEK (36) THEN 10: ELSE 40
  435.  
  436.  
  437. Other Features
  438. --------------
  439. Two of the features below aren't really Applesoft changes;
  440. they are monitor changes.  But Newbasic doesn't care; add
  441. them to your repertoire.
  442.  
  443.  
  444. (A)  ADD ESCAPE-CURSOR
  445. ----------------------
  446. (Won't work properly with GPLE in memory)
  447. The escape cursor indicates escape mode (moving the cursor
  448. for editing with ESC, then I, J, K, and M) by changing the
  449. cursor to a flashing plus sign.  Any non-cursor key returns
  450. the normal cursor unharmed.
  451.  
  452. (B) MODIFY BELL
  453. ---------------
  454. Newbasic lets you change Apple's bell value to make
  455. control-G  sound lower with a longer duration, or higher
  456. with a shorter duration.  Any number, 1-99, may be entered,
  457. but the most interesting values are between 10 and 30.
  458.  
  459. (C) MODIFY GOTO/GOSUB SYNTAX
  460. ----------------------------
  461. Normally the GOTO and GOSUB commands must be followed by a
  462. line NUMBER (as in GOTO 12345).  Selecting YES to this
  463. option lets GOTO and GOSUB precede a variable (as in GOTO
  464. JAIL) or an expression (as in GOSUB X+10).
  465.  
  466. 10 LOOK = 100:BOOGIE = 200:MARINE = 300:HALT = 66
  467. 20  GOSUB LOOK: GOSUB BOOGIE: GOSUB MARINE
  468. 30  FOR I = 1 TO 3: GOSUB I * 100: NEXT : GOTO HALT
  469. 40  PRINT "DON'T PRINT THIS."
  470. 66  STOP : REM PRINT "BREAK IN 66"
  471. 100  PRINT "THIS IS LINE 100.": RETURN
  472. 200  PRINT "THIS IS LINE 200.": RETURN
  473. 300  PRINT "THIS IS LINE 300.": RETURN
  474.  
  475. Save Newbasic
  476. -------------
  477. Once you have configured Applesoft the way you want it, you
  478. can save the set-up on disk under the name "NEWBASIC".
  479. Select S from the Main Menu. (If you already have a file
  480. named "Newbasic" that you want to keep, exit the program
  481. now, RENAME it, type "RUN" and select SAVE for the Main
  482. Menu.)
  483.  
  484. Quit
  485. ----
  486. You may exit Create Newbasic by typing Q from the Main Menu.
  487. If you haven't saved the current Basic, you will be notified
  488. after quitting.  To save after quitting, type "RUN" and then
  489. select option S.
  490.  
  491. Changing Commands and Error Messages
  492. ------------------------------------
  493. One of Beagle Basic's most interesting features is the
  494. ability to change Applesoft's usually rigid commands and
  495. error messages.  Run the CREATE NEWBASIC program and select
  496. C or E from the Main Menu (see page 4).
  497.  
  498. 1: MAIN MENU
  499. ------------
  500. Return to the Main Menu (see page 4) from Create Newbasic's
  501. various modes by typing 1 as noted on the keychart or by
  502. pressing ESC.
  503.  
  504. 2: EDIT (Commands or Error Messages)
  505. ------------------------------------
  506. While in the Command or Error Message Editor, move the
  507. cursor to the command or message you want to edit (change),
  508. select keychart option 2 and type a new word or words and
  509. press Return.  The new command or error message will
  510. immediately be in effect.  To confirm this, you may return
  511. to the Main Menu (1), quit (Q) and give it a try.  Usually
  512. you can run return to Create Newbasic by typing "RUN".  If
  513. you somehow zapped it with your test, you may have to type
  514. "RUN CREATE NEWBASIC."
  515.  
  516. Changing Commands
  517. -----------------
  518. To change any Applesoft command, or to see the commands
  519. currently in effect, type C from the Main Menu.  You will
  520. enter the COMMAND EDITOR and the screen will be filled with
  521. the current Applesoft commands or "keywords" - that is,
  522. every word that you can type that your Apple will understand
  523. (except disk or DOS commands like CATALOG, UNLOCK, INIT, and
  524. so on).
  525.  
  526. MOVE MODE:  In the upper-left corner of the screen you will
  527. see the word "MOVE".  This means you are in the "Cursor-Move
  528. Mode".  The cursor is the inverse bar over one of the
  529. commands.  To move this cursor, use the Left & Right Arrow
  530. Keys and the Up & Down Arrow Keys (or use A & Z for up &
  531. down if you don't have an Apple IIe).  Move the cursor
  532. around now.  I'll wait here...
  533.  
  534. FREE CHARACTERS:  The number after the word "FREE" in the
  535. upper-right corner of the screen indicates the number of
  536. spare characters remaining in the command table.  For
  537. example, if you shorten the INVERSE command to "INV", you
  538. increase the number of free bytes by 4.  If you change LET
  539. to "ASSIGN", you reduce the number of free bytes by 3.  You
  540. cannot lengthen a command if you have no spare characters;
  541. you must shorten another command first.  No command longer
  542. than the cursor, seven characters, is allowed.
  543.  
  544. EXPERIMENT:  Change the HOME command to "CLS" (many
  545. languages use CLS to mean "Clear the Screen").
  546.  
  547.      1.  After running Create Newbasic, select the Command
  548. Change Mode (C) from the Main Menu.  You will see
  549. the current 107 commands on the screen.
  550.      2.  Use the Arrow Keys or the FIND option (page 16) to
  551. move the cursor the HOME (the 5th command down in
  552. the 4th column).
  553.      3.  Type 2 to edit the word.  The word "EDITING" will
  554. appear in the upper-left corner of the screen, and
  555. the bar-cursor will change to a blinking square.
  556.      4.  Type "CLS" as the new command, and press Return.
  557.  
  558. That's it!  You have changed the HOME command to "CLS".  You
  559. are now back in the Move Mode and the free characters
  560. (upper-right of the screen) have been increased by one
  561. because "CLS" is one character shorter than "HOME".  Later
  562. on, typing "CLS" will clear the screen.  If you type "HOME",
  563. your Apple will grumble "?SYNTAX ERROR" (Computerese for
  564. "Never heard of it!").
  565.  
  566. To shorten INVERSE to "INV", move the cursor to INVERSE (7th
  567. word in the 1st column), and press 2 to edit.  Use the Right
  568. Arrow key to trace over the I, N, and V, and hit Return.
  569. Easy, right?  And you have gained four more spare
  570. characters.  Later on, typing "INV" will create inverse type
  571. as expected.  Typing "INVERSE", however, will print "?SYNTAX
  572. ERROR" in inverse, because your Apple tokenized "INVERSE"
  573. into two words; "INV" (which it recognized and executed) and
  574. "ERSE".  "Erse" means nothing to most Apples, so ?SYNTAX
  575. ERROR.
  576.  
  577. COMMAND RULES: New commands may contain no spaces, lower
  578. case or control characters.  Other than that, all characters
  579. are legal.  The position of the Caps Lock Key on the IIe has
  580. no bearing on input; all keystrokes are interpreted as upper
  581. case.  Pressing rEturn will accept whatever has been entered
  582. up to the cursor.  If the cursor is on the leftmost
  583. character in a command when you press Return, no change will
  584. occur.
  585.  
  586. COMMANDS WITHIN OTHER COMMAND NAMES can be a problem if you
  587. don't watch out.  For example, notice how HGR2 comes before
  588. HGR in the command table.  If it didn't, and you typed
  589. "HGR2", Applesoft would scan the table, find "HGR" first,
  590. quit scanning and "parse" HGR into two words, "HGR" and "2".
  591. If you want to create a command name (like "GONOW") that
  592. starts with the same characters as another command (say
  593. "GO"), always put the longer command first in the command
  594. table.  Commands that end with the same characters (like
  595. PLOT and HPLOT) are no problem.
  596.  
  597. NOTE:  You can test new commands and functions by quitting
  598. Create Newbasic (Main Menu option Q).  Re-enter the program
  599. by typing "RUN" or "RUN CREATE NEWBASIC".  Be sure to SAVE
  600. (Main Menu option S) and version of Newbasic that you want
  601. to keep.
  602.  
  603. Changing Error Messages
  604. -----------------------
  605. Selecting option E from the Main Menu will enter the ERROR
  606. MESSAGE EDITOR which displays and lets you change Applesoft
  607. error messages, the words your Apple prints when an error in
  608. encountered.  Operation of the Error Message Editor is
  609. similar to that of the Command Editor.  Differences are
  610. pointed out below:
  611.  
  612. EXPERIMENT:  Change the message ?SYNTAX ERROR to "?TYPING
  613. GOOF!"-
  614.  
  615. 1.  Select the Error Message Change Mode, E, from the Main
  616. Menu.  you will see the current 17 Applesoft error messages
  617. on the screen, as well as the words "ERROR", "IN" and
  618. "BREAK".
  619.  
  620. 2.  Use the Arrow Keys to move the cursor to SYNTAX (the 2nd
  621. error message down).  Notice that word "ERROR" appears near
  622. the bottom of the screen and must be changed separately.
  623. (The "?" that precedes Applesoft error messages may be
  624. changed too.  See the tip on page 32.)
  625.  
  626. 3.  Type 2 to edit the message.  The word "EDITING" will
  627. appear in the upper-left corner of the screen, and the
  628. bar-cursor will change to a blinking square.
  629.  
  630. 4.  Type "TYPING" and hit Return.
  631.  
  632. 5.  Move the cursor to ERROR, third word form the bottom,
  633. type 2 to edit, type "GOOF!", and hit Return.
  634.  
  635. You have officially changed the ?Syntax Error message to
  636. "?Typing Goof!"  Later on, typing an illegal statement (my
  637. favorite is "Sdjaflkfd") will produce a well-dressed ?Typing
  638. Goof! message and a beep.  The word "Goof!" will now follow
  639. every Applesoft error message.  Since "?Illegal Quantity
  640. Goof!" and "?Out of Data Goof!" don't make a lot of sense,
  641. you may want to not change the word "Error".
  642.  
  643. ERROR MESSAGE RULES:  The Error Message Editor is not
  644. concerned with spare characters, because there are no spare
  645. characters; each error message is already at its maximum
  646. length (the length of the cursor).  Other rules are the same
  647. as for commands, except spaces are legal in error messages.
  648.  
  649. "IN" and "BREAK" appear in messages like BREAK IN 1234, and
  650. may be changes.
  651.  
  652. 3: FIND (Commands only)
  653. -----------------------
  654. From the Command Editor, typing a 3 will print the word
  655. "FIND:" on the screen.  Enter any command's name and the
  656. cursor will move to that command.  If the search is
  657. unsuccessful, the cursor will stay where it was.  It's not
  658. necessary to type an entire command.  For example, if you
  659. type "X" and press Return, the cursor will position itself
  660. at the first command that starts with an "X".
  661.  
  662. 4: SORT (Commands only)
  663. -----------------------
  664. Pressing 4 will temporarily sort (alphabetize) the commands
  665. on the screen.  If you want to send this list to your
  666. printer, press 0 (see next page).  Pressing any key (like
  667. the Space Bar) returns the command order to normal, the
  668. order (left to right) in which they are stored in memory.
  669.  
  670. Sorting lets you check to make sure you have not given the
  671. same name to two or more different commands.  Doing so would
  672. disable one of those commands.
  673.  
  674. Giving a BASIC command a DOS command name could possibly
  675. have the same effect.  To play it safe, never give a BASIC
  676. command a word that DOS uses- APPEND, BLOAD, BRUN, BSAVE,
  677. CATALOG, CHAIN, CLOSE, DELETE, EXEC, FP, INIT, INT, IN#,
  678. LOAD, LOCK, MAXFILES, MON, NOMON, OPEN, POSITION, PR#, READ
  679. RENAME, RUN, SAVE, UNLOCK, VERIFY, or WRITE.
  680.  
  681. 5: TOKEN NUMBER (Commands only)
  682. -------------------------------
  683. Pressing 5 while in the Move Mode will print the word
  684. "TOKEN" at the upper-left of the screen, erase the command
  685. at the cursor and replace it with the hex and decimal values
  686. for that command's "token".  Tokens are the numbers
  687. Applesoft assigns each of its keywords.  Pressing any key
  688. (like the Space Bar or Return) will return you to Move Mode.
  689.  
  690. 6: HIGHLIGHT CHANGES
  691. --------------------
  692. (Commands or Error Messages)
  693. Pressing 6 will show you the changes that you have made.
  694. All non-standard commands or error messages (if any) will be
  695. highlighted in inverse.  The word "CHANGED" will appear in
  696. the upper-left corner of the screen.  Press any key to
  697. return the Move Mode.
  698.  
  699. 7: HIGHLIGHT STANDARD
  700. ---------------------
  701. (Commands or Error Messages)
  702. Pressing 7 will show you the standard version of each
  703. command or error message (if any) that has been changed.
  704. The word " STANDARD" will appear in the upper-left of the
  705. screen, and the original commands or error messages will
  706. appear in inverse.  Press any key to return to Move Mode.
  707.  
  708. 8: NORMALIZE (Commands and Error Messages)
  709. ------------------------------------------
  710. Typing 8 followed by a Yes (when asked for approval) will
  711. normalize the names of all commands OR error messages
  712. (depending which is on the screen), setting them to their
  713. original state.  If, for instance, you wanted to change new
  714. commands CLS and INV back to standard "HOME" and "INVERSE"
  715. you could use this function.  BEWARE that all other command
  716. or error message changes will also be undone.  NOTE that
  717. standardizing all command names DOES NOT standardize (or
  718. change in the least) the function of any command.  For
  719. example, if you have turned on the ELSE function (page 6),
  720. the command name ELSE will be standardizing to "SHLOAD" but
  721. the function of the command SHLOAD when executed in a
  722. program will still be that of ELSE.  Confusing?  Yes.  Until
  723. you think about it for a week or so...
  724.  
  725. The last two keychart commands involve your printer.  If you
  726. don't use a printer, don't use keychart options 9 and Zero.
  727. If your printer is connected to other than Slot 1, change
  728. the SLOT variable in Line 3 of the CREATE NEWBASIC program.
  729.  
  730. 9: PRINT OLD/NEW
  731. ----------------
  732. (Commands or Error Messages)
  733. Selecting 9 after entering the command Editor or Error
  734. Message Editor will send a listing of all standard and
  735. revised Applesoft commands or error messages to your
  736. printer.  Hex and decimal token numbers are printed adjacent
  737. to commands.  You must be in the Command Editor or Error
  738. Message Editor to use this function.
  739.  
  740. 0: PRINT SCREEN
  741. ---------------
  742. Selecting 0 (zero) will dump the current text screen to your
  743. printer.  The most common use for this feature is printing
  744. an alphabetized list of commands (keychart option 40.
  745. although it may be used anytime.
  746.  
  747. Beagle Basic and the Token System
  748. ---------------------------------
  749. Applesoft has a 107-word "command table" stored in memory
  750. that contains "keywords" (words like PRINT, HOME, FOR,
  751. GOSUB, and so on) that are used by Applesoft programs.  For
  752. efficiency, every keyword is represented by a one-byte
  753. "token" or number.  For example, instead of storing the
  754. command "PRINT" as five characters or bytes (P, R, I, N and
  755. T), it is stored as one byte- the value 186 (hex $BA).
  756.  
  757.      When you type in a command like-
  758.      HOME: PRINT X; "ABC"
  759.  
  760. Applesoft converts all of the keywords into tokens by
  761. looking at its command table.  Words that aren't recognized
  762. and characters between quote marks are represented by the
  763. ASCII value of each character.  Like this:
  764.  
  765.      HOME is tokenizes as 151 ($97)
  766.      ":" Becomes 58 ($3A, the ASCII value of ":")
  767.      PRINT is tokenized as 186 ($BA)
  768.      X becomes 88 ($58, the ASCII value of X)
  769.      ; becomes 59 ($3B, the ASCII value of ;)
  770.      " becomes 34 ($22, the ASCII value of ")
  771.      A becomes 65 ($41, the ASCII value of A)
  772.      B becomes 66 ($42, the ASCII value of B)
  773.      C becomes 67 ($43, the ASCII value of C)
  774.      " becomes 34 ($22, the ASCII value of ")
  775.  
  776. So a program is simply a series of tokens and ASCII values.
  777. What words are displayed when you list depends on the words
  778. in the current command table.
  779.  
  780. Beagle Basic lets you change the contents of the command
  781. table by renaming keywords and storing the new words in
  782. memory.  Let's say you change the keyword word "HOME" to
  783. "CLS".  Now when you type "HOME", Applesoft won't recognize
  784. it, and CLS will clear the screen.  BUT if you load a
  785. program that contains the old HOME command (actually just
  786. the token for HOME) and you list it, you will see that CLS
  787. has automatically replaced each occurrence of HOME.
  788.  
  789. OR if you change HOME to CLS, and write a program full of
  790. CLS's, it will work fine with your version of Newbasic.   If
  791. you now re-boot and use normal Applesoft, your program will
  792. still work, even though all of your CLS's will list as
  793. HOME's.
  794.  
  795. New FUNCTIONS Need Newbasic!
  796. ----------------------------
  797. Changing names of commands is one thing, but adding new
  798. functions like ELSE or SWAP or TONE is another story.  For
  799. these new functions to work properly, you MUST have the
  800. correct version of Newbasic loaded into memory.  Otherwise,
  801. the machine language instructions that enable Applesoft to
  802. execute these functions just aren't there.  Running a
  803. program with non-standard Applesoft commands without
  804. Newbasic loaded will produce unpredictable results.
  805.  
  806. Exiting Newbasic- APPLE II+ AND IIe
  807. There are two ways to exit Newbasic and re-instate normal
  808. Applesoft;
  809.  
  810. 1.  Boot with a normal disk.  This is the "cleanest" way to
  811. leave Newbasic, because it completely normalizes your
  812. system.
  813.  
  814. 2.  Or type, "INT".  This command will switch you to Integer
  815. Basic.  With Newbasic in effect, INT instead switches you to
  816. Applesoft (without erasing your program) and prints
  817. "Language Not Available" on the screen (Integer wasn't
  818. found).  If you want, you could use DOS Boss to rename "INT"
  819. to "ROM" and "Language Not Available" to "Applesoft
  820. Available" or something else appropriate.
  821.  
  822. NOTE: Pressing RESET will always leave you in Newbasic with
  823. your program intact.  FP will also always leave you in
  824. Newbasic, but with your program gone.
  825.  
  826. Exiting Newbasic- Apple II (Integer machines):
  827.  
  828. There are two ways to exit Newbasic and re-instate normal
  829. Integer Basic in your antique Apple:
  830.  
  831. 1. Boot with a normal disk.  This is the "cleanest" way to
  832. leave Newbasic, because it completely normalizes your
  833. system.
  834.  
  835. 2. Type "INT". This command will switch you to Integer Basic
  836. and erase your program.
  837.  
  838. NOTE:  FP will return you to (or leave you in) Newbasic with
  839. your program gone.
  840.  
  841. GPLE and Newbasic
  842. -----------------
  843. GPLE is compatible with Beagle Basic except for the
  844. following things.  Let us know if you find more.
  845.  
  846. Thing #1:  If you are using GPLE on the language card (GPLE
  847. version PLE.LC), it must be loaded before Newbasic is
  848. loaded.
  849.  
  850. Thing #2:  Using the INT command with Newbasic and PLE.LC
  851. loaded won't exit Newbasic as described above.  Don't use
  852. INT.
  853. .
  854. Thing #3:  Newbasic's ESCape cursor won't function properly
  855. with GPLE in memory.  Sorry.
  856.  
  857. Normal Location DOS Required
  858. ----------------------------
  859. DOS can't be in auxiliary memory (RAM card or language card)
  860. when using Newbasic.  There isn't even almost enough room.
  861.