COMPUTE! ISSUE 58 / MARCH 1985 / PAGE 138
Auto-Applesoft
Karl R. Beach
This program automates educational
programming. But it's also useful for adding text to an adventure game
or simply writing a letter to a friend.
This program is a conversion of "VIC Automatic BASIC" (COMPUTE!, April
1983). "Auto-Applesoft" will allow educators to write their own
educational software.
Auto-Applesoft is designed to let you see how each
page of text will appear on the screen before it is converted into
BASIC. It is designed to allow the use of all of the Apple II's
screen-editing features. Most important, it is designed to allow pages
of instructional text to be quickly created in BASIC program lines
rather than through the use of sequential text files.
Just as VIC Automatic BASIC was useful for a variety
of noninstructional uses, Auto-Applesoft is a handy utility to keep on
a
disk in case you want to add some text to an animated adventure game
(either directly or by appending it) or write an Apple-letter to a
friend. The program here is deliberately specialized for educational
applications, but you can experiment with the program, and mold it to
fit your needs.
Specialized Feature
When several students are going to use the program at one time,
programs made with Auto-Applesoft will allow the instructor to monitor
their work. When prompted for "Name," the instructor may enter TEACHER
and review up to 50 students' work. To avoid problems with rapid
scrolling, the instructor must press a key (any key will do) to call up
each student's results. It would be easy to customize the program to
direct the results to either a printer or a sequential disk file by
rewriting the program between lines 600 and 800.
To write a page of text: First, load Auto-Applesoft.
Then, insert an initialized disk into the disk drive and type RUN. You
will be greeted by a flashing announcement of the program's name. You
can shorten the time delay in line 8 to save time when you run the
program. After the title screen, you will be asked to input a beginning
line number. Jot this line number on a scrap of paper since you might
wish to refer to it later.
The first line number you should enter is 1000. When
you've entered it, the screen will go blank and the cursor will appear
at the upper left-hand corner. Simply type your first line of text.
When you come to the right-hand margin, press the SHIFT key and the
asterisk (*). The cursor will drop down two lines and back to the
left-hand margin. This is the position where the second line of text
will be when you run your program. Many children have a very difficult
time reading Apple II screens when the text is single-spaced.
Type additional lines the same way. To reposition
the cursor after each line, just press SHIFT and the asterisk. It is
possible to enter up to nine lines of text on one page. However, fewer
lines make a nicer display and are safer when you are ready to trick
the Apple into letting you trap the text as BASIC program lines.
If you make a typing error, press the SHIFT key and
the at symbol (@). The cursor will drop one line and back to the
left-hand margin. You can then retype the line.
Trapping Text
When you are ready to trap the text as BASIC lines, press the SHIFT key
and the ampersand symbol (&) key. You will be asked if this is the
end of a page of text. If it is, enter 1, but if you expect the student
to input a response, enter 2. If you enter a 1, the screen will
immediately be filled with what appears to be a well-spaced set of
BASIC program lines beginning one line number higher than the beginning
line number that you initially entered. If you enter a 2, you will be
asked to input the answer that the students should give. After you have
entered this answer, the screen will fill with program lines as
described above. The spacing of these lines is critical if text
trapping is to work on the Apple II.
Creating BASIC Lines
On the Apple you have to move the cursor all the way to the end of a
line to enter the entire program line. If you hit RETURN before the end
of the line, only the portion preceding the RETURN will be entered into
the computer. Follow these steps to enter the lines displayed on the
screen as BASIC program lines:
Press the ESCAPE key and drive the cursor to the top
of the screen by holding down the REPEAT key and the I key. Then drive
the cursor all the way across the program line using the → cursor
control key and the REPEAT key. Make sure you move past the last
quotation mark of the line, then press RETURN. The cursor should drop
down beside the next line number. Repeat these steps until the entire
screen has been entered as part of your BASIC program.
Type RUN again and begin with a line number higher
than the last one that you saw on the screen. While this process isn't
painless, you will quickly develop a rhythm for it and you'll be amazed
at how quickly you can build up a fairly complex educational program.
Adding Highlight And
Flash
There are many times when it is important to highlight a word or phrase
in an educational program. Auto-Applesoft has provisions for two
methods of highlighting: inverse video and flashing.
Immediately before you type the word you want to
highlight in inverse video, press CTRL and the I key. The cursor will
blink, but it will not move. Now type the word you want highlighted.
Immediately after typing the word, press CTRL N. The cursor will again
blink without moving. Now simply type the rest of your line of text as
you normally would. When you are ready to trap the text, you'll see
that the proper commands for inverse video have automatically been
included around the word in the line.
If you want to highlight a word or phrase in
flashing video, follow the same procedure you used for highlighting in
inverse, except type CTRL and the letter F instead of CTRL-I. This will
add some flash to your finished program.
When you've completed your program, enter a program
line with the instruction GOTO 890 before your END statement. Delete
the core of Auto-Applesoft by typing DEL 1,200 and pressing RETURN. Put
a title, a FOR-NEXT time delay, and a HOME command in between line 306
and 309. Finally, save the program on an initialized disk.
Auto-Applesoft
4 HOME : VTAB 10: HTAB 10:
FLASH : PRINT
"
"
5 HTAB 10: PRINT "
AUTO-APPLESOFT
"
6 HTAB 10: PRINT "
":
NORMAL
8 FOR I =
1 TO 2000: NEXT I: HOME
10 PRINT : INPUT "BEGIN
LINE # ";LN
12 HOME
15 FOR L = 1 TO 9
20 GET E$: IF E$ = "" THEN
20
25 IF E$ = "@" THEN A$(L) =
"":E$ =
"":
PRINT : PRINT ;: GOTO 20
27 IF E$ = CHR$ (6) THEN E4
= "":A
$(L) =
A$(L) + CHR$ (34) + ";:
FLASH:PRINT" + CHR$ (34): GOTO
20
28 IF E$ = CHR$ (14) THEN
E$ = "";
A$(L) =
A$(L) + CHRS (34) + ";
:NORMAL:PRINT" + CHR$ (34): GOTO
20
29 IF E$ = CHR$ (9) THEN E$
= "":A
$(L) =
A$(L) + CHR$ (34) + ";:
INVERSE:PRINT" + CHR$ (34): GOTO
20
30 IF E$ = "&" THEN 60
35 IF E$ = "*" THEN 50
40 PRINT E$;
45 A$(L) = A$(L) + E$:E$ =
"":GOTO
20
50 PRINT : PRINT : PRINT ;
52 K = K + 1
55 NEXT L
60 INPUT "1-PAGE 2=ANSWER
";B
65 IF B = 1 THEN 75
70 INPUT "ANSWER=";B$
75 HOME
80 FOR L = 1 TO K
85 LN=LN+L
90 PRINT : PRINT "
";LN;"PRINT:PRI
NT";
CHR$ (34);A$(L); CHR$ (34)
95 NEXT L
100 IF B = 1 THEN PRINT :
PRINT "
";LN + 1;"GOSUB900"
105 IF B = 2 THEN PRINT :
PRINT "
";LN + 1;"A$="; CHR$ (34);B$; CHR$
(34);":GOSUB800"
110 END
250 DIM ST$(50),SC$(50)
300 S = - 16336
305 HOME
306 REM TITLE
310 FOR I = 1 TO 100:Z =
PEEK (S):
NEXT I
330 FOR I = I TO 100=Z =
PEEK (S):
NEXT I
340 FOR I = 1 TO 20001 NEXT
I: HOME
400 VTAB 10: HTAB 5: INPUT
"WHAT'S
YOUR
NAME? ";N$
402 IF N$ = "TEACHER" THEN
600
405 PRINT : HTAB 15: PRINT
"HELLO,
";N$;"!"
410 FOR I = 1 TO 100:Z =
PEEK (S):
NEXT I
415 PRINT : HTAB 15: PRINT
"I'M YOU
R
COMPUTER!"
420 FOR I = 1 TO 2000: NEXT
I
500 HOME : GOTO 1000
600 HOME
605 FOR L = 1 TO CT
610 PRINT : PRINT
ST$(L);"=";SC$(L)
615 GET P$: IF P$ = "" THEN
615
620 P$ = ""
625 NEXT L
630 HOME : GOTO 400
800 PRINT : PRINT : INVERSE
: PRINT
"
PLEASE TYPE YOUR ANSWER & RE
TURN ":
NORMAL
805 PRINT : INPUT "ANSWER=
";B$
810 IF A$ = B$ THEN R = R +
1: GOSUB
850:
PRINT "CORRECT, ";N$;"!"
820 IF A$ < > B$ THEN
W = W + 1: GOSUB
870:
PRINT "THE ANSWER IS ";A$;
"."
830 FOR I = 1 TO 2000: NEXT
I: HOME
: RETURN
850 FOR I = 1 TO 50:Z =
PEEK (S): NEXT
I
855 FOR I = 1 TO 50: NEXT I
860 FOR I = 1 TO 50:Z =
PEEK (S): NEXT
I
865 RETURN
870 FOR I = 1 TO 200:Z =
PEEK (S):
NEXT I
875 RETURN
890 HOME : VTAB 10: PRINT "
GOOD J
OB,
";N$;"!".
891 CT = CT + 1:ST$(CT) =
N$:SC$(CT)
=
STR$ (R) + "&" + STR$ (W)
892 FOR I = 1 TO 100:Z =
PEEK (S):
NEXT I
893 PRINT : PRINT " YOUR
SCORE= ";
R;" AND
";W
894 PRINT : PRINT : PRINT :
FLASH :
PRINT "PLEASE GET THE NEXT STU
DENT!":
NORMAL
895 PRINT : INVERSE : PRINT
" TY
PE ANY
KEY TO BEGIN PROGRAM
":
NORMAL : PRINT : PRINT
896 GET P$: IF P$ = "" THEN
896
897 P$ = "":W = 0:R = 0: HOME :
GOTO
300
900 PRINT : PRINT : INVERSE
: PRINT
" PRESS ANY KEY FOR NEXT PAGE
": NORMAL
905 GET P$: IF P$ = "" THEN
905
910 P$ = "": HOME : RETURN
1000 REM PROGRAM AREA
9999 END