ENORO

Date: 1988
Type: Program
Platform(s): TS 2068
Tags: Home

ENORO is a currency and metric conversion utility designed to help American travelers shopping or vacationing in Mexico, centered on the U.S. dollar-to-peso exchange rate. The program prompts the user to enter the current exchange rate (defaulting to 2,300 pesos per dollar as of January 1988), calculates equivalent peso amounts for a given number of dollars, and then allows repeated price-in-pesos to U.S.-dollar conversions. A built-in reference table of 1988 Mexican prices is displayed mid-program via a GOSUB at line 100. A secondary metric conversion module (lines 700–890) covers length, volume, and weight in both directions, with eight selectable unit categories and an optional COPY output. The program plays the “Mexican Hat Dance” melody using BEEP, driven by a DATA-based note sequence read into arrays, and loads a pre-saved SCREEN$ graphic at startup.


Program Structure

ENORO is organized into several functional blocks accessed via GO SUB:

  • Lines 1–85: Main flow — introduction text, exchange rate input, peso equivalence calculation, price conversion loop.
  • Lines 100–127: Reference price table subroutine, using PAUSE 0 with a keypress prompt between screens.
  • Lines 128–150: Closing sequence — SOUND fanfare, metric teaser, “EN ORO” etymology, then music replay and STOP.
  • Lines 200–600: Music engine — initializes arrays, reads tempo and title, plays notes via BEEP from DATA, returns on sentinel -1,-1.
  • Lines 700–890: Metric conversion module — menu-driven with eight unit categories; dispatches via computed GO SUB WHERE.
  • Lines 9997–9999: Save/reload utility for the program and its associated SCREEN$ file.

Exchange Rate and Conversion Logic

The program stores user input as strings (P$, D$, C$) and applies VAL at calculation time, a common BASIC idiom for flexible numeric input with empty-string guards. The key rate formula at line 20 computes VALP = 100 / VAL P$, yielding the peso’s value in U.S. cents. Line 70 then converts a peso price back to dollars via ORO = VALP / 100 * VAL C$. The default exchange rate of 2,300 pesos per dollar is hard-coded as a fallback at line 15, reflecting the January 1988 rate embedded throughout the reference table text.

Music Engine (Lines 200–600)

The music system is a data-driven BEEP player adapted from a third-party “Mexican Hat Dance” arrangement. Its structure is notable:

  • Line 200 does GO TO 330 past the REM, bypassing the comment; this is the entry point for initialization.
  • Lines 330–480 initialize a DIM k(26) array from data at line 490 (not present in the listing — likely missing or elsewhere), set tempo t and title s$ from line 500, then fall into the note reader at line 210.
  • Line 210 reads note value V and duration W from DATA. A sentinel pair -1,-1 triggers RETURN.
  • Line 290 tests V <> NOT PI; since NOT PI evaluates to 0 in Sinclair BASIC (bitwise NOT of the integer part), this is equivalent to V <> 0, distinguishing rests (value 0, handled by PAUSE w*t at line 300) from pitched notes (played via BEEP w*t/60, V-40).
  • Lines 260 and 270 contain REM statements that show commented-out SOUND register writes, indicating the engine was originally written or adapted for a SOUND-capable variant and translated to BEEP for compatibility.
  • Line 480 jumps to line 7066, which does not exist in the listing; this is a known technique used to exit a loop or subroutine cleanly by triggering an implicit return path — in this case likely causing the DATA read loop to terminate.

The tempo scalar t is read as 3.2 from line 500, and note durations from DATA are multiplied by this value and divided by 60 to produce BEEP duration arguments in seconds.

Metric Conversion Module

The metric section (lines 700–890) uses a computed GO SUB dispatch at line 735: WHERE = (A * 10) + 790, mapping menu choices 1–8 to subroutines at lines 800, 810, 820, 830, 840, 850, 860, and 870. Each subroutine accepts a value via INPUT and prints a full set of equivalent measurements using comma-separated PRINT column formatting. All subroutines share a common GO SUB 880 call that offers a COPY option for hardcopy output, except line 870 (kilograms), which omits the GO SUB 880 call and falls through to line 880 directly.

