home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nibble Magazine
/
nib35b.dsk
/
AUA.DEMO.bas
< prev
next >
Wrap
BASIC Source File
|
2023-02-26
|
5KB
|
105 lines
10 REM **********************
20 REM * AUA.DEMO *
30 REM * BY DEAN PICKERING *
40 REM * COPYRIGHT (C) 1988 *
50 REM * BY MICROSPARC, INC *
60 REM * CONCORD, MA 01742 *
70 REM **********************
80 GOTO 60000: REM ATTACH THE CODE IF NECESSARY
90 REM LINES 100-110 MUST BE EXECUTED AFTER ANY PROGRAM
100 REM EDITING TO UPDATE THE AMPERSAND VECTOR
110 BASFIN = PEEK(175) +256 * PEEK(176)
120 DEC = PEEK(BASFIN -1): CALL BASFIN -DEC
130 :
140 REM --- "USING" WITH $ AND COMMAS
150 POKE 216,0: HOME : PRINT "PRINT USING DEMO, PART I": PRINT "USING DOLLARS AND COMMAS": POKE 34,6: REM - FREEZE HEADER
160 HOME
170 PRINT : PRINT : PRINT "ENTER YOUR ANNUAL INCOME"
180 PRINT "AND PRESS <RETURN>"
190 PRINT : PRINT "REMEMBER: APPLESOFT INPUT DOESN'T": PRINT "ALLOW COMMAS!": PRINT
200 PRINT "PRESS <RETURN> ALONE TO CONTINUE"
210 PRINT : INPUT "";IN$: IF IN$ = "" GOTO 290
220 PRINT : PRINT "YOUR INCOME IS";: & PRINT $,20,2, VAL(IN$): PRINT
230 PRINT "IN A LINE OF TEXT WITH NO LEADING"
240 PRINT "SPACES IT IS ";: & PRINT $,0,2, VAL(IN$);
250 PRINT " BEFORE TAX.": PRINT
260 PRINT "PRESS <RETURN> TO CONTINUE";: GET A$: GOTO 160
270 :
280 REM --- "USING" WITH TABULATED FIGURES
290 TEXT : HOME : PRINT "PRINT USING DEMO, PART II": PRINT "TABULATED FIGURES": POKE 34,6: PRINT : PRINT
300 REM 2, 5, 5, AND 8 SPACES IN NEXT
310 PRINT " X X * X SQR (X) 1 / X"
320 REM 1, 3, 3, AND 6 SPACES IN NEXT
330 PRINT " --- ------- --------- -------"
340 FOR X = 1 TO 10: & PRINT 3,0,X;: & PRINT 8,0,X *X;
350 & PRINT 7,6, SQR(X);1/X: NEXT : PRINT
360 PRINT "PRESS <RETURN> TO CONTINUE";: GET A$: TEXT : REM - UNFREEZE HEADER
370 :
380 REM --- "RESTORE" DEMO
390 DATA "TOM",DICK,"HARRY"
400 HOME : PRINT "RESTORE TO SELECTED DATA LIST": PRINT : PRINT
410 PRINT "ARE YOU MALE OR FEMALE? (M/F)";
420 GET SEX$: IF SEX$ = "M" OR SEX$ = CHR$(109) GOTO 450
430 IF SEX$ = "F" OR SEX$ = CHR$(102) GOTO 460
440 GOTO 420
450 & RESTORE GOTO 390: GOTO 470
460 & RESTORE GOTO 510
470 PRINT : FOR I = 1 TO 3: READ NAME$(I): NEXT
480 PRINT : PRINT "MAYBE YOUR NAME IS ";
490 PRINT NAME$(1);", "NAME$(2)" OR ";NAME$(3): PRINT
500 PRINT "PRESS <RETURN> TO CONTINUE";: GET A$
510 DATA "MARY",ELLEN,"ANNE"
520 :
530 REM --- "INPUT ANYTHING" DEMO
540 HOME : PRINT "INPUT ANYTHING DEMO": PRINT
550 PRINT "AS FOR APPLESOFT BUT WILL ACCEPT"
560 PRINT "COMMA, COLON, QUOTE ETC.": POKE 34,10
570 HOME : PRINT "INPUT A LINE AND PRESS <RETURN>"
580 PRINT "PRESS <RETURN> ONLY TO CONTINUE": PRINT
590 & INPUT LINE$: IF LINE$ = "" GOTO 620
600 PRINT : PRINT "YOUR LINE WAS ";LINE$
610 PRINT : PRINT "PRESS <RETURN> TO CONTINUE";: GET A$: GOTO 570
620 TEXT : REM - ERROR ON NULL INPUT, EXIT
630 :
640 REM --- "RESUME" DEMO
650 ONERR GOTO 760
660 HOME : PRINT "RESUME NEXT & RESUME GOTO DEMO"
670 PRINT : PRINT "INPUT A NUMBER AND ITS"
680 PRINT "RECIPROCAL WILL BE PRINTED"
690 PRINT : PRINT "FORCE ERRORS BY ENTERING ZERO"
700 PRINT "PRESS <RETURN> ONLY TO QUIT": POKE 34,10
710 HOME : INPUT "ENTER A NUMBER ";X$: IF X$ = "" THEN 880
720 X = VAL(X$):Y = 1/X: IF X = 0 THEN PRINT CHR$(7): GOTO 710
730 PRINT : PRINT "RECIPROCAL IS ";Y: GOTO 860
740 :
750 REM ----- ERROR HANDLING -----
760 EN = PEEK(222):EL = PEEK(218) +256 * PEEK(219)
770 REM --- DIVISION BY ZERO ERROR
780 IF EN = 133 THEN & RESUME NEXT
790 REM --- NULL LINE INPUT ERROR
800 IF EN = 254 THEN & RESUME GOTO 850
810 REM --- CNTL-C INTERRUPT ERROR
820 IF EN = 255 THEN & RESUME GOTO 850
830 REM --- ANY OTHER ERROR
840 PRINT "ERROR "EN" IN LINE "EL: END
850 PRINT : PRINT : PRINT CHR$(7)"NO NUMBER INPUT"
860 PRINT : PRINT "PRESS <RETURN> TO RESTART ";: GET A$: GOTO 710
870 :
880 TEXT : HOME : VTAB 23: END
60000 REM ***** ADD CODE
60010 ONERR GOTO 60080
60020 E = PEEK(175) +256 * PEEK(176)
60030 IF PEEK(E -2) THEN POKE 216,0: GOTO 110: REM CODE ALREADY PRESENT
60040 PRINT CHR$(4)"BLOAD AUA,A";E
60050 REM ADJUST NEXT LINE IF CODE LENGTH NOT 544
60060 LOMEM: PEEK(175) +256 * PEEK(176) +544
60070 POKE 175, PEEK(105): POKE 176, PEEK(106): CLEAR : RUN
60080 HOME : VTAB 23: HTAB 1: PRINT "ERROR OCCURRED WHILE": PRINT "BLOADING AUA": END
60090 :
61000 REM ***** REMOVE CODE
61010 X = PEEK(175) +256 * PEEK(176)
61020 REM ADJUST NEXT TWO LINES IF CODE NOT 22 AND 544
61030 IF PEEK(X -1) < >22 THEN PRINT "CODE NOT PRESENT": END
61040 X = X -544:H = INT(X/256):L = X -H *256
61050 POKE 175,L: POKE 176,H
61060 POKE 105, PEEK(175): POKE 106, PEEK(176): CLEAR : END