I needed a different type of routine for number crunching instead of the TALLY routine. Basically, I needed an entire line to be treated as one value instead of half and half, and 1 needed some of the answer printed out if necessary. The following is the result. I call it the SUM routine and it is designed to accept numeric data on line 15 (last line). The restrictions on what type of characters can be used as numeric information is the same as for the tally routine. I use it to keep track of each student’s credit for a trip to Florida. Since many fundraising projects are required, I needed a full line to handle it all. The line gives the profit on each project so if line 15 shows this:
15.95+20+0+40.1+50
that would mean the student has made the following profit:
15.95 cheese sale
20.00 candy sale
00.00 car wash
40.10 fruit sale
50.00 cash payment
for a total of $126.05. This total would be shown in SUM2. SUM1 would show the combined profit of all found files. When printed out, SUM2 would be printed after the last line set up by the DEFP command. If you want a space between each file, put the space FIRST instead of last or the SUM2 will be printed after the space and right above the next file. Example: use 0/1 instead of 1/0. Activate the routine with the reverse slash followed by S.
150 LET B=USR VAL "64101": CLS : IF J$="S" AND Y AND T1 THEN LPRINT T0
1049 LET T0=T0-(T0 AND J$="S): IF E$(U, TO VAL "18")<>D$(H TO J+F) AND CODE J$>Q THEN GO TO VAL "8500"+CODE J$
7225 NEXT X: IF J$="S" AND Y$="C" THEN LPRINT T0
7229 IF J$="T" OR J$="S" THEN GO TO VAL "1049"+(Y$="C)
7235 IF Y AND A=O THEN GO TO J*K
8582 GO TO U
8583 GO TO VAL "9250"
9105 PRINT A J,O;"CNT=";T1;: IF J$="T" OR J$="S" THEN PRINT " SUM1=";T;" SUM2=";T0
9200 POKE VAL "63798",J+U: LET E$(U,U)=E$(U,U): IF USR VAL "63792" THEN LET T=T+VAL E$(U, TO J+U)
9210 IF Y AND (J$="T" OR J$="S") THEN GO TO J*K
9250 POKE VAL "63798",Q: LET E$(J,U)=E$(J,U): IF USR VAL "63792" THEN LET T=T+VAL E$(J): LET T0=VAL E$(J)
9260 GO TO VAL "9210"