Classic Computer Magazine Archive COMPUTE! ISSUE 71 / APRIL 1986 / PAGE 74

Mousify Your Applesoft Programs
Part 2

Lee Swoboda

Part 1 of this series (COMPUTE!, March 1985) provided an Applesoft program allowing an AppleMouse, joystick, or game paddles to point to text on the screen. This month, Part 2 demonstrates more advanced mouse operations such as defining a text area and deleting, copying, or restoring the defined text. The example programs run with either DOS 3.3 or ProDOS. Although a mouse works best, you can substitute a joystick or game paddles.


Mouse-controlled programs must perform a number of functions in addition to simple pointing. The programs following this article provide several of these important capabilities:
Define Text. Use the mouse to highlight a block of text, which can then be copied or deleted (typical word processing operations).
Copy Text. Copy highlighted text to a buffer without deleting it from the screen.
Delete Text. Delete highlighted text and save it in a buffer.
Insert Text. Restore previously copied or deleted text at a new point on the screen.
Cancel. Undo highlighting if you wish to abort a copy or delete operation.
Delete a Character. Delete the character under the cursor.
Delete to End of Line. Delete text from the cursor to the end of the line.
Find Mouse. Locate the mouse interface.

Getting Started
Enter and save Program 1, which is an expanded and modified version of the program published in Part 1. It works in either DOS 3.3 or ProDOS; if you're using ProDOS, change line 115 as shown here:

115 HIMEM: 36352

    Program 2 creates a binary file named MOUSEY which contains machine language routines used by Program 1. The MOUSEY file created by Program 2 must be present on disk whenever you run Program 1. (It's not necessary to have Program 2 itself on the disk with Program 1, just a copy of the binary file created by Program 2.) Be sure to save a copy of Program 2 so you'll be able to create new copies of MOUSEY whenever needed.
    Program 3 creates a short text file which we'll use in the following example. If you're using a joystick instead of a mouse, refer to the additional instructions under "Joystick Modifications" below. When you are ready to proceed, your disk should contain a copy of Program 1, a file named MOUSEY (created by Program 2), and a file named TEXT (created by Program 3).
    When you run Program 1, the screen looks like this:

ENTER INFORMATION

FIRST NAME .... COMPUTE!
LAST NAME ..... READER SERVICE
ADDRESS ....... P.O. BOX 50950
CITY .......... DES MOINES
STATE ......... IA 50950
ZIP ...........
TELEPHONE ..... 1-800-346-6767

     COPY DELETE  INSERT CANCEL
    ERASE  QUIT DONE  HELP

    This screen simulates what you might see in a simple address book program. We have introduced an intentional error by putting the zip code entry on the same line as the state entry. Let's correct the error for a quick demonstration of a few mouse features. Move the mouse cursor to the first number in the zip code, then press and hold the mouse button down while moving the mouse to the right. The computer highlights the zip code in inverse video. Keep moving the mouse until all the numbers in the zip code are highlighted, then release the mouse button.
    At this point, the highlighted text area has been defined. Now move the mouse pointer to the word DELETE in the strip menu at the bottom of the screen and press the mouse button. The computer erases the highlighted zip code from the screen. Don't worry-the information hasn't been lost. Whenever you delete text, the program stores it in a temporary memory buffer.
    Now let's put the zip code data back where it belongs. Move the mouse pointer to the beginning of the next screen line (directly under the I in IA), then press the mouse button. The computer moves the cursor to that line. Next, move the mouse pointer to the word INSERT and press the button again. The zip code data reappears in the desired screen area.

Mouse Editing Functions
Here is a more detailed description of the mouse-editing functions demonstrated in Program 1:

Mouse pointer and text cursor.
The rapidly blinking caret symbol (^) is the mouse pointer, which you can move around the text screen with the mouse. When the pointer passes over a character, the character blinks rapidly. The flashing rectangle shows the position of the text cursor. When the cursor passes over a character, the character changes temporarily to flashing uppercase. There are three different ways to move the text cursor:

• Move the mouse pointer to the spot where you want the text cursor to go, then press the mouse button.
• Use the arrow keys as you would in Applesoft BASIC (the Apple II uses CTRL-J and CTRL-K to move up and down, respectively).
• Press RETURN to move the cursor to the beginning of the next screen line. If the cursor is already on the bottom line, it moves to the top. Pressing RETURN does not erase the text to the right of the cursor.

Enter text. Text is entered as usual, by pressing any letter, number, or punctuation key. Lowercase letters are automatically converted to uppercase.

Define text. Before text can be copied or deleted, you must define it. Move the mouse pointer to the upper-left corner of the text you want to define, then press and hold the mouse button. While pressing the button down, drag the mouse pointer to the lower-right corner of the desired area. The computer marks the defined area by highlighting every character with inverse video. Now release the button: The area is defined, and you may proceed to the Cancel, Delete, or Copy options.

Delete text. To delete a text area that you previously defined, move the mouse pointer to DELETE in the strip menu at the bottom of the text screen, then press the button. The computer blanks out the highlighted portion of the screen and stores the first 200 characters of the defined area in a temporary buffer for later use.

Copy text. To copy a text area that you have previously defined, move the pointer to COPY in the strip menu, then press the button. The computer stores the first 200 characters of the defined area in a temporary buffer. Unlike the Delete operation, Copy does not blank out the defined area.

Insert text. To insert text that you previously copied or deleted, move the pointer to the spot where you want to insert text, then press the button to locate the cursor at that spot. Now move the pointer to INSERT in the strip menu and press the button again. The computer inserts the text, using the text cursor position as a starting point. Note that the inserted text overwrites whatever else was in the affected area. You can insert only the most recently copied or deleted text.

Cancel. If you define a block of text and then decide not to copy or delete it, move the pointer to CANCEL in the strip menu and press the button. The highlighting disappears, and the text is no longer defined.

Editing keys. Press CTRL-D (or DELETE on the Apple IIc and Ile) to delete the character under the cursor. The remaining characters in that line move one space to the left. You can also press CTRL-X to delete every character from the present cursor position to the end of the line.

    Try out the various editing functions. When you've tried everything, move the mouse pointer to DONE in the strip menu and press the button. The demonstration program ends with a routine that reads the current data directly from the video screen.
    Since the Copy, Delete, Insert, and Cancel commands are written in BASIC, they may take a second or two to complete if you define a large text area. Though BASIC can't perform such operations very fast, these routines are far easier for you to customize than if they had been written in machine language. If the slowness bothers you, just imagine how long it would take to delete the same amount of text with your trusty pink eraser.

Joystick Modifications
If you don't own a mouse, you can substitute a joystick. Delete lines 120, 130, 10001-10090, 10200, 20220, and 44000-44050 from Program 1; then add or modify the lines in Program 4. The joystick moves the mouse pointer around the screen, and the joystick button substitutes for the mouse button.
    Since the joystick was designed for a different purpose, its performance doesn't equal that of a mouse. But it costs a lot less.

How The Program Works
The machine language routine contained in the MOUSEY file simply highlights text by changing every character between the text cursor and mouse pointer to inverse video. All the other functions are carried out by the BASIC routines in Program 1.
    After you define a block of text, lines 35000-44050 act on the highlighted area. The Copy routine (36000-36180) converts each character in the defined area to normal video and stores it in a temporary text buffer. This buffer lies in locations 775-1000 ($307-$3E8), a normally unused region.
    The Delete routine (37000-37180) is similar to Copy and uses the same temporary buffer, but replaces each character in the defined area with a blank space.
    The Insert routine (38000-38100) moves text from the temporary buffer back to the video screen, beginning at the current location of the text cursor.
    Lines 39000-40000 contain the Cancel routine, which aborts copy or delete operations. You can also cancel a definition by pressing any key.
    The routine at lines 41000-41070 deletes a single character; lines 42000-42060 erase all or part of the current line.
    Here are some other useful entry points in the program (note that each of these routines ends with a GOTO rather than GOSUB):

Line        Purpose

10120    read mouse
10300    position mouse pointer
10420    keyboard input
10570    position cursor

For instructions on entering these listings, please refer to "COMPUTE!'s Guide to Typing in Programs" in this issue of COMPUTE!,

Program 1: Advanced Mousification

B1 115 HIMEM: 37375
DF 120 GOSUB 44010
C7 130 MI = 20: REM MOUSE SENSIT
       IVITY
5A 140 D$ = CHR$ (4)
EB 145 PRINT D$"BLOAD MOUSEY"
BC 150 REM
07 160 REM READ DATA FILE
90 170 REM
CB 180 PRINT D$"OPEN TEXT"
32 190 PRINT D$"READ TEXT"
6D 200 INPUT NF$,NL$,AD$,CI$,ST$
       ,ZI$,TE$
CD 210 PRINT D$"CLOSE TEXT"
87 220 REM
25 230 REM DATA ENTRY SCREEN
BB 240 REM
4F 250 HOME
4D 260 Y1 = 4:X1 = 15:C0 = 160
35 270 INVERSE
D7 280 PRINT "              ENTER
       INFORMATION          "
24 285 VTAB 23: PRINT "      COP
       Y  DELETE  INSERT  CANCEL
            "
98 290 VTAB 24: PRINT "        E
       RASE QUIT DONE HELP
           ";
C6 300 NORMAL
31 310 VTAB 4: HTAB 1
F4 320 PRINT "FIRST NAME .."
C6 330 PRINT "LAST NAME ..."
3C 340 PRINT "STREET ......"
D6 350 PRINT "CITY ........"
1F 360 PRINT "STATE ......."
36 370 PRINT "ZIP ........."
17 380 PRINT "TELEPHONE ..."
3A 390 VTAB 19: HTAB 10: INVERSE
        : PRINT "^";: NORMAL
81 400 PRINT " IS MOUSE POINTER"
3C 410 VTAB 21: HTAB 14: INVERSE
        : PRINT " ";: NORMAL
38 420 PRINT " IS CURSOR
26 430 VTAB 4
5E 440 HTAB 15: PRINT NF$
66 450 HTAB 15: PRINT NL$
D9 460 HTAB 15: PRINT AD$
El 470 HTAB 15: PRINT CI$
F6 480 HTAB 15: PRINT ST$
71 490 HTAB 15: PRINT ZI$
59 500 HTAB 15: PRINT TE$
73 9999 REM #10000
19 10000 REM
E6 10001 REM --------------
29 10010 REM MOUSE ROUTINES
E6 10020 REM --------------
3, 10040 REM
A4 10050 REM TURN MOUSE "ON"
49 10060 REM
AB 10070 PRINT D$"PR#"S0: PRINT
       CHR$ (1)
CB 10080 PRINT D$"PR#0"
09 10090 PRINT D$"IN#"S0
17 10100 GOTO 10590
25 10110 REM
65 10120 REM DETERMINE POSITION
91 10130 REM OF MOUSE
3D 10140 REM
IC 10150 VTAB 1: HTAB 40
77 10160 INPUT "";X0,Y0,B0
7D 10170 IF B0 < 0 THEN 10440: R
       EM KEY PRESSED?
D0 10180 Y0 = INT (Y0 / MI) + 1
7B 10190 IF Y0 > 24 THEN Y0 = 24
64 10200 X0 = INT (X0 / MI) + 1
75 10210 IF X0 > 40 THEN X0 = 40
6A 10215 IF 80 = 2 AND X0 > 20 A
       ND X0 < 27 AND Y0 = 23
       THEN 38010
6D 10216 IF B0 = 2 AND SW = 0 TH
       EN X2 = X0:Y2 = Y0: POK
       E 768,Y2: POKE 769,X2:X
       3 = X0:Y3 = Y0
9B 10217 IF B0 = 3 AND SW = 2 TH
       EN SW = 3
31 10218 ON SW GOTO 35010,35020,
       10315
0B 10220 IF B0 > 1 THEN 10320: R
       EM BUTTON PRESSED?
D9 10225 IF X2 < > X0 OR Y2 < >
       Y0 THEN SW = 1: .GOTO 35
       010
B9 10230 IF Y0 = 24 THEN 20030
63 10240 Y1 = Y0:X1 = X0
78 10250 POKE V0,C0
E0 10255 IF C0 < 128 THEN POKE V
       0,C0 + 128
4B 10260 C0 = C2
F2 10270 GOSUB 10800
F2 10280 GOTO 10620
69 10290 REM
ED 10300 REM POSITION MOUSE POIN
       TER
2D 10310 REM
DD 10315 IF B0 = 2 AND Y0 = 23 T
       HEN 20081
86 10320 IF V0 = V1 -THEN C2 = C1
80 10330 POKE V1,C2
42 10340 V1 = 1023 + 128 * (Y0 -
        1) + X0
3F 10350 IF Y0 > 8 THEN V1 = V1
       - 984
9C 10360 IF Y0 > 16 THEN V1 = V1
       - 984
27 10370 C2 = PEEK (V1)
64 10380 POKE V1,160
AA 10390 IF C2 = 160 THEN POKE V
       1,30
C2 10400 GOTO 10150
31 10410 REM
11 10420 REM KEYBOARD INPUT
41 10430 REM
F9 10440 C3 = PEEK ( - 16384)
77 10450 POKE - 16368,0
DC 10455 IF C3 > 223 THEN C3 = C
       3 - 32: REM CONVERT TO
       UPPER CASE
7C 10456 IF SW > 0 THEN GOSUB 39
       010
48 10460 IF C3 > 159 THEN 10710
63 10465 IF C3 = 132 OR C3 = 225
        THEN IF X1 > 14 AND Y1
        > 3 AND YS < 11 THEN G
       OSUB 41010
0A 10466 IF C3 = 152 THEN IF X1
       > 14 AND Y1 > 3 AND Y1
       < 11 THEN GOSUB 42010
CD 10470 IF C3 = 141 THEN X1 = 1
       5:Y1 = Y1 + 1: IF Y1 >
       10 THEN Y1 = 4: REM RET
       URN KEY
59 10480 IF C3 = 138 THEN Y1 = Y
       1 + 1: REM DOWN ARROW
C 10490 IF C3 = 139 THEN YI = Y
       1 -1: REM UP ARROW
OF 10500 IF C3 = 149 THEN X1 = X
       1 + 1: REM RIGHT ARROW
71 10510 IF C3 = 136 THEN XS = X
       1 - 1: REM LEFT ARROW
56 10520 IF Y1 > 24 THEN Y1 = 24
DC 10530 IF Y1 < 1 THEN Y1 = 1
9C 10540 IF X1 > 40 THEN X1 = 40
EB 10550 IF X1 < 1 THEN X1 = 1
5D 10560 REM
06 10570 REM POSITION CURSOR
6D 10580 REM
A4 10590 POKE V0,C0
CA 10600 GOSUB 10800
42 10610 C0 = PEEK (V0)
9E 10620 IF V0 = V1 THEN C0 = C2
44 10630 REM CHANGE TO FLASHING
       CHARACTER
87 10640 C1 = CO
23 10650 IF C1 > 127 THEN C1 = C
       1 - 64
7F 10660 IF CI > 64 THEN C1 = C1
        - 64
D9 10670 IF C1 > 95 THEN C1 = C1
        - 32
4B 10680 IF C1 < 64 THEN C1 = C1
        + 64
C8 10690 POKE V0,C1
CE 10700 GOTO 10150
11 10710 IF X1 < 15 OR Y1 < 4 OR
        Y1 > 10 THEN 10150
DE 10720 GOSUB 10800
DC 10730 POKE V0,C3
51 10740 C0 = C3
CE 10750 IF V0 = V1 THEN C2 = C3
BC 10760 X1 = X1 + 1: IF X1 > 39
        THEN X1 = 39
67 10770 GOTO 10590
16 10780 REM CALCULATE V0
6E 10790 REM (VIDEO BUFFER ADORE
       SS)
60 10800 V0 = 1023 + 128 * (Y1 -
        1) + X1
2B 10810 IF Y1 > 8 THEN V0 = V0
       - 984
7F 10820 IF Y1 > 16 THEN V0 = V0
        - 984
8B 10830 RETURN
9A 19999 REM #20000
IA 20000 REM
AE 20010 REM STRIP MENU
2A 20020 REM
C2 20030 PRINT D$"IN#0"
CB 20040 IF X0 > 8 AND X0 < 14 T
       HEN NF$ = "":NL$ = "":A
       D$ = "":CI$ = "":ST$ =
       "" :ZI$ = "":TE$ = "": G
       OTO 250
1F 20050 IF X0 > 15 AND X0 < 20
       THEN HOME : END
73 20060 IF X0 > 21 AND X0 < 26
       THEN 30030
7A 20070 IF X0 > 27 AND X0 < 32
       THEN 20100
71 20080 VTAB 1: HTAB 40: PRINT
       D$"IN#"S0: GOTO 10150
5C 20081 IF X0 > 6 AND X0 < 11 T
       HEN GOSUB 36010: GOTO 1
       0590
B2 20082 IF X0 > 12 AND X0 < 19
       THEN GOSUB 37010: GOTO
       10590
5F 20083 IF X0 > 28 AND X0 < 35
       THEN GOSUB 39010: GOTO
       10590
34 20084 GOTO 10150
17 20090 REM HELP TEXT
CD 20100 VTAB 12: HTAB 1
BA 20110 PRINT "THE FLASHING REF
       LEX (^) IS THE MOUSE"
75 20120 PRINT "POINTER AND THE
       FLASHING RECTANGLE IS"
4B 20130 PRINT "THE CURSOR. TO
       MOVE THE CURSOR TO THE"
36 20140 PRINT "ENTRY YOU WANT T
       O CHANGE, USE THE ARROW
       "
4E 20150 PRINT "KEYS OR USE THE
       MOUSE TO MOVE THE MOUSE
       "
47 20160 PRINT "POINTER, THEN PR
       ESS THE MOUSE BUTTON TO
       "1
E6 20170 PRINT "MOVE THE CURSOR
       TO THAT POINT. TYPE"
EA 20160 PRINT "NEW OR CORRECTED
        DATA, THEN MOVE THE"
31 20190 PRINT "MOUSE CURSOR TO
       'DONE' IN THE MENU"
4A 20200 PRINT "BELOW AND PRESS
       THE MOUSE BUTTON TO"
D4 20210 PRINT "ACCEPT THE ENTRI
       ES ABOVE."
D9 20220 PRINT D$"IN#'"S0
D3 20230 GOTO 10150
9D 29999 REM #30000
1B 30000 REM
28 30010 REM EXAMPLE
2B 30020 REM
A1 30030 Y1 = 4: GOSUB 63050:NF$
        = A$
2C 30040 Y1 = 5: GOSUB 63050:NL$
        = A$
91 30050 Y1 = 6: GOSUB 63050:AD$
        = A$
IC 30060 Y1 = 7: GOSUB 63050:CI$
        = A$
E9 30070 Y1 = 8: GOSUB 63050:ST$
        = A$
17 30080 Y1 = 9: GOSUB 63050:ZI$
        = A$
17 30090 Y1 = 10: GOSUB 63050:TE
       $ = A$
2E 30100 REM GO TO REMAINDER OF
       YOUR PROGRAM
IC 30110 REM FOR EXAMPLE ...
36 30120 HOME
5E 30130 VTAB 10
EE 30140 PRINT NF$" "NL$
38 30150 PRINT AD$
B1 30160 PRINT CI$", "ST$" "ZI$
9C 30170 PRINT TE$
CA 30180 CALL - 198: CALL - 198
89 30190 END : REM END OF EXAMPL
       E
EC 35000 REM HIGHLIGHT TEXT
AD 35010 POKE V0,C1 - 64:SW = 2
AC 35020 IF B0 > 1 THEN 10150
40 35030 IF X3 < X0 THEN X3 = X0
DS 35040 IF Y3 < Y0 THEN Y3 = Y0
BB 35050 POKE 770,Y3: POKE 771,X
       3
8D 35060 POKE 772,YO: POKE 773,X
       0
FC 35070 CALL 37376
28 35080 Y3 = Y0:X3 = X0
e7 35090 GOTO 10150
9C 36000 REM COPY
68 36010 P3 = 775
38 36020 FOR II = Y2 TO Y3
BA 36030 FOR JJ = X2 TO X3
AC 36040 GOSUB 40020
39 36050 C3 = PEEK (V2) + 128
96 36060 IF C3 < 160 THEN C3 = C
       3 + 64
37 36070 IF C3 > 223 THEN C3 = C
       3 - 64
FE 36080 POKE V2,C3
CD 36090 IF P3 > 1000 THEN 36120
BA 36100 POKE P3,C3
DA 36110 P3 = P3 + 1
D5 36120 NEXT JJ
3E 36130 POKE P3,141
EE 36140 IF P3 < 1001 THEN P3 =
       P3 + 1
E7 36150 NEXT II
87 36160 POKE P3,255
B8 36170 SW = 0
A5 36180 RETURN
E8 37000 REM DELETE
62 37010 P3 = 775
3A 37020 FOR II = Y2 TO Y3
BC 37030 FOR JJ = X2 TO X3
AE 37040 GOSUB 40020
38 37050 C3 = PEEK. (V2) + 128
98 37060 IF C3 < 160 THEN C3 = C
       3 + 64
39 37070 IF C3 > 223 THEN C3 = C
       3 - 64
6C 37080 POKE V2,160
07 37090 IF P3 > 1000 THEN 37120
BC 37100 POKE P3,C3
DC 37110 P3 = P3 + 1
D7 37120 NEXT JJ
40 37130 POKE P3,141
F8 37140 IF P3 < 1001 THEN P3 =
       P3 + 1
E9 37150 NEXT 11
89 37160 POKE P3,255
D4 37170 SW = 0:C0 = 160
A7 37180 RETURN
D7 38000 REM INSERT
64 38010 P3 = 775
05 38020 II = Y1:JJ = XI
8D 38030 C3 = PEEK (P3)
FI 38040 IF C3 = 141 THEN II = I
       I + 1:JJ = X1:P3 =, P3 +
        1: GOTO 38030
72 38050 IF II > 22 OR JJ > 40 T
       HEN 38090
D8 38060 IF C3 = 255 THEN SW = 0
       :C0 = PEEK (V0): GOTO 1
       0590
C8 38070 GOSUB 40020
03 38080 POKE V2,C3
4E 38090 JJ = JJ + 1:P3 = P3 + 1
C4 38100 GOTO 38030
C3 39000 REM CANCEL
36 39010 FOR II = Y2 TO Y3
BB 39020 FOR JJ = X2 TO X3
AA 39030 GOSUB 40020
37 39040 C3 = PEEK (V2) + 128
94 39050 IF C3 < 160 THEN C3 = C
       3+64
35 39060 IF C3 > 223 THEN C3 = C
       3 - 64
FC 39070 POKE V2,C3
43 39080 NEXT JJ,II
C2 39090 SW = 0
56 40000 RETURN
24 40010 REM
78 40020 V2 = 1023 + 128 * (II -
        1) + JJ
48 40030 IF II > 8 THEN V2 = V2
       - 984
A6 40040 IF II > 16 THEN V2 = V2
        - 984
7E 40050 RETURN
7F 41000 REM DELETE A CHARACTER
83 41010 GOSUB 43010
96 41020 FOR II = V0 TO V2 - 1
8B 41030 POKE II, PEEK (II + 1)
D2 41040 NEXT II
49 41050 POKE V2,160
57 41060 C0 = PEEK (V0)
9/ 41070 RETURN
OF 42000 REM DELETE TO END OF LI
       NE
85 42010 GOSUB 43010
76 42020 FOR II = V0 TO V2
7D 42030 POKE II,160
D4 42040 NEXT II
FA 42050 C0 = 160
8A 42060 RETURN
22 43000 REM
CF 43010 V2 = 1063 + 128 * (Y1
        1)
2E 43020 IF Y1 > 8 THEN V2 = V2
       - 984
94 43030 IF Y1 > 16 THEN V2 = V2
        - 984
7C 43040 RETURN
DO 44000 REM FIND MOUSE
56 44010 FOR S0 = 0 TO 6
AA 44020 IF PEEK (49420 + (256
        S0)) = 32 AND PEEK (49
       659 + (256 * S0)) = 214
        THEN S0 = S0 + 1: RETU
       RN
8! 44030 NEXT S0
82 44040 PRINT "I CAN'T FIND A M
       OUSE INTERFACE CARD" CH
R$ (7) CHR$ (7)
68 44050 END
A5 62999 REM 4163000
24 63000 REM
2C 63010 REM SUBROUTINE TO "READ
       "
IF 63020 REM STRINGS FROM THE
B3 63030 REM VIDEO BUFFER
44 63040 REM
OF 63050 VTAB 24: FLASH : PRINT
       "  WORKING ...
                        ";: NO
       RMAL : VTAB 1: HTAB 1
C9 63060 A$ = ""
FC 63070 REM CALCULATE V0
55 63080 REM (VIDEO BUFFER ADDRE
       SS)
A5 63090 V0 = 1037 + 128 * (Y1 -
        1)
12 63100 IF Y1 > 8 THEN V0 = V0
       - 984
66 63110 IF Y1 > 16 THEN V0 = V0
        - 984
2F 63120 FOR I = 1 TO 25
67 63130 C0 = PEEK (V0 + I)
AD 63135 IF C0 < 128 THEN C0 = C
       0 + 128
70 63136 IF C0 < 160 THEN C0 = C
       0 + 64
19 63137 IF C0 > 223 THEN C0 = C
       0 - 64
DD 63140 IF C0 = 160 AND PEEK (V
       0 + I + 1) = 160 THEN 6
       3190: REM END IF TWO BL
       ANKS
F9 63160 IF C0 > 128 THEN C0 = C
       0 - 128
F5 63170 A$ = A$ + CHR$ (C0)
D5 63180 NEXT I
C2 63190 IF RIGHT$ (A$,1) = CHR$
        (32) THEN A$ = LEFT$ (
       A$, LEN (A$) - 1): GOTO
        63190: REM REMOVE TRAI
       LING BLANKS
42 63195 IF A$ = CHR$ (96) THEN
       A$ = ""
66 63200 RETURN


Program 2: MOUSEY Filemaker

84 10 REM BASIC PROGRAM FOR
7C 20 REM GENERATING THE
4A 30 REM BINARY FILE
9A 40 REM 'MOUSEY'
4E 50 HOME
36 60 VTAB 12: PRINT "WORKING ..
      ."
21 70 FOR I = 0 TO 872
88 80 READ A
19 90 POKE 37376 + I,A
OF 100 VTAB 12: HTAB 13: PRINT I
        + 1
DF 110 NEXT I
2A 120 PRINT CHR$ (4)"BSAVE MOUS
       EY,A37376, L873"
2B 130 PRINT : PRINT "DONE'"
77 10000 DATA 173,89,170,72,165,
       217,72
9B 10010 DATA 165,118,72,169,2,1
       33,118
B4 10020 DATA 169,255,133,217,16
       9,191,133
B7 10030 DATA 51,169,0,133,243,7
       6,41
6E 10040 DATA 146,4,0,15,0,7,0
AS 10050 DATA 21,0,7,0,21,0,169
D6 10060 DATA 29,133,133,169,146
       ,160,0
84 10070 DATA 162,11,32,77,149,7
       6,69
57 10080 DATA 146,20,7,32,0,8,0
I8 10090 DATA 22,0,8,0,22,0,169
A8 10100 DATA 57,133,133,1699146
       ,160,0
35 10110 DATA 162,11,32,77,149,1
       73,0
FE 10120 DATA 3,141,29,146,169,0
       ,141
FE 10130 DATA 30,146,173,1,3,141
       ,31
81 10140 DATA 146,169,0,141,32,1
       46,173
FO 10150 DATA 2,3,141,33,146,169
       ,0
68 10160 DATA 141,34,146,173,3,3
       ,141
1D 10170 DATA 35,146,169,0,141,3
       6,146
D7 10180 DATA 173,4,3,141,37,146
       ,169
5C 10190 DATA 0,141,38,146,173,5
       ,3
2C 10200 DATA 141,39,146,169,0,1
       41,40
83 10210 DATA 146,173,29,146,141
       ,61,146
C8 10220 DATA 173,30,146,141,62,
       146,173
18 10230 DATA 62,146,205,34,146,
       48,15
15 10240 DATA 208,10,173,61,146,
       205,33
22 10250 DATA 146,144,5,240,3,76
       ,134
D5 10260 DATA 147,173,31,146,141
       ,63,146
75 10270 DATA 173,32,146,141,64,
       146,173
88 10280 DATA 64,146,205,36,146,
       48,15
7F 10290 DATA 208,10,173,63,146,
       205,35
9D 10300 DATA 146,144,5,240,3,76
       ,123
FB 10310 DATA 147,24,173,37,146,
       105,1
39 10320 DATA 141,65,146,173,38,
       146,105
2A 10330 DATA 0,141,66,146,24,17
       3,39
BE 10340 DATA 146,105,1,141,67,1
       46,173
03 10350 DATA 40,146,105,0,141,6
       8,146
81 10360 DATA 173,62,146,205,66,
       146,48
43 10370 DATA 10,208,29,173,61,1
       46,205
F3 10380 DATA 65,146,176,21,173,
       64,146
6E 10390 DATA 205,68,146,48,10,2
       08,11
82 10400 DATA 173,63,146,205,67,
       146,176
9C 10410 DATA 3,76,112,147,32,12
       2,148
EF 10420 DATA 173,57,146,141,51,
       147,173
A2 10430 DATA 58,146,141,52,147,
       173,144
A4 10440 DATA 7,141,59,146,169,0
       ,141
29 10450 DATA 60,146,173,60,146,
       201,0
D2 10460 DATA 48,9,208,24,173,59
       ,146
9B 10470 DATA 201,128,176,17,24,
       173,59
91 10480 DATA 146,105,128,141,59
       ,146,173
EA 10490 DATA 60,146,105,0,141,6
       0,146
48 10500 DATA 173,57,146,141,110
       ,147,173
5A 10510 DATA 56,146,141,111,147
       ,173,59
5D 10520 DATA 146,141,144,7,238,
       63,146
9F 10530 DATA 208,3,238,64,146,7
       6,195
BE 10540 DATA 146,238,61,146,208
       ,3,238
AB 10550 DATA 62,146,76,160,146,
       173,29
9B 10560 DATA 146,141,61,146,173
       ,30,146
20 10570 DATA 141,62,146,173,62,
       146,205
D8 10580 DATA 38,146,48,15,208,1
       0,173
18 10590 DATA 61,146,205,37,146,
       144,5
43 10600 DATA 240,3,76,119,148,1
       73,31
BF 10610 DATA 146,141,63,146,173
       ,32,146
80 10620 DATA 141,64,146,173,64,
       146,205
96 10630 DATA 40,146,48,15,208,1
       0,173
3C 10640 DATA 63,146,205,39,146,
       144,5
A3 10650 DATA 240,3,76,108,148,3
       2,122
FF 10660 DATA 148,173,57,146,141
       ,220,147
CB 10670 DATA 173,58,146,141,221
       ,147,173
2C 10680 DATA 20,7,141,59,146,16
       9,0
A7 10690 DATA 141,60,146,173,60,
       146,201
57 10700 DATA 0,48,28,208,9,173,
       59
04 10710 DATA 146,201,127,144,19
       ,240,17
B5 10720 DATA 56,173,59,146,233,
       64,141
B7 10730 DATA 59,146,173,60,146,
       233,0
83 10740 DATA 141,60,146,173,60,
       146,201
7F 10750 DATA 0,48,28,208,9,173,
       59
0C 10760 DATA 146,201,64,144,19,
       240,17
DD 10770 DATA 56,173,59,146,233,
       64,141
DF 10780 DATA 59,146,173,60,146,
       233,0
AB 10790 DATA 141,60,146,173,60,
       146,201
58 10800 DATA 0,48,28,208,9,173,
       59
E7 10810 DATA 146,201,64,144,19,
       240,17
89 10820 DATA 56,173,59,146,233,
       64,141
BB 10830 DATA 59,146,173,60,146,
       233,0
18 10840 DATA 141,60,146,173,57,
       146,141
38 10850 DATA 95,148,173,58,146,
       141,96
SA 10860 DATA 148,173,59,146,141
       ,20,7
92 10870 DATA 238,63,146,208,3,2
       38,64
1D 10880 DATA 146,76,181,147,238
       ,61,146
FA 10890 DATA 208,3,238,62,146,7
       6,146
43 10900 DATA 147,76,11,149,56,1
       73,61
ED 10910 DATA 146,233,1,141,57,1
       46,173
0A 10920 DATA 62,146,233,0,141,5
       8,146
4C 10930 DATA 169,0,133,138,169,
       128,174
E9 10940 DATA 58,146,172,57,146,
       32,31
45 10950 DATA 149,142,58,146,140
       ,57,146
38 10960 DATA 24,169,255,109,57,
       146,141
97 10970 DATA 57,146,169,3,109,5
       8,146
FB 10980 DATA 141,58,146,24,173,
       57,146
58 10990 DATA 109,63,146,141,57,
       146,173
8F 11000 DATA 58,146,109,64,146,
       141,58
C4 11010 DATA 146,173,62,146,201
       ,0,48
CE 11020 DATA 28,208,9,173,61,14
       6,201
11 11030 DATA 8,144,19,240,17,56
       ,173
96 11040 DATA 57,146,233,216,141
       ,57,146
DF 11050 DATA 173,58,146,233,3,1
       41,58
EC 11060 DATA 146,173,62,146,201
       ,0,48
F6 11070 DATA 28,208,9,173,61,14
       6,201
EF 11080 DATA 16,144,19,240,17,5
       6,173
BE 11090 DATA 57,146,233,2169141
       ,57,146
BB 11100 DATA 173,58,146,233,3,1
       41,58
B5 11110 DATA 146,96,104,133,118
       ,104,133
IC 11120 DATA 217,104,141,89,170
       ,169,141
67 11130 DATA 141,1,2,169,1,133,
       52
9A 11140 DATA 96,133,137,132,135
       ,134,136
B0 11150 DATA 169,0,133,133,133,
       134,70
81 11160 DATA 136,102,135,144,13
       ,24,165
BE 11170 DATA 137,101,133,133,13
       3,165,138
EC 11180 DATA 101,134,133,134,6,
       137,38
85 11190 DATA 138,165,136,5,135,
       208,227
5B 11200 DATA 164,133,166,134,96
       ,133,134
FE 11210 DATA 132,135,160,0,169,
       0,145
BB 11220 DATA 133,200,208,2,230,
       134,138
2C 11230 DATA 208,4,198,135,48,4
       ,202
58 11240 DATA 76,83,149,96,0,0



Program 3: TEXT Filemaker

51 10 D$ = CHR$ (4)
07 20 PRINT D$"OPEN TEXT"
CF 30 PRINT D$"WRITE TEXT"
EA 40 PRINT "COMPUTE!"
7E 50 PRINT "READER SERVICE"
89 60 PRINT "P.O. BOX 50950
E3 70 PRINT "DES MOINES"
6A 80 PRINT "IA 50950"
94 90 PRINT ""
E9 100 PRINT "1-800-346-6767"
DA 110 PRINT D$"CLOSE"



Program 4: Joystick Modifications

FC 265 B0 = 4
CB 10150 X0 = PDL (0)
04 10160 Y0 = PDL (1)
78 10161 B1 = PEEK ( - 16287)
21 10162 IF B1 < 128 AND B0 = 3
       THEN B0 = 4
21 10163 IF B1 < 128 AND B0 = 2
       THEN B0 = 3
19 10164 IF B1 < 128 AND B0 = 1
       THEN B0 = 3
25 10165 IF B1 > 127 AND B0 = 2
       THEN B0 = 1
4D 10166 IF B1 > 127 AND B0 = 4
       THEN B0 = 2
21 10170 IF PEEK ( - 16384) > 12
       7 THEN 10440
A9 10180 Y0 = INT (Y0 / 10) + 1
8B 10190 X0 = INT (X0 / 6) + 1
32 20030 REM