Currency Changer

Type
Utility
Category
Foreign-exchange calculator
Author
John W. Goolevitch and Warwick Wakeman
Published in
Antic, February 1985 (Vol. 3, No. 10)
Year
1985
Language
Atari BASIC
Requirements
Any Atari 8-bit of any memory size, Atari BASIC
Green text screen with boxed prompts: WHAT IS THE CURRENT EXCHANGE RATE OF THE TANZANIA SCHILLIN? .25 and HOW MANY TANZANIA SCHILLIN'S WOULD YOU LIKE TO BUY? 100, then 100 TANZANIA SCHILLIN'S WILL COST YOU 25 UNITED STATES DOLLAR'S

About the program

"Converting Greek drachmas into Irish punts and then to Chinese renminbis is easy if you're an international banker," Antic wrote in February 1985, "or if you have Currency Changer running on your Atari." John W. Goolevitch and Warwick Wakeman, both from British Columbia, Canada, wrote this short program for travellers and for anyone sending a cheque abroad. You look up the day's exchange rates in the newspaper, type them in, and it tells you how much of one currency you need to buy an amount of another. The title screen calls it the Current Foreign Exchange Program, and the disk REMs call it "Currency Capers".

Today it's also a small time capsule. Its list of 44 countries includes West Germany and Czechoslovakia, and currencies that have since disappeared: the drachma, punt, lira, guilder, escudo, peseta, the French and Belgian francs and the Finnish markka (listed as FINNMARK).

Typing it in

Most of it is plain BASIC. The title uses alternate inverse letters, which show in two colours in GRAPHICS 1 ({inv}…{/inv}: type them with the Atari or inverse key). The boxes round the prompts in lines 1150–1160 are made from {CTRL-Q}, {CTRL-R}, {CTRL-Z} and similar line-graphics characters (hold CTRL and press the letter). {CLEAR} and {UP} are ESC followed by SHIFT-CLEAR or CTRL-up arrow. The magazine printed TYPO II checksums, which aren't in the disk version. Currency names are cut to eight letters by DIM CUR1$(8), which is why the screen says SCHILLIN (the DATA spells it SCHILLING) and Saudi Arabia's currency is typed as RIYA.

How to use it

Press a key at the title and again after the instructions. Then choose:

  1. Home country to foreign country
  2. Foreign country to home country
  3. Foreign country to foreign country

The 44 countries appear in two numbered columns. Type the numbers you're asked for, then each foreign rate as a newspaper gives it, the value of one foreign unit in your home money. Finally, type how many units you want to buy. The cost counts up on screen with a ticking sound and is rounded to two decimal places. Press OPTION to choose different countries or SELECT to try another amount.

The article's example is changing US dollars into Tanzanian shillings at .25, meaning one shilling is worth a quarter of a dollar. To repeat it, choose option 1, then country 42 (United States) as home and 40 (Tanzania), and enter .25 for the rate. 100 shillings come to 25 dollars.

How it works

Every rate is stored as "home currency per foreign unit", so the sums are short (lines 910–930). Home to foreign is amount × rate. Foreign to home is amount ÷ rate. Foreign to foreign goes through the home currency: amount ÷ rate1 × rate2. Line 940 rounds to cents with INT(100*TOTAL+0.5)/100. For the count-up in line 1010, the step size grows with the total (0.1, 1, 11 or 251), so even big sums finish quickly. The countries are read from DATA in lines 2000–2080 with READ NUM,PLACE$,CUR$, and the program searches them with RESTORE 2000. There are random-pitch beeps all through (lines 440–520), and a scrolling "whoosh" clears the screen (line 420).

Variations to try

As the authors suggest, edit the DATA to add your own countries, or an imaginary one. They suggested renaming one country GUE, the Great Underground Empire, with the Frobozz as its currency. You could also bring the list up to date with the euro.

Listing

5 REM CURRENCY CAPERS
6 REM BY JOHN W. GOOLEVITCH
7 REM ANTIC MAGAZINE
10 DIM PLACE1$(15),PLACE2$(15),CUR1$(8),CUR2$(8)
100 GRAPHICS 17
110 POSITION 2,3:? #6;"{inv}C{/inv}U{inv}R{/inv}R{inv}E{/inv}N{inv}T{/inv}"
120 POSITION 5,6:? #6;"F{inv}O{/inv}R{inv}E{/inv}I{inv}G{/inv}N"
130 POSITION 8,9:? #6;"{inv}E{/inv}X{inv}C{/inv}H{inv}A{/inv}N{inv}G{/inv}E"
140 POSITION 11,12:? #6;"P{inv}R{/inv}O{inv}G{/inv}R{inv}A{/inv}M"
150 POSITION 6,14:? #6;"by"
160 POSITION 1,18:? #6;"{inv}john w. goolevitch{/inv}"
170 POSITION 3,22:? #6;"{inv}<{/inv}P{inv}R{/inv}E{inv}S{/inv}S {inv}A{/inv}N{inv}Y{/inv} K{inv}E{/inv}Y{inv}>{/inv}"
180 SETCOLOR 2,4,6:SETCOLOR 0,10,6:GOSUB 200
190 SETCOLOR 0,4,6:SETCOLOR 2,10,6:GOSUB 200:GOTO 180
200 R=INT(RND(0)*150)+75:FOR V=13 TO 1 STEP -2:SOUND 0,R,10,V:NEXT V:SOUND 0,0,0,0:FOR P=1 TO 30:NEXT P
210 IF PEEK(764)=255 THEN RETURN
220 POP :POKE 764,255:SOUND 0,0,0,0
230 GRAPHICS 0:POKE 752,1:SETCOLOR 2,0,0:? :? "   {inv}   CURRENT FOREIGN EXCHANGE   {/inv}"
240 ? :? " FOR THIS PROGRAM, YOU WILL NEED"
250 ? "TODAY'S NEWSPAPER."
260 ? :? " THERE, YOU WILL FIND THE LIST OF"
270 ? "CURRENT FOREIGN EXCHANGES."
280 ? :? " WITH THIS LIST AND THIS PROGRAM."
290 ? "WE WILL BE ABLE TO CALCULATE AND"
300 ? "EXCHANGE MONEYS TO AND FROM ANY"
310 ? "CURRENCY YOU WISH."
320 ? :? "       {inv}   PRESS ANY KEY   {/inv}":GOSUB 440
330 IF PEEK(764)=255 THEN 330
340 POKE 764,255:? "{CLEAR}"
350 POKE 752,1:SETCOLOR 2,0,0:? :? "      {inv}   EXCHANGE OPTIONS   {/inv}"
360 ? :? "{inv}1{/inv}. HOME COUNTRY TO FOREIGN COUNTRY"
370 ? :? "{inv}2{/inv}. FOREIGN COUNTRY TO HOME COUNTRY"
380 ? :? "{inv}3{/inv}. FOREIGN COUNTRY TO FOREIGN COUNTRY"
390 ? :? "     SELECT (1, 2  OR 3):";:GOSUB 440:INPUT OPTION
400 POKE 764,255:GOSUB 410:GOTO 530
410 REM SCROLL OFF SCREEN WITH SOUND
420 FOR R=1 TO 23:? " ":SOUND 0,R*8,8,10:NEXT R:SOUND 0,0,0,0:RETURN
440 REM INPUT SOUND
450 C=INT(RND(1)*20)*10+40
460 FOR A=C TO C-15 STEP -2
470 SOUND 0,A,10,A-C+15:SOUND 1,A+10,10,A-C+15
480 NEXT A
490 FOR R=1 TO 2:FOR B=12 TO 0 STEP -3
500 SOUND 0,A,10,B:SOUND 1,A+10,10,B
510 NEXT B:NEXT R
520 RETURN
525 REM DISPLAY 44 COUNTRIES
530 GRAPHICS 0:SETCOLOR 2,13,2:SETCOLOR 4,13,2
540 POKE 752,1:RESTORE 2000
550 READ NUM,PLACE1$,CUR1$:SOUND 0,(NUM+10)*1.5,10,10:SOUND 1,(NUM+10)*3,10,10
560 IF NUM<10 THEN POSITION 3,NUM-1
570 IF NUM>9 THEN POSITION 2,NUM-1
580 ? NUM;".";PLACE1$
590 IF NUM<22 THEN SOUND 0,0,0,0:SOUND 1,0,0,0:GOTO 550
620 READ NUM,PLACE1$,CUR1$:SOUND 0,(NUM+10)*1.5,10,10:SOUND 1,(NUM+10)*3,10,10
630 POSITION 20,NUM-23
640 ? NUM;".";PLACE1$
650 IF NUM<44 THEN SOUND 0,0,0,0:SOUND 1,0,0,0:GOTO 620
660 GOSUB 440
670 IF OPTION=1 THEN GOSUB 790:GOTO 690
680 ? "    {inv} COUNTRY TO EXCHANGE FROM  :{/inv}";
690 INPUT N1
700 RESTORE 2000:GOSUB 440
710 READ NUM,PLACE1$,CUR1$:IF NUM=N1 THEN 730
720 GOTO 710
730 IF OPTION=2 THEN GOSUB 790:GOTO 750
740 ? "    {inv}  COUNTRY TO EXCHANGE TO   :{/inv}";
750 INPUT N2
760 RESTORE 2000:GOSUB 410:? "{CLEAR}"
770 READ NUM,PLACE2$,CUR2$:IF NUM=N2 THEN 800
780 GOTO 770
790 ? "    {inv}     YOUR HOME COUNTRY     :{/inv}";:RETURN
800 GOSUB 1140
810 IF OPTION=1 THEN RATE1=1:GOTO 860
820 ? "WHAT IS THE CURRENT EXCHANGE RATE"
830 ? "OF THE ";PLACE1$;" ";CUR1$;:INPUT RATE1
840 GOSUB 1140
850 IF OPTION=2 THEN RATE2=1:GOTO 890
860 ? "WHAT IS THE CURRENT EXCHANGE RATE"
870 ? "OF THE ";PLACE2$;" ";CUR2$;:INPUT RATE2
880 GOSUB 1140
890 ? "HOW MANY ";PLACE2$;" ";CUR2$;"'S"
900 ? "WOULD YOU LIKE TO BUY ";:INPUT AMOUNT:GOSUB 440
910 IF OPTION=1 THEN TOTAL=RATE1*RATE2*AMOUNT
920 IF OPTION=2 THEN TOTAL=AMOUNT/RATE1
930 IF OPTION=3 THEN T=AMOUNT/RATE1:TOTAL=T*RATE2
940 TOTAL=INT(100*TOTAL+0.5)/100
950 ? :? :? AMOUNT;" ";PLACE2$;" ";CUR2$;"'S"
960 ? :? "WILL COST YOU":? :?
970 IF TOTAL<10 THEN N=0.1:GOTO 1010
980 IF TOTAL<100 THEN N=1:GOTO 1010
990 IF TOTAL<1000 THEN N=11:GOTO 1010
1000 N=251
1010 FOR ADD=0 TO TOTAL STEP N:? "{UP}";ADD:SOUND 0,2,12,10:SOUND 0,0,0,0:FOR P=1 TO 5:NEXT P:NEXT ADD
1020 ? "{UP}";TOTAL;" ";PLACE1$;" ";CUR1$;"'S"
1030 POSITION 2,21:? "{inv}PRESS {/inv}OPTION{inv} FOR DIFFERENT COUNTRIES{/inv}"
1040 POSITION 2,22:? "{inv}PRESS {/inv}SELECT{inv} TO ALTER AMOUNT ENTERED{/inv}"
1070 POSITION 8,21:? "{inv}OPTION{/inv}":FOR P=1 TO 5:NEXT P
1080 POSITION 8,22:? "{inv}SELECT{/inv}":FOR P=1 TO 5:NEXT P:POKE 53279,0
1090 FOR R=1 TO 25:IF PEEK(53279)=3 THEN RESTORE 2000:GOSUB 410:GRAPHICS 0:SETCOLOR 2,13,2:GOTO 340
1100 IF PEEK(53279)=5 THEN GOSUB 410:? "{CLEAR}":GOTO 880
1110 NEXT R:GOTO 1030
1140 POKE 82,0:GOSUB 440
1150 ? :? "{CTRL-Q}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-E}"
1160 ? :? "{CTRL-Z}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-C}"
1170 POKE 82,2:? "{UP}{UP}{UP}{UP}{UP}":RETURN
1990 REM DATA FOR 44 COUNTRIES
2000 DATA 1,AUSTRALIA,DOLLAR,2,AUSTRIA,SHILLING,3,BAHAMAS,DOLLAR,4,BARBADOS,DOLLAR,5,BELGIUM,FRANC,6,BERMUDA
2010 DATA DOLLAR,7,CANADA,DOLLAR,8,CAYMAN,DOLLAR,9,CHINA,RENMINBI,10,CZECHOSLOVAKIA,CROWN,11,DENMARK,KRONER,12
2020 DATA EAST CARIBBEAN,DOLLAR,13,FIJI,DOLLAR,14,FINLAND
2025 DATA FINNMARK,15,FRANCE,FRANC,16,GERMANY(WEST),MARK,17,GREECE
2030 DATA DRACHMA,18,GUYANA,DOLLAR,19,HONG KONG,DOLLAR,20
2035 DATA INDIA,RUPEE,21,INDONESIA,RUPIAH,22,IRELAND,PUNT,23,ITALY
2040 DATA LIRE,24,JAMAICA,DOLLAR,25,JAPAN,YEN,26,KUWAIT,DINAR,27,MALAYSIA,DOLLAR,28,MEXICO,PESO,29,NETHERLANDS
2050 DATA GUILDER,30,NEW ZEALAND,DOLLAR,31,NORWAY,KRONER,32
2055 DATA PAKISTAN,RUPEE,33,PORTUGAL,ESCUDO,34,SAUDI ARABIA,RIYA
2060 DATA 35,SINGAPORE,DOLLAR,36,SOUTH AFRICA,RAND,37,SPAIN,PESETA,38,SWEDEN,KRONER,39,SWITZERLAND,FRANC
2070 DATA 40,TANZANIA,SCHILLING,41,TRINIDAD&TOBAGO,DOLLAR,42,UNITED STATES,DOLLAR,43,UNITED KINGDOM,POUND
2080 DATA 44,VENEZUELA,BOLIVAR

Download

The original program from the Antic disk, to LOAD or ENTER instead of typing it: CURRCAPE.BAS.

Credits