Recipe Multiplier (RECIPE.BAS)

Recipe Multiplier by James W. Brown, 166

Description

Recipe Multiplier by James W. Brown, 166

From the Antic disk of June 1986 (Vol. 5 No. 2).

From the Antic Software Archive at atarimagazines.com. The program remains the property of its author and publisher.

What is in this file

Atari BASIC program · 20.2 KB

Dialect
Atari BASIC
Lines
557
Variables
BRK, FRAC(, FR$, T$, TA$, E$, M$, EA$, MA$, ECON(, MCON(, UCON(, I$, ING$, INGUNX(, INGQUN(, RECIPE$, FILENAME$, CLEAR, NUMNOT, TITL$, CPRT$, CON(, THEME(, CH1(, CH2(, INDISK, WRAP, UO, I, F, J, ROW, COL, C, D, PRT, S1, UI, S2, M, A, I5, ING, QUAN, NING, I2, I15, INGX, INDX, IXWT, OXWT, VLWT, I1, N, UNDX, Q2, DIFMIN, BEST, DIFQ, IOCODE, K, T, ILEN
BASIC listing (557 lines)
10 REM RECIPE MULTIPLIER
20 REM BY JAMES W. BROWN
30 REM (c) 1986, ANTIC PUBLISHING
40 GRAPHICS 0:BRK=1:IF PEEK(53279)=5 THEN BRK=0
50 GOTO 100
60 IF BRK THEN POKE 16,112:POKE 53774,112:POKE 77,0
70 RETURN
100 DIM FRAC(22):REM DECIML FRACTIONS
101 DIM FR$(110):REM STRING FRACTIONS
102 DIM T$(5),TA$(15):REM INPT SCRTCH
103 DIM E$(45),M$(30):REM UNITS ABBRV
104 DIM EA$(135),MA$(90):REM UNITSTXT
105 DIM ECON(9),MCON(6):REM CONV FACT
106 DIM UCON(2):REM ENG TO MET VOL,WT
130 DIM I$(38):REM INPUT ING. SCRATCH
131 DIM ING$(1140):REM INGREDIENTS
132 DIM INGUNX(30):REM ING UNITS INDX
133 DIM INGQUN(30):REM ING QUANTITY
134 DIM RECIPE$(38):REM RECIPE NAME
135 DIM FILENAME$(15)
137 GOSUB 60:CLEAR=40000:REM CLEAR TRAPS
138 NUMNOT=56:REM # NOTES IN THEME
140 DIM TITL$(20),CPRT$(32),CON(52)
142 DIM THEME(NUMNOT),CH1(7),CH2(7)
200 DATA .125,.25,.33333,.375,.5,.625,.66667,.75,.875,1.,1.25,1.33333
202 DATA 1.5,1.66667,1.75,2.,2.25,2.33333,2.5,2.66667,2.75,3.
210 DATA 1/8  ,1/4  ,1/3  ,3/8  ,1/2  ,5/8  ,2/3  ,3/4  ,7/8  :REM NO QUOTS
212 DATA 1    ,1 1/4,1 1/3,1 1/2,1 2/3,1 3/4
214 DATA 2    ,2 1/4,2 1/3,2 1/2,2 2/3,2 3/4,3    :REM
220 DATA tsp. ,tbsp.,fl.oz,c.   ,pt.  ,qt.  ,gal. ,oz.  ,lb.  :REM ENGLISH
230 DATA ml.  ,cl.  ,dl.  ,l.   ,g.   ,kg.  :REM METRIC
240 DATA teaspoon(s)    :REM
241 DATA tablespoon(s)  :REM
242 DATA fluid ounces   :REM
243 DATA cup(s)         :REM
244 DATA pint(s)        :REM
245 DATA quart(s)       :REM
246 DATA gallon(s)      :REM
247 DATA ounce (net wt.):REM
248 DATA pound(s)       :REM
250 DATA milliliter (ml):REM
251 DATA centiliter     :REM
252 DATA deciliter      :REM
253 DATA liter          :REM
254 DATA gram (g or gm.):REM
255 DATA kilogram (kilo):REM
260 DATA 1,3,6,48,96,192,768,1,16
270 DATA 1,10,100,1000,1,1000
310 DATA -32,0,0,128,160,32,0,128,-32,0,0,0,32,128,160,128,160,0,32,160
311 DATA 0,128,160,32,0,128,0,32,0,128,160,32,0,128,0,-32
312 DATA -32,128,160,32,128,160,-32,128,128,-32,128,160,32,128,160,0
314 REM NOTES FOR THEME--
315 DATA 121,96,81,60,40,47,40,60,91,72,60,45,29,35,29,45
316 DATA 243,193,162,121,81,96,81,121,182,144,121,108,121,108,91,182
317 DATA 121,108,96,91,81,72,64,60,60,64,72,81,91,96,108,121
318 DATA 121,108,96,91,81,72,64,121
320 DATA 243,182,60,45,243,60,243
321 DATA 193,144,47,35,193,47,193
1000 REM MAIN PROGRAM
1010 GOSUB 1100:REM LOAD ARRAYS
1015 GOSUB 1200:REM TITL SCREEN
1020 GOSUB 1300:REM INTRO
1025 GOSUB 1400:REM STEP 1-INP.UNITS
1027 IF INDISK>0 THEN GOSUB 3000:GOTO 1035
1030 GOSUB 1600:REM STEP 2-ENTER RECP
1035 GOSUB 1500:REM STEP 3-MULTIPLIER
1040 GOSUB 2500:REM STEP 4-OUT.UNITS
1045 GOSUB 2600:REM STEP 5-NEW RECIPE
1050 GOSUB 2900:REM WRAPUP MENU
1055 ON WRAP GOTO 1045,1075,1080,1085,1020,1065,1070,1095
1060 END
1065 GOSUB 3500:GOTO 1050:REM SAVE
1070 GOSUB 3100:GOTO 1050:REM PRINT
1075 GOSUB 1500:GOTO 1045:REM CHG MULT, RECOMPUTE
1080 UO=3-UO:GOTO 1045:REM CHANGE OUTPUT UNITS METRIC<->ENGLISH
1085 GOSUB 7000:GOTO 1050:REM CHANGE AN INGREDIENT
1095 GOSUB 1200:REM FINALE
1099 END
1100 REM LOAD ARRAYS
1102 POKE 752,1:POSITION 10,10:? ">";
1105 RESTORE 200:FOR I=1 TO 22:READ F:FRAC(I)=F:NEXT I:? ">";
1110 RESTORE 210:FOR I=1 TO 22:READ T$:FR$(5*I-4)=T$:NEXT I:? ">";
1115 RESTORE 220:FOR I=1 TO 9:READ T$:E$(5*I-4)=T$:NEXT I:? ">";
1120 RESTORE 230:FOR I=1 TO 6:READ T$:M$(5*I-4)=T$:NEXT I:? ">";
1125 RESTORE 240:FOR I=1 TO 9:READ TA$:EA$(15*I-14)=TA$:NEXT I:? ">";
1130 RESTORE 250:FOR I=1 TO 6:READ TA$:MA$(15*I-14)=TA$:NEXT I:? ">";
1135 RESTORE 260:FOR I=1 TO 9:READ F:ECON(I)=F:NEXT I:? ">";
1140 RESTORE 270:FOR I=1 TO 6:READ F:MCON(I)=F:NEXT I:? ">";
1145 RESTORE 310:FOR I=1 TO 52:READ J:CON(I)=J:NEXT I:? ">";
1150 RESTORE 315:FOR I=1 TO NUMNOT:READ J:THEME(I)=J:NEXT I:? ">";
1155 RESTORE 320:FOR I=1 TO 7:READ J:CH1(I)=J:NEXT I:? ">";
1157 RESTORE 321:FOR I=1 TO 7:READ J:CH2(I)=J:NEXT I:? ">";
1160 UCON(0)=1:ECON(0)=1:MCON(0)=1
1165 UCON(1)=943.6/192:REM ML/TSP
1170 UCON(2)=454/16:REM G/OZ
1175 FILENAME$="P:":? ">"
1180 GOSUB 60
1185 TITL$="  RECIPE  MULTIPLIER"
1190 CPRT$=" ANTIC MAGAZINE  JAMES W. BROWN "
1199 RETURN
1200 REM TITLE PAGE
1220 GRAPHICS 18:ROW=2:GOSUB 60
1230 FOR I=1 TO 20:COL=I+4
1235 IF I>10 THEN COL=COL-10:ROW=4
1240 COLOR ASC(TITL$(I))+CON(I)
1245 PLOT COL,ROW
1250 NEXT I
1255 ROW=8
1260 FOR I=1 TO 32:COL=I+1
1265 IF I>16 THEN COL=COL-16:ROW=10
1270 COLOR ASC(CPRT$(I))+CON(I+20)
1275 PLOT COL,ROW
1278 NEXT I
1280 FOR C=1 TO NUMNOT
1281 I=INT((C+7)/8)
1282 SOUND 0,THEME(C),10,8
1283 SOUND 1,CH1(I),10,8:SOUND 2,CH2(I),10,8
1285 SETCOLOR 0,C,8:SETCOLOR 1,C+2,8:SETCOLOR 2,C+4,8:SETCOLOR 3,C+6,8
1290 FOR D=1 TO 16:NEXT D
1295 NEXT C
1298 FOR I=0 TO 2:SOUND I,0,0,0:NEXT I
1299 RETURN
1300 GRAPHICS 0:POKE 752,1:GOSUB 60:REM INTRO
1305 ? "↰RECIPE MULTIPLIER helps you increase":? "or decrease your favorite recipes."
1310 ? :? "Here are the steps:":?
1315 ? "1. Decide whether the original recipe"
1316 ? "   uses English or Metric units.":?
1320 ? "2. Enter the recipe into the computer"
1321 ? "   (Enter up to 30 ingredients.)":?
1325 ? "3. Decide by how much you want to"
1326 ? "   increase or decrease the recipe.":?
1330 ? "4. Decide whether you want the new"
1331 ? "   version in English or Metric.":?
1335 ? "5. The computer will give you the new"
1336 ? "   recipe quantities. Jot them down"
1337 ? "   in the margin of your cookbook.":?
1340 PRT=0:CLOSE #3:S1=0:INDISK=0
1345 GOSUB 8010
1355 ? "↰PRELIMINARIES":?
1360 ? "Before beginning, you will find it":? "helpful to examine your recipe to"
1365 ? "find ALL the ingredients. Most cook-":? "books are careful to list all the"
1370 ? "ingredients in one place. However,":? "sometimes you will find a few hiding"
1375 ? "down in the cooking instructions."
1380 ? :? "When you have found all the ingre-":? "dients, mark each one with a number,"
1385 ? "starting with 1. This will help you":? "keep track of where you are.":?
1399 GOSUB 8010:RETURN
1400 REM INPUT UNITS
1405 ? "↰SELECT INPUT UNITS":?
1410 ? "If your original recipe is in"
1415 ? "U.S. (ENGLISH) units,       enter  E ":?
1420 ? "If it is in METRIC units,   enter  M ":?
1422 ? "To load a recipe from DISK, enter  D ":?
1425 ? "If you need HELP to decide, enter  H ":?
1430 ? "(Enter only one letter.)":?
1435 ? "Always press RETURN after every entry."
1440 GOSUB 8100
1445 IF T$="E" THEN UI=1:RETURN
1450 IF T$="M" THEN UI=2:RETURN
1455 IF T$="D" THEN INDISK=1:RETURN
1460 IF T$<>"H" THEN GOSUB 8030:GOTO 1400
1470 REM HELP FOR ENGLISH/METRIC/DISK
1472 ? "↰If your recipe contains things like":? "cups, ounces, pounds, or teaspoons,"
1474 ? "it is ENGLISH.":?
1476 ? "If it contains things like grams,":? "kilograms (kilos), milliliters (ml),"
1478 ? "liters, it is METRIC.":?
1480 ? "If there are some of each, take your":? "cookbook back to the bookstore for a"
1482 ? "refund.  The recipes are probably":? "no good anyway.":?
1484 ? "If you have previously used this":? "program to save a recipe to disk,"
1486 ? "you can read it back and work on it.":?
1490 GOSUB 8010:GOTO 1400
1500 REM MULTIPLIER
1505 ? "↰CHOOSE MULTIPLIER":?
1507 ? "Here you must decide how much you":? "want to increase or decrease your"
1508 ? "recipe by.  For example, if you want":? "to double it, the multiplier is 2.":?
1510 ? "There are two ways to choose the":? "multiplier:":?
1515 ? "Enter  M  if you know what multiplier":? "          you want, or":?
1520 ? "Enter  S  if you know how many":? "          servings you want.":?
1525 GOSUB 8100
1526 IF T$="M" THEN 1550
1527 IF T$<>"S" THEN GOSUB 8030:GOTO 1500
1530 REM BY SERVINGS
1532 S2=1:IF S1>0 THEN 1540
1534 S1=1
1535 ? "↰":? :? "How many servings does your":? "original recipe make";
1537 TRAP 1590:INPUT S1:TRAP CLEAR
1538 IF S1<1 THEN ? "PLEASE ENTER A NUMBER AT LEAST 1.":GOSUB 8030:GOTO 1530
1540 ? :? "How many servings do you want":? "to make";
1542 TRAP 1595:INPUT S2:TRAP CLEAR
1543 IF S2<1 THEN ? "PLEASE ENTER A NUMBER AT LEAST 1.":GOSUB 8030:GOTO 1540
1545 M=S2/S1:GOTO 1598
1550 REM BY NUMBER
1555 ? "↰Select the multiplier you want by":? "entering the letter in front of it:":?
1559 A=ASC("A")
1560 FOR I=1 TO 11:I5=I*5
1562 ? CHR$(I-1+A);"- ";FR$(I5-4,I5);"      ";CHR$(I+10+A);"- ";FR$(I5+51,I5+55)
1564 NEXT I
1566 ? "              W-Enter as a decimal":?
1568 ? "Letter for selection";:T$="?":GOSUB 8100
1570 IF T$>="A" AND T$<="V" THEN M=FRAC(ASC(T$)-A+1):GOTO 1598
1575 IF T$<>"W" THEN GOSUB 8030:GOTO 1550
1580 ? "How much do you want to":? "multiply the recipe by";
1582 TRAP 1596:INPUT M:TRAP CLEAR
1585 GOTO 1598
1590 TRAP CLEAR:GOSUB 8020:GOTO 1535
1595 TRAP CLEAR:GOSUB 8020:GOTO 1540
1596 TRAP CLEAR:GOSUB 8020:GOTO 1580
1598 ? :? "The multiplier is ";M:GOSUB 8000
1599 RETURN
1600 REM RECIPE
1605 PRINT "↰ENTER RECIPE":?
1610 ? "In this step you will enter the":? "ingredients for your recipe:"
1615 ? :? "-Enter the AMOUNT of each ingredient."
1617 ? :? "-Enter the UNITS it is measured with."
1620 ? :? "-Enter the NAME, so you will know":? " what the later results mean."
1622 ? :? "-Verify or modify the entry.  If you":? " make a mistake, you will have a"
1625 ? " chance to fix it before going on.":? " You will also have a chance to make"
1627 ? " changes at the end, and review the":? " results."
1630 ? :? "There will be a separate screen to":? "lead you through each of these steps.":?
1635 GOSUB 8010
1640 ? "↰":? :? "Each ingredient has 3 parts--":?
1642 ? "Quantity"
1644 ? " |      Units"
1646 ? " |      |    Name"
1648 ? "─┴──  ──┴─   ┴────────── "
1650 ? " 1/2  cup    sugar"
1652 ? " 3           eggs"
1654 ? " 1/8  tsp.   salt"
1656 ? " 1           can condensed milk"
1658 ? :? "Notice that some items do not":? "have units (eggs, can, etc.)."
1660 ? "When you have things like this,":? "select 'piece' for the units."
1665 ? :GOSUB 8010:PRT=0:ING=1
1670 REM INGREDIENT LOOP
1675 GOSUB 7100:REM ENTER AN INGRED.
1677 IF QUAN=0 THEN ING=ING-1:GOTO 1699
1680 IF ING>=30 THEN 1699
1685 ING=ING+1:GOTO 1670
1699 NING=ING:RETURN
1700 REM QUANTITY
1705 ? "↰QUANTITY FOR INGREDIENT ";ING:?
1710 ? "Select the quantity you want by":? "entering the letter in front of it:":?
1714 A=ASC("A")
1715 FOR I=1 TO 11:I5=I*5
1720 ? CHR$(I-1+A);"- ";FR$(I5-4,I5);"      ";CHR$(I+10+A);"- ";FR$(I5+51,I5+55)
1725 NEXT I
1730 ? "              W-Enter as a decimal"
1735 ? "              X-Show previous entry"
1740 ? "              Z-No more ingredients"
1750 A=ASC("A")
1755 ? :? "Letter for selection";:GOSUB 8100
1760 IF T$>="A" AND T$<="V" THEN QUAN=FRAC(ASC(T$)-A+1):GOTO 1798
1765 IF T$<>"X" THEN 1770
1766 IF ING<2 THEN ? "THERE IS NO PREVIOUS INGREDIENT.":GOSUB 8030:GOTO 1700
1768 ING=ING-1:GOSUB 2100:GOSUB 8010:ING=ING+1:GOTO 1700
1770 IF T$="Z" THEN QUAN=0:GOTO 1799
1775 IF T$<>"W" THEN ? "Please enter one of the letters above.":GOSUB 8030:GOTO 1750
1780 ? "What is the quantity";
1782 TRAP 1790:INPUT QUAN:TRAP CLEAR
1785 GOTO 1798
1790 TRAP CLEAR:GOSUB 8020:GOTO 1780
1798 ? "The quantity is ";QUAN:GOSUB 8000
1799 RETURN
1900 REM GET UNITS
1905 ? "↰ENTER UNITS FOR INGREDIENT ";ING:?
1910 ? "Select the measuring unit you want by":? "entering the letter in front of it:":?
1915 A=ASC("A"):I2=12-3*UI:REM LOOP LIMIT 6 FOR METRIC, 9 FOR ENGLISH
1920 FOR I=1 TO I2
1922 I15=I*15:TA$=EA$(I15-14,I15)
1923 IF UI=2 THEN TA$=MA$(I15-14,I15)
1925 ? CHR$(I-1+A);"- ";TA$
1930 NEXT I
1940 ? "P- piece (or can, etc.)"
1950 ? :? "Letter for units";:GOSUB 8100
1955 I2=I2+A-1
1960 IF T$>="A" AND T$<=CHR$(I2) THEN INGX=ASC(T$)-A+1:RETURN
1970 IF T$="P" THEN INGX=0:RETURN
1980 GOSUB 8030:GOTO 1900
2100 REM DISPLAY INGREDIENT(ING)
2110 I5=INGUNX(ING)*5
2112 I$=ING$(ING*38-37,ING*38)
2115 IF I5=0 THEN T$="piece":GOTO 2135
2120 IF UI=2 THEN T$=M$(I5-4,I5):GOTO 2135
2130 T$=E$(I5-4,I5)
2135 IF PRT=0 THEN ? "#";ING," - ";INGQUN(ING);" ";T$;" of --":? I$
2140 IF PRT=1 THEN PRINT #3;"#";ING," - ";INGQUN(ING);" ";T$;" of ";I$
2199 RETURN
2200 REM GET INGREDIENT NAME
2205 ? "↰NAME OF INGREDIENT ";ING:?
2210 ? "To save time, you can abbreviate the":? "name of the ingredient.  The computer"
2215 ? "does not know the difference between":? "an 'EGG, LIGHTLY BEATEN', and":? "an 'EG'.":?
2220 ? "This part of the entry is just to":? "help you keep things straight.":?
2230 ? "Using one line only,":? "enter the ingredient --":?
2240 TRAP 2290:INPUT I$:TRAP CLEAR
2250 GOSUB 8200:RETURN
2290 TRAP CLEAR:GOSUB 8030:GOTO 2230
2500 REM OUTPUT UNITS
2505 ? "↰SELECT OUTPUT UNITS":?
2510 ? "If you want the new recipe in"
2515 ? "U.S. (ENGLISH) units,     enter  E ":?
2520 ? "If you want METRIC units, enter  M "
2525 ?
2535 ? "Always press RETURN after every entry."
2540 GOSUB 8100
2545 IF T$="E" THEN UO=1:RETURN
2547 IF T$="M" THEN UO=2:RETURN
2548 ? :? "PLEASE ENTER  E  OR  M "
2549 GOSUB 8030:GOTO 2500
2600 REM NEW RECIPE
2605 ? "↰NEW RECIPE"
2606 IF NING<1 THEN ? :? "YOU HAVE NOT ENTERED ANY INGREDIENTS.":GOSUB 8030:GOTO 2699
2610 ? :? "The new recipe will be displayed":? "one ingredient at a time, using"
2612 ? "several different combinations of":? "quantity and units.  All of these"
2614 ? "will be approximately equivalent.":? "(You should be aware that most recipe"
2616 ? "quantities are only approximate.)"
2620 ? :? "Jot down the one combination you":? "feel most comfortable with for each":? "ingredient.":?
2630 GOSUB 8010:PRT=0:GOSUB 3200
2699 RETURN
2700 REM DISPLAY COMBINATIONS OF UNITS
2705 IF PRT=0 THEN ? "QUANTITY      UNITS":?
2710 INDX=INGUNX(ING)
2712 QUAN=INGQUN(ING)*M
2714 IXWT=11-3*UI:OXWT=11-3*UO
2716 VLWT=1:IF INDX>=IXWT THEN VLWT=2
2720 IF INDX=0 THEN VLWT=0
2726 IF UI=1 THEN QUAN=QUAN*ECON(INDX)
2728 IF UI=2 THEN QUAN=QUAN*MCON(INDX)
2730 ON UI-UO+2 GOTO 2732,2738,2734
2732 QUAN=QUAN*UCON(VLWT):GOTO 2738
2734 QUAN=QUAN/UCON(VLWT)
2738 REM QUAN IN OUTPUT BASE UNITS
2740 ON VLWT+1 GOTO 2742,2744,2746
2742 I1=0:I2=0:GOTO 2748
2744 I1=1:I2=OXWT-1:GOTO 2748
2746 I1=OXWT:I2=I1+1
2748 REM I1,I2 UNITS LIMITS
2749 N=0
2750 FOR UNDX=I1 TO I2
2752 IF UO=1 THEN Q2=QUAN/ECON(UNDX)
2753 IF UO=2 THEN Q2=QUAN/MCON(UNDX)
2755 IF Q2>0.05 THEN 2760
2756 IF UNDX=I1 AND PRT=0 THEN ? "Tiny pinch":GOTO 2795
2757 IF UNDX=I1 THEN PRINT #3;" Tiny pinch"
2758 GOTO 2795
2760 IF Q2>(985*UO-970) AND UNDX<I2 THEN 2795
2765 GOSUB 2800:REM FIND CLOSEST FRAC
2770 IF PRT=1 THEN PRINT #3;" ";T$,"    ";
2772 IF PRT=0 THEN ? " ";T$,"    ";
2775 I5=UNDX*5:I15=I5*3:N=N+1
2780 IF UNDX=0 THEN T$="piece":TA$="":GOTO 2790
2782 IF UO=1 THEN T$=E$(I5-4,I5):TA$=EA$(I15-14,I15)
2784 IF UO=2 THEN T$=M$(I5-4,I5):TA$=MA$(I15-14,I15)
2790 IF PRT=1 THEN PRINT #3;T$;"--";TA$
2792 IF PRT=0 THEN ? T$;"--";TA$
2795 NEXT UNDX
2797 IF PRT=0 THEN ?
2798 IF PRT=1 THEN PRINT #3
2799 RETURN
2800 REM T$ = CLOSEST FRAC TO Q2
2805 DIFMIN=5:BEST=0:T$="pinch"
2807 IF UO=2 THEN I$=STR$(INT(100*Q2+0.5)/100):GOSUB 8200:T$=I$(1,5):RETURN
2810 IF Q2>0.05 AND Q2<0.8*FRAC(1) THEN T$="1/16 "
2815 IF Q2<0.8*FRAC(1) THEN 2899
2820 IF Q2>1.1*FRAC(22) THEN 2880
2825 FOR I=1 TO 22
2830 DIFQ=ABS(Q2-FRAC(I))
2840 IF DIFQ<DIFMIN THEN DIFMIN=DIFQ:BEST=I
2845 NEXT I
2850 IF BEST>0 AND DIFMIN<0.3 THEN I5=BEST*5:T$=FR$(I5-4,I5)
2870 GOTO 2899
2880 REM HANDLE BIGGER STUFF
2885 IF Q2>9.6 THEN T$=STR$(INT(Q2+0.5)):GOTO 2899
2890 T$=STR$(INT(4*Q2)/4)
2899 RETURN
2900 REM WRAPUP
2905 ? "↰ALL FINISHED":?
2910 ? "What do you want to do next?"
2915 ? :? "A- Show the new recipe again."
2920 ? :? "B- Change multiplier and recompute."
2925 ? :? "C- Change the new recipe from "
2927 TA$="ENGLISH":I$="METRIC"
2928 IF UO>1 THEN TA$="METRIC":I$="ENGLISH"
2930 ? "   ";TA$;" to ";I$;"."
2935 ? :? "D- Change an ingredient."
2940 ? :? "E- Start over with a new recipe."
2945 ? :? "F- Save recipe to disk."
2950 ? :? "G- Print recipe."
2955 ? :? "H- Get back to the kitchen."
2960 ? :? "Letter for selection";:GOSUB 8100
2965 A=ASC("A")
2970 IF T$>="A" AND T$<="H" THEN WRAP=ASC(T$)-A+1:GOTO 2999
2995 GOSUB 8030:GOTO 2900
2999 RETURN
3000 REM READ A RECIPE FROM DISK
3005 IOCODE=4:GOSUB 4000
3010 IF IOCODE=0 THEN 3090
3015 TRAP 3070
3020 INPUT #3,UI,S1,NING,RECIPE$
3025 TRAP CLEAR
3027 ? "Reading recipe:":? RECIPE$:?
3030 FOR ING=1 TO NING
3035 TRAP 3070:INPUT #3,QUAN,UNDX,I$
3040 TRAP CLEAR:GOSUB 60
3045 INGQUN(ING)=QUAN
3050 INGUNX(ING)=UNDX
3055 ING$(ING*38-37,ING*38)=I$
3060 NEXT ING
3065 GOSUB 8010
3069 CLOSE #3:RETURN
3070 TRAP CLEAR
3075 ? :? "FILE READ ERROR.  THE FILE MAY NOT"
3080 ? "BE A RECIPE MULTIPLIER FILE."
3090 NING=0:S1=0:RECIPE$=""
3095 CLOSE #3:GOSUB 8030
3099 RETURN
3100 REM PRINT RECIPE
3105 GOSUB 3700:IF NING=0 THEN 3199
3110 CLOSE #3:TRAP 3190:FILENAME$="P:"
3115 ? :? "POSITION PAPER TO TOP OF FORM.":GOSUB 8010
3120 OPEN #3,8,0,"P:":TRAP CLEAR:GOSUB 60
3125 PRINT #3:PRINT #3
3130 PRINT #3;RECIPE$:PRINT #3
3135 PRINT #3;"Original makes ";S1;" servings."
3140 PRINT #3;"Conversion makes ";M*S1;" servings."
3180 PRT=1:GOSUB 3200:PRT=0:CLOSE #3:GOSUB 60:RETURN
3190 TRAP CLEAR:IOCODE=8:GOSUB 8300
3195 IF IOCODE=8 THEN 3110
3199 RETURN
3200 REM CONVERTED RECIPE
3210 FOR ING=1 TO NING
3212 I$=ING$(ING*38-37,ING*38)
3215 IF PRT=0 THEN ? "↰INGREDIENT ";ING:? :? I$:? :GOTO 3235
3220 PRINT #3:PRINT #3;"------- INGREDIENT ";ING;" -------"
3230 PRINT #3;I$:PRINT #3
3235 I15=INGUNX(ING)*15
3240 IF I15=0 THEN TA$="piece":GOTO 3255
3245 IF UI=1 THEN TA$=EA$(I15-14,I15)
3250 IF UI>1 THEN TA$=MA$(I15-14,I15)
3255 IF PRT=0 THEN ? INGQUN(ING);" ";TA$:? "    multiplied by ";M:? "    converts to any of:":? :GOTO 3280
3260 PRINT #3;INGQUN(ING);" ";TA$;" multiplied by ";M;" converts to any of:":PRINT #3
3280 GOSUB 2700:IF PRT=0 THEN GOSUB 8010
3290 NEXT ING
3299 RETURN
3500 REM WRITE RECIPE TO DISK
3502 GOSUB 3700:IF NING=0 THEN RETURN
3505 IOCODE=8:GOSUB 4000
3510 IF IOCODE=0 THEN RETURN
3515 TRAP 3580
3520 PRINT #3;UI;",";S1;",";NING;",";RECIPE$
3530 FOR ING=1 TO NING
3540 PRINT #3;INGQUN(ING);",";INGUNX(ING);",";ING$(ING*38-37,ING*38)
3560 NEXT ING
3570 TRAP CLEAR:CLOSE #3:GOSUB 60:RETURN
3580 TRAP CLEAR:CLOSE #3:GOSUB 60
3585 ? :? "FILE WRITE ERROR.  CODE ";PEEK(195)
3590 GOSUB 8030:RETURN
3700 REM CHECK RECIPE READY
3705 IF NING>0 THEN 3720
3710 ? :? "NO RECIPE IN MEMORY.  YOU MUST ENTER"
3712 ? "A RECIPE BEFORE YOU CAN SAVE OR PRINT IT."
3715 GOSUB 8030:RETURN
3720 IF UI=1 OR UI=2 THEN 3740
3725 ? :? "YOU MUST SPECIFY WHETHER THE RECIPE"
3727 ? "IS IN ENGLISH OR METRIC UNITS."
3730 GOSUB 8030:GOSUB 1400
3740 IF S1>0 THEN 3760
3742 S1=1
3745 ? "↰":? :? "How many servings does your":? "original recipe make";
3750 TRAP 3780:INPUT S1:TRAP CLEAR
3755 IF S1<1 THEN ? "PLEASE ENTER A NUMBER AT LEAST 1.":GOSUB 8030:GOTO 3742
3760 IF LEN(RECIPE$)>0 THEN RETURN
3762 ? "↰Using one line only,":? "enter the name of this recipe:"
3765 TRAP 3790:INPUT I$:TRAP CLEAR
3770 GOSUB 8200:RECIPE$=I$:RETURN
3780 TRAP CLEAR:GOSUB 8020:GOTO 3745
3790 TRAP CLEAR:GOSUB 8030:GOTO 3760
4000 REM OPEN DISK FILE
4010 ? "↰FILE SELECTION":?
4020 ? "Enter a file name up to 8 characters":? "long, with an optional extender."
4030 ? "Include the disk drive number.":? :? "For example:  D1:BEEFSTEW.REC":?
4040 ? "File name";:INPUT FILENAME$:IF LEN(FILENAME$)<3 THEN 4010
4050 TRAP 4090:CLOSE #3
4060 CLOSE #3:OPEN #3,IOCODE,0,FILENAME$
4070 TRAP CLEAR:GOSUB 60:RETURN
4090 TRAP CLEAR:CLOSE #3:GOSUB 8300
4098 IF IOCODE<>0 THEN 4040
4099 RETURN
7000 REM CHANGE AN INGREDIENT
7005 ? "↰ #  INGREDIENT":?
7010 IF NING=0 THEN ? "THERE ARE NO INGREDIENTS.":GOSUB 8030:RETURN
7020 FOR I=1 TO NING
7030 ? I;"- ";ING$(I*38-37,I*38-5)
7035 NEXT I
7040 ? NING+1;"- Add another ingredient"
7050 ? :? "What is the number of the ingredient":? "you want to change";
7060 TRAP 7090:INPUT ING:TRAP CLEAR
7065 IF ING<1 OR ING>NING+1 THEN ? "Please enter a number from the list.":GOSUB 8030:GOTO 7000
7070 IF ING=NING+1 THEN NING=ING
7080 GOSUB 7100:RETURN
7090 TRAP CLEAR:GOSUB 8020:GOTO 7000
7100 REM ENTER INGREDIENT #ING
7110 GOSUB 1700:IF QUAN=0 THEN 7199
7120 INGQUN(ING)=QUAN
7130 GOSUB 1900:INGUNX(ING)=INGX
7135 GOSUB 2200
7145 ING$(ING*38-37,ING*38)=I$
7150 ? "↰INGREDIENT ";ING:?
7155 GOSUB 2100
7160 POKE 752,0:? :? "Enter  Y  if OK, or"
7165 ? :? "Enter  N  to change."
7170 ? :? "OK  ←←";:GOSUB 8100
7172 IF  NOT (T$="Y" OR T$="N") THEN ? "↑↑↑↑↑↑";:GOTO 7160
7175 IF T$<>"Y" THEN 7100
7199 POKE 752,1:RETURN
8000 REM DELAY
8001 SETCOLOR 4,12,8:REM GREEN BORDER
8002 FOR K=1 TO 16
8003 SOUND 0,THEME(K),10,4
8004 FOR D=1 TO 4:NEXT D
8005 NEXT K
8007 SETCOLOR 4,0,0:SOUND 0,0,0,0
8009 RETURN
8010 REM WAIT FOR RETURN
8011 SETCOLOR 4,8,10:REM BLUE BORDER
8012 ? "Press  RETURN  when ready--"
8014 INPUT #16,T$:SETCOLOR 4,0,0
8019 GOSUB 60:RETURN
8020 REM NUMERIC ERROR
8025 ? "Please enter a decimal number."
8030 REM ANY ERROR
8035 SETCOLOR 4,4,6:REM RED BORDER
8040 FOR K=1 TO 8
8045 SOUND 0,136+10*K,10,8
8050 FOR D=1 TO 8:NEXT D
8055 NEXT K
8060 SETCOLOR 4,0,0:SOUND 0,0,0,0
8099 RETURN
8100 REM INPUT LETTER TO T$
8110 TRAP 8190:POKE 702,64:REM FORCE CAPS
8115 POKE 694,0:REM CLEAR INVERSE FLAG
8117 POKE 752,0:INPUT T$:TRAP CLEAR
8120 IF LEN(T$)<>1 THEN 8190
8130 T=ASC(T$):IF T>128 THEN T=T-128:T$=CHR$(T):REM CLEAR INVERSE VIDEO
8140 IF T$>="A" AND T$<="Z" THEN 8199
8190 TRAP CLEAR:? "Please enter a single letter.":GOSUB 8030
8196 GOTO 8100
8199 SETCOLOR 4,0,0:POKE 752,1:RETURN
8200 REM EXTEND I$ WITH BLANKS
8210 ILEN=LEN(I$)+1
8220 IF ILEN>38 THEN RETURN
8230 I$(ILEN)=" ":GOTO 8210
8300 REM OPEN ERROR
8310 ? :? "FILE OPEN ERROR.  CHECK DEVICE ";FILENAME$(1,2)
8320 ? "ERROR CODE IS ";PEEK(195)
8330 GOSUB 8030
8340 ? :? "To abandon, enter  A "
8350 ? :? "To retry,   enter  R "
8360 GOSUB 8100:IF T$="A" THEN IOCODE=0
8399 RETURN