Source:Snappy Maintenance
Jump to navigation
Jump to search
This page is a verbatim reproduction of original source material and should not be edited except for maintenance. | |
Description |
The Applesoft BASIC source code of the Eamon utility program Snappy Maintenance |
---|---|
Source | |
Date |
14 February 1984 |
Author | |
License |
The use of this item is permitted on the grounds that it's free or in the public domain. |
1 REM EAMON SNAPPY FILE
2 REM MAINTENANCE
3 REM
4 REM BY JOHN NELSON
5 REM
6 REM
7 REM MAINTAINS THE SNAPPY
PHRASE FILE USED BY THE
MAN AT THE DESK WHILE
LOOKING THROUGH HIS BOOK.
8 REM
9 REM 2-14-84
10 TEXT : HOME : VTAB 6: PRINT "INSERT MASTER DISKETTE AND PRESS ANY KEY": PRINT SPC( 12);"TO CONTINUE ...";: GET A$: PRINT
15 ONERR GOTO 10000
20 D$ = CHR$ (4): PRINT D$"OPEN SNAPPY,L64": PRINT D$"READ SNAPPY,R0": INPUT NS: PRINT D$
30 HOME : PRINT SPC( 12);"EAMON UTILITIES": PRINT SPC( 11);"SNAPPY MAINTENANCE": PRINT SPC( 12);"BY JOHN NELSON"
35 VTAB 8: PRINT "SELECT ACTION:": PRINT : PRINT " 1. ADD NEW PHRASE": PRINT : PRINT " 2. REPLACE OLD PHRASE": PRINT : PRINT " 3. LIST PHRASES": PRINT : PRINT " 4. QUIT"
40 PRINT : PRINT "INPUT YOUR CHOICE (1-4):";
50 GET A$: IF A$ > "4" OR A$ < "1" THEN GOTO 50
60 PRINT A$: ON VAL (A$) GOTO 1000,2000,3000,4000
100 PRINT : PRINT "ERROR...": STOP
600 REM === CREATE I$ ===
610 I$ = ""
620 PRINT I2$;: CALL - 958: IF LEN (I2$) THEN FOR A = 1 TO LEN (I2$): PRINT CHR$ (8);: NEXT
630 GET A$: IF A$ = CHR$ (13) THEN CALL - 958: PRINT : RETURN
640 IF (A$ > CHR$ (31) OR A$ = CHR$ (9) OR (A$ = CHR$ (21) AND NOT LEN (I2$))) AND LEN (I$) + LEN (I2$) > 250 THEN PRINT CHR$ (7);: GOTO 630
650 IF A$ > CHR$ (31) THEN PRINT A$;:I$ = I$ + A$:I2$ = MID$ (I2$,2): GOTO 630
660 IF A$ = CHR$ (5) THEN PRINT I2$;:I$ = I$ + I2$:I2$ = "": GOTO 630
670 IF A$ = CHR$ (2) AND LEN (I$) THEN FOR A = 1 TO LEN (I$): PRINT CHR$ (8);: NEXT :I2$ = I$ + I2$:I$ = "": GOTO 630
680 IF A$ = CHR$ (4) THEN I2$ = MID$ (I2$,2): GOTO 620
690 IF A$ = CHR$ (9) THEN I2$ = " " + I2$: GOTO 620
700 IF A$ = CHR$ (21) AND LEN (I2$) THEN A$ = LEFT$ (I2$,1): GOTO 650
710 IF A$ = CHR$ (21) THEN A$ = " ": GOTO 650
730 IF A$ = CHR$ (8) AND LEN (I$) > 1 THEN I2$ = RIGHT$ (I$,1) + I2$:I$ = LEFT$ (I$, LEN (I$) - 1): PRINT A$;: GOTO 630
740 IF A$ = CHR$ (8) AND LEN (I$) THEN I2$ = I$ + I2$: PRINT A$;: GOTO 600
750 IF A$ = CHR$ (8) THEN 600
760 IF A$ = CHR$ (27) THEN PRINT I2$:I$ = I$ + I2$: RETURN
770 GOTO 630
1000 REM /// ADD NEW PHRASE
1010 HOME : PRINT "INPUT PHRASE TO ADD:": PRINT "MUTTERING ABOUT ";:I2$ = "": GOSUB 600:PH$ = I$: IF LEN (PH$) > 63 THEN PRINT "TOO LONG!!": GOTO 1010
1020 NS = NS + 1: PRINT D$"WRITE SNAPPY,R";NS: PRINT PHR$: PRINT D$: GOTO 4500
2000 REM /// REPLACE PHRASE
2010 INPUT "WHICH PHRASE #:";P$: IF VAL (P$) > NS OR VAL (P$) < 1 THEN PRINT "NOT A VALID #": GOTO 2010
2020 IF VAL (P$) < > INT ( VAL (P$)) THEN PRINT "NOT A VALID #": GOTO 2010
2030 P = VAL (P$): PRINT D$"READ SNAPPY,R";P: INPUT PHR$: PRINT D$
2040 HOME : PRINT "INPUT PHRASE:": PRINT "MUTTERING ABOUT ";:I2$ = PHR$: GOSUB 600:PH$ = I$
2050 IF LEN (PHR$) > 63 THEN PRINT "TOO LONG!!": GOTO 2040
2060 PRINT D$"WRITE SNAPPY,R";P: PRINT PHR$: PRINT D$: GOTO 4500
3000 REM /// LIST PHRASES
3010 HOME : PRINT "HARDCOPY (Y/N):";
3020 GET A$: IF A$ < > "Y" AND A$ < > "N" THEN GOTO 3020
3030 PRINT A$: IF A$ = "Y" THEN PRINT D$"PR#1"
3035 HOME
3040 FOR P = 1 TO NS: PRINT D$"READ SNAPPY,R";P: INPUT PHR$:PP$ = "MUTTERING ABOUT " + PHR$: GOSUB 3500: PRINT "=======================================": NEXT
3050 PRINT D$"PR#0": GOTO 4500
3500 REM /// PRINT PHRASE
3510 PRINT LEFT$ (PP$,40): PRINT MID$ (PP$,41): PRINT : PRINT : RETURN
4000 PRINT D$"WRITE SNAPPY,R0": PRINT NS: PRINT D$"CLOSE"
4010 END
4500 PRINT : PRINT SPC( 7)"PRESS ANY KEY TO CONTINUE" SPC( 7);: GET A$: PRINT : GOTO 30
5000 REM /// INITIATE FILE
5010 D$ = CHR$ (4): PRINT D$"OPEN SNAPPY,L64": PRINT D$"WRITE SNAPPY,R0": PRINT 1
5020 PRINT D$"WRITE SNAPPY,R1": PRINT "STRANGE SAXON NAMES. NEVER CAN SPELL'EM NOR PRONOUNCE 'EM": PRINT D$"CLOSE"
5090 GOTO 20
10000 REM === ERROR ===
10020 ERR = PEEK (222):LIN = PEEK (218) + PEEK (219) * 256: IF ERR = 5 AND LIN = 20 THEN 11000
10050 HOME : VTAB 6: PRINT "AN ERROR HAS OCCURED. CANNOT CONTINUE."
10060 PRINT "ERROR CODE IS ";ERR;" ON LINE ";LIN
10090 END
11000 REM === NO FILE ===
11010 HOME : VTAB 6: PRINT "THERE IS NO SNAPPY FILE ON THIS DISKETTE": PRINT "DO YOU WISH TO CREATE ONE? (Y OR N):";
11020 GET A$: IF A$ < > "Y" AND A$ < > "N" THEN 11020
11030 PRINT A$: IF A$ = "N" THEN 10
11040 GOTO 5000