Conversion factors used are precise to multiple decimal places (e.g., 4.9288665 mL per teaspoon, 28.35 g per ounce), indicating careful sourcing rather than rounded approximations.

Screen and Color Control

Line 1 sets PAPER 4 (green), BORDER 2 (red), INK 7 (white) before loading a pre-saved SCREEN$ splash graphic via LOAD "ENORO.SCR" SCREEN$. Line 2 uses POKE 23658,8 to set the system variable FLAGS2, enabling CAPS LOCK — ensuring uppercase input without requiring the user to hold CAPS SHIFT. Inline color attribute escapes (\\{17}, \\{16}, \\{19}, \\{20}) are embedded directly in PRINT strings at lines 30 and 140 to switch INK, PAPER, BRIGHT, and FLASH mid-string.

Input Validation Pattern

Throughout the program, string variables are used for numeric inputs with a consistent two-step guard: first checking for empty string to re-prompt (e.g., IF P$="" THEN GO TO 10), then substituting a default if VAL yields zero (e.g., IF VAL P$=0 THEN LET P$="2300"). This prevents division-by-zero errors and provides sensible defaults without crashing on accidental ENTER presses.

Notable Anomalies

  • Line 490 (the DATA for the k() array used in the music engine) is referenced by RESTORE 490 at line 350 but is absent from the listing — the program would error at runtime when initializing the music arrays unless this data exists between lines 480 and 500.
  • Line 220’s REM contains a literal SOUND keyword (}8,0;9,0:RETURN), showing the original SOUND-based return path before it was commented out.
  • Line 230’s REM IF V=0 THEN LET V=1 documents a suppressed zero-note substitution that was replaced by the rest-via-PAUSE approach at line 300.
  • Line 875 (kilograms) omits GO SUB 880 before its RETURN-equivalent fall-through, so the COPY prompt still appears via line 880 being the next executed line — this is coincidental rather than intentional structure.
  • Variable v is used in mixed case in line 260’s REM (N(v,2)), which is consistent with BASIC’s case-insensitive variable handling but is inconsistent with the uppercase V used elsewhere.

Image Gallery

