home *** CD-ROM | disk | FTP | other *** search
/ Nibble Magazine / nib28a.dsk / JULY.1986 / AMPER.DEMO.bas next >
BASIC Source File  |  2023-02-26  |  5KB  |  84 lines

  1. 10  REM  **********************
  2. 20  REM  * AMPER.DEMO         *
  3. 30  REM  * BY: HOWARD HUANG   *
  4. 40  REM  * COPYRIGHT (C) 1986 *
  5. 50  REM  * BY MICROSPARC, INC *
  6. 60  REM  * CONCORD, MA  01742 *
  7. 70  REM  **********************
  8. 80  HIMEM: 38400: PRINT : PRINT  CHR$(4)"BRUNAMPER.FORMAT"
  9. 90  HIMEM: 37120: REM  DOS 3.3 USE HIMEM:38144
  10. 100 RET$ = " ":COUNT = 38394
  11. 110  REM 
  12. 120  REM  === TITLE PAGE ===
  13. 130  REM 
  14. 140 WIDE =  PEEK(33)/2 +1
  15. 150  TEXT : HOME : NORMAL : VTAB 10: HTAB WIDE -9: & "Amper-Format Demo": PRINT : HTAB WIDE -8: & "By Howard Huang": PRINT : HTAB WIDE -20: & "* Copyright 1986 by MicroSPARC, Inc. *"
  16. 160  GOSUB 820
  17. 170  REM 
  18. 180  REM  === SELF-PRAISE ===
  19. 190  REM 
  20. 200  HOME : & "Welcome to Amper Formatter!"
  21. 210  & RET$: & "   Amper Formatter is a machine language utility designed to format text strings for screen display."
  22. 220  & "   The features include:": & RET$: & "1) Automatic word wrapping": & "2) Detection of 40 or 80 column screen"
  23. 230  & "3) Conversion of lower to upper case": & "4) Page breaks on the screen"
  24. 240  & "5) DOS 3.3 - ProDOS compatibility": & RET$: & "   This is a short demonstration that highlights these features and shows you how to use Amper Formatter from within your own programs."
  25. 250  GOSUB 820
  26. 260  REM 
  27. 270  REM  === WORD WRAP ===
  28. 280  REM 
  29. 290  & "   First, let's look at word wrapping. Normally, when the Apple reaches the edge of the text screen, it automatically goes down to the next line. This sometimes causes";
  30. 300  & " words to be split in the middle, resulting in unreadability and an unprofessional appearance.": & RET$
  31. 310  & "   With Amper Formatter, you may use messages of any length in your programs without worrying about word breaks; Amper Formatter will break them for you!": & RET$
  32. 320  GOSUB 820
  33. 330  & "   If you list this program, you'll find that all the text is unformatted, and that the lines are being properly formatted and printed by Amper Formatter, with carriage returns in the proper places."
  34. 340  & RET$: & "   Just type your messages once and they are automatically formatted for the size of the screen.": GOSUB 820
  35. 350  REM 
  36. 360  REM  === 40/80 COLUMNS ===
  37. 370  REM 
  38. 380  & "   Another nice feature is the ability to detect whether or not the 80-column card is active. If the card is active, Amper Formatter will take advantage of it and break the words accordingly.": & RET$
  39. 390  & "   You might want to try running this program in ";: IF  PEEK(49183) >128  THEN  & "40";
  40. 400  IF  PEEK(49183) <128  THEN  & "80";
  41. 410  & " column mode to see the difference.": GOSUB 820
  42. 420  REM 
  43. 430  REM  === LOWERCASE ===
  44. 440  REM 
  45. 450  & "   If you have an Apple II or II+, any lowercase text displayed by Amper Formatter will be converted automatically to uppercase. This way, Apple //e and //c owners can write programs that are compatible with all Apple II's while ";
  46. 460  & "still taking advantage of the //e and //c's new features.": & RET$
  47. 470  & "   To see the difference, try using this program on an Apple ";: IF  PEEK( -1101) = 6  THEN  & "II or II+";
  48. 480  IF  PEEK( -1101) < >6  THEN  & "//e or //c";
  49. 490  & ".": GOSUB 820
  50. 500  REM 
  51. 510  REM  === PAGE BREAKS ===
  52. 520  REM 
  53. 530  & "   Amper Formatter will also handle text displays longer than one screen long.  Amper Formatter will count the number of lines printed, and when 23 lines have been printed, ";
  54. 540  & "the word (CONTINUED) is printed at the bottom of the screen, and the program waits until the user presses a key.": & RET$: & "Here's an example:": GOSUB 820
  55. 550  FOR I = 1 TO 25:A$ =  STR$(I) +" Nibble Magazine": & A$: NEXT I
  56. 560  & RET$: & "   When you are finished printing text, you should set the line counter back to 0 with POKE 38394,0.": & RET$: GOSUB 820
  57. 570  REM 
  58. 580  REM  === DOS - ProDOS ===
  59. 590  REM 
  60. 600  & "   Amper Formatter is compatible with both DOS 3.3 and ProDOS.": & RET$
  61. 610  & "   All of these features, plus machine language speed, make Amper Formatter fast and easy to use.": & RET$
  62. 620  & "   Now, let's briefly look at how to use Amper Formatter.": GOSUB 820
  63. 630  REM 
  64. 640  REM  === USING ===
  65. 650  REM 
  66. 660  & "   It's easy to set up Amper Formatter. BRUN the program and set HIMEM: 38144 (37120 for ProDOS).": & RET$
  67. 670  & "   To actually use the formatter is just as simple. Wherever you want to print something, just use an ampersand [&] instead of PRINT. Here are some examples:": & RET$
  68. 680 A$ = "& " + CHR$(34) +"Hello, how are you today?" + CHR$(34): & A$
  69. 690  & "& A$": & "& CHR$(160)": & "& C$(I)": & "& A$;": & RET$
  70. 700  GOSUB 820
  71. 710  & "   The only restriction is with printing blank lines. In BASIC, this is done with a simple PRINT statement, with no string specified. With Amper Formatter, you must supply a string of some kind, even if it's just one space. "
  72. 720  GOSUB 820
  73. 730  REM 
  74. 740  REM  === WRAP IT UP ===
  75. 750  REM 
  76. 760  & "   Amper Formatter will be a super addition to your utility library. Use it well!": & RET$
  77. 770  HTAB WIDE -2: & "End.": POKE COUNT,0
  78. 780  END 
  79. 790  REM 
  80. 800  REM  === KEYPRESS ===
  81. 810  REM 
  82. 820  VTAB 23: HTAB WIDE -17: & "PRESS <RETURN> TO CONTINUE"
  83. 830  WAIT  -16384,128: POKE  -16368,0: POKE COUNT,0
  84. 840  HOME : RETURN