Source Code

    1 LET MARKER=0:PAPER 4:BORDER 2:INK 7:CLS :LOAD "ENORO.SCR"SCREEN$ :GO SUB 200
    2 CLS :PRINT '"BARGAINS IN MEXICO?":POKE 23658,8
    5 PRINT '"YOU MAY WONDER ABOUT SHOPPING INMEXICO OR EVEN A VACATION THERE SINCE AMERICAN MONEY HAS SKIDDEDIN EUROPE."
    7 PRINT '"SNOWBIRDS, COME TO THE RIO      GRANDE VALLEY.  IF YOU FEEL MORESECURE IN THE STATES, BUT LOVE AFOREIGN ADVENTURE, YOU CAN SLEEPAT NIGHT IN FRIENDLY TEJAS AND  CAVORT IN JUAREZ, NUEVO LAREDO, OR MATAMORAS BY DAY."
   10 PAUSE 480:INPUT "CURRENT EXCHANGE RATE IN PESOS? (USE 2300 AS OF 1/1/88 IF       TODAY'S RATE UNKNOWN) ";P$:IF P$="" THEN GO TO 10
   15 IF VAL P$=0 THEN LET P$="2300"
   20 LET VALP=100/ VAL P$
   25 CLS :PRINT P$
   30 PRINT "EACH PESO IS WORTH IN CENTS ";' TAB 10;VALP;';"\{17}\{2}\{16}\{7}NOTE: THIS IS PORTIONS OF A CENT\{17}\{4}";' TAB 8;\{17}\{7}\{16}\{0}"\{17}\{7}\{16}\{0}--NOT OF A DOLLAR!\{17}\{4}\{16}\{7}"
   40 INPUT "NUMBER OF DOLLARS TO EXCHANGE? ";D$:IF D$="" THEN GO TO 40
   42 IF VAL D$=0 THEN LET D$="25"
   45 PRINT "FOR ";D$;" DOLLARS"
   50 LET EQUIV= VAL D$* VAL P$:PRINT ''"YOU WILL RECEIVE "; PAPER 2;EQUIV;" PESOS."
   55 PRINT ''"HOW MUCH HAS INFLATION IN MEXICOERODED THE PESO'S WORTH? THE    FOLLOWING IS A TABLE OF ITEMS & PRICE IN PESOS:"
   57 GO SUB 100
   60 INPUT "PRICE IN PESOS FOR A PRODUCT OR SERVICE?(EX.: 3582 FOR 7  0Z. OF INSTANT COFFEE) ";C$
   62 IF C$="" THEN GO TO 60
   70 LET ORO=VALP/100* VAL C$:PRINT ' TAB 10;"$";ORO;'"    COST IN U.S. CURRENCY"
   75 INPUT "ANOTHER CONVERSION? Y/N";C$:IF C$="" THEN GO TO 75
   80 IF C$="Y" THEN GO TO 60
   85 IF C$="N" THEN GO TO 128
  100 PAUSE 60:PRINT AT 21,8;"PRESS ANY KEY":PAUSE 0:CLS 
  105 PRINT "DATE: 1/88"
  110 PRINT '"200 grams of coffee for 3582    pesos";'"1/2 liter brandy for   4650 pesos";'"12 oz can mango   juice for 550 pesos."
  112 PRINT '"A paintjob or upholstery for    your car depends on your bar-   gaining ability, but the best   should be well under $100 (U.S.)"
  115 PRINT '"A pedicure is $6 American (en   oro); a hairset with shampoo $4."
  117 PAUSE 60:PRINT AT 21,8;"PRESS ANY KEY":PAUSE 0:CLS 
  120 PRINT ''"Suppose you decide to rent in   Mexico, anywhere 200 miles from the border. Prior to Jan.1,1988 maids in Mexico cost $15 per    week but on Jan. 1st the mini-  mum wage was increased to $3.50 per day.  For $21 per week you  can have a maid 6 days per week and a gardener for a similar    rate."
  125 PRINT ''"or visit?  A first class hotel  in Guadalajara is $9 per night  for a single per THE COLONY     REPORTER, English language news-paper."
  127 RETURN 
  128 SOUND 7,56;13,13;8,12;11,255;12,255;0,16;1,13
  130 CLS :PRINT AT 4,12;"HMMMM":PAUSE 100:SOUND 8,0;7,63:PRINT ''" DRIVING HOW MANY MILES, AND THE GASOLINE AND GROCERIES ARE NOT       IN FAMILIAR SIZES.";''"   WORTH THE TIME AND EFFORT?  ":PAUSE 420:GO SUB 700
  140  PAUSE 30:CLS :PRINT '''" IN CASE YOUR SPANISH IS RUSTY,";'"   ""\{17}\{2} EN ORO"" MEANS, LITERALLY"; AT 8,12;\{19}\{0}\{18}\{0}\{19}\{1}\{19}\{0}" IN GOLD\{18}\{0} \{17}\{4}\{19}\{1}\{19}\{0}"
  145 PRINT '''"  BUT IT IS BORDER SPANISH FOR"; AT 14,10;"U.S. CURRENCY!"
  150 RESTORE :GO SUB 200:STOP 
  200 GO TO 330:REM INDEBTED TO DAN BENNETT OF CINCINNATI TSUG  FOR "MEXICAN HAT DANCE" FROM HIS COLLECTION,"MUSIC", ON SINCUS #101 TAPE
  210 READ V,W
  220 IF V= VAL "-1" THEN RETURN :REM }8,0;9,0:RETURN 
  230 REM IF V=0 THEN LET V=1
  240 IF V>64 OR V<39 THEN GO TO 260
  250 LET U=K(V- VAL "38")
  260 REM }0,N(V,2);1,N(V,1);2,N(v,2);3,N(V,1);7,60;8,31;9,31;11,64;12,64;13,11
  270 REM }9,0
  280 REM PAUSE w*t
  290 IF v <> NOT PI THEN BEEP w*t/60,v-40:GO TO 310
  300 PAUSE w*t
  310 IF V>64 OR V<39 THEN GO TO 210
  320 GO TO 210
  330 DIM k(VAL "26")
  340 FOR y= SGN PI TO VAL "26"
  350 RESTORE 490:READ w
  360 LET k(y)=w
  370 NEXT y
  380 LET w$="E"
  390 LET w= CODE w$
  400 RESTORE 500
  410 READ t,s$
  420 GO SUB 210
  430 DIM n(VAL "88", VAL "2")
  440 LET y= NOT PI
  450 IF v= VAL "-1" THEN RETURN 
  460 LET y=y+ SGN PI
  470 LET N(y, SGN PI)=v:LET N(y, VAL "2")=w
  480 GO TO 7066
  500 DATA 3.2,"Mexican Hat Dance - Traditional"
  510 DATA 52,2,57,2,0,2,52,2,57,2,0,2,52,2,57,6,0,4,52,2,57,2,59,2,57,2,56,4
  520 DATA 57,2,59,2,0,8,52,2,56,2,0,2,52,2,56,2,0,2,52,2,56,6,0,4,52,2
  530 DATA 56,2,57,2,56,2,54,4,56,2,57,2,0,6,64,2,63,2,64,2,61,2,60,2,61,2
  540 DATA 57,2,56,2,57,2,52,2,0,4,49,2,50,2,52,2,54,2,56,2,57,2,59,2,61,2
  550 DATA 62,2,59,2,0,4,62,2,61,2,62,2,59,2,58,2,59,2,56,2,55,2,56,2,52,2
  560 DATA 0,4,64,2,63,2,64,2,66,2,64,2,62,2,61,2,59,2,57,2
  570 DATA -1,-1
  600 RETURN 
  700 PRINT '''"   DID YOU \{20}\{0}REALLY SAVE MONEY?  ";'"  IF YOU CAN'T THINK IN METRIC,      YOU MAY NOT BE SURE"; AT 19,15;"\{20}\{1}SO\{20}\{0}":PAUSE 540:CLS 
  705 PRINT AT 0,2;"\{20}\{1}HOW FAR?\{20}\{0}"; AT  2,2;"\{20}\{1}1\{20}\{0} MILLIMETERS"; AT 5,2;"\{20}\{1}2\{20}\{0} CENTIMETERS"; AT 8,2;"\{20}\{1}3\{20}\{0} METERS"; AT 11,2;"\{20}\{1}4\{20}\{0} KILOMETERS"; AT 0,18;"\{20}\{1}HOW MUCH?\{20}\{0}"; AT 2,18;"\{20}\{1}5\{20}\{0} MILLILITERS"; AT 5,18;"\{20}\{1}6\{20}\{0} LITERS"; AT 8,18;"\{20}\{1}7\{20}\{0} GRAMS "; AT 11,18;"\{20}\{1}8\{20}\{0} KILOGRAMS"
  708 PRINT ''"YOU USUALLY BUY 5 LBS. OF SPUDS AT A TIME BUT  IN MEXICO, PRICE IS PER KILO--- IS THAT A GOOD   PRICE, IF YOU PAY $.79 PER LB.  IN STATES?";
  710 PRINT " IF 15 GALLONS FILLS  YOUR CAR, BUT PEMEX SELLS LITERSOF GAS AT APPROX. 2/3 U.S. COST...QUANTOS LITROS?"
  715 INPUT "YOUR NUMBER CHOICE? ";A
  720 IF A<1 OR A>8 THEN GO TO 715
  725 CLS 
  730 LET WHERE=(A*10)+790
  735 GO SUB WHERE
  740 PRINT ''"MORE METRIC TO COMMON ENGLISH   MEASUREMENT? Y/N" :INPUT M$:IF M$="" THEN GO TO 740
  745 IF M$="Y" THEN CLS :GO TO 705
  750 IF M$="N" THEN CLS :RETURN 
  800 INPUT "HOW MANY MILLIMETERS? ";A:PRINT A;" MILLIMETERS"
  805 PRINT ,,"=",,,,A/25.4,"IN",A/304.8,"FT",A/914.4,"YARDS",A/1609344,"MILES",A*.1,"CM",A*.001,"MTRS",A*.000001,"KM":GO SUB 880
  808 RETURN 
  810 INPUT "HOW MANY CENTIMETERS? ";A:PRINT A;" CENTIMETERS"
  815 PRINT ,,"=",,,,A/2.54,"IN",A/30.48,"FT",A/91.44,"YARDS",A/160934.4,"MILES",A*10,"MM",A*.01,"MTRS",A*.0001,"KM":GO SUB 880
  818 RETURN 
  820 INPUT "HOW MANY METERS? ";A:PRINT A;" METERS"
  825 PRINT ,,"=",,,,A/.0254,"IN",A/.3048,"FT",A/.9144,"YARDS",A/609.344,"MILES",A*1000,"MM",A*100,"CM",A*.001,"KM":GO SUB 880
  828 RETURN 
  830 INPUT "HOW MANY KILOMETERS? ";A:PRINT A;" KILOMETERS"
  835 PRINT ,,"=",,,,A/.0000254,"IN",A/.0003048,"FT",A*.0009144,"YARDS",A/1.609344,"MILES",A*1000000,"MM",A*100000,"CM",A*1000,"METERS":GO SUB 880
  838 RETURN 
  840 INPUT "HOW MANY MILLILITERS? ";A:PRINT A;" MILLILITERS"
  845 PRINT ,,"=",,,,A/4.9288665,"TEASPOONS",A/14.786599,"TABLESPOONS",A/236.58558,"CUPS",A/473.17116,"INTS",A/946.3423,"QUARTS",A/3785.369,"GALLONS",A/1000,"LITERS":GO SUB 880
  848 RETURN 
  850 INPUT "HOW MANY LITERS? ";A:PRINT A;" LITERS"
  855 PRINT ,,"=",,,,A/.0049288665,"TEASPOONS",A/.014786599,"TABLESPOONS",A/.23658558,"CUPS",A/.47317116,"PINTS",A/.9463423,"QUARTS",A/3.785369,"GALLONS",A*1000,"MILLILITERS":GO SUB 880
  858 RETURN 
  860 INPUT "HOW MANY GRAMS? ";A:PRINT A;" GRAMS"
  865 PRINT ,,"=",,,,A/28.35,"OUNCES",A/453.6,"POUNDS",A/907200,"TONS",A/1000,"KILOGRAMS":GO SUB 880
  868 RETURN 
  870 INPUT "HOW MANY KILOGRAMS? ";A:PRINT A;" KILOGRAMS"
  875 PRINT ,,"=",,,,A/.02835,"OUNCES",A/.453597,"POUNDS",A/907.200,"TONS",A*1000,"GRAMS"
  880 INPUT "COPY? Y/N ";C$:IF C$="" THEN GO TO 880
  885 IF C$="Y" THEN COPY :RETURN 
  890 IF C$="N" THEN RETURN 
 9997 STOP 
 9998 CLEAR :SAVE "ENORO" LINE 1:PRINT "RELOAD ""ENORO.SCR"" SCREEN$ ";'"GOTO 9999 WHEN READY":STOP 
 9999 SAVE "ENORO.SCR"SCREEN$ 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.