My First Apple Basic Software

4 posts / 0 new
Last post
italianapple's picture
Offline
Last seen: 4 years 9 months ago
Joined: Jan 28 2007 - 04:50
My First Apple Basic Software

The code is really simple, but i've had a lot of fun righting it and saving it via ZTerm on my Mac.

The application is a 4 band Resistor Code "reader", i haven't put in error checks for the inputs, so, if you input a wrong color text, the output would give a wrong value.

Well, it's only the first "version".

here's the code:

1 DIM F$(10)
2 DIM S$(10)
3 DIM T$(10)
4 DIM Z$(8)

10 PRINT "THE RESISTOR CALCULATOR"
11 PRINT " --- 4 BAND CODE ---
15 PRINT " CREATED BY ITALIAN APPLE "

16 PRINT " FOR THE APPLE I"
17 PRINT ""
18 PRINT ""
20 PRINT "CHOSE YOUR OPTION"
21 PRINT ""
25 PRINT "1 - CALCULATE A NEW RESISTOR"
35 PRINT "2 - EXIT"
36 PRINT ""
40 INPUT "PICK A NUMBER ",N
45 IF N=1 THEN GOTO 100
55 IF N=2 THEN GOTO 1120
56 IF N<>1 THEN GOTO 40
57 IF N<>2 THEN GOTO 40
60 PRINT ""
65 PRINT ""
100 PRINT "READ THE COLORS OF THE RESISTOR"
101 PRINT "FROM LEFT TO RIGHT"
103 PRINT ""
110 PRINT "COLOR N.1 ---[/// /]--- COLOR N.4"
120 PRINT " "
121 INPUT "INPUT COLOR N.1= ",F$
122 INPUT "INPUT COLOR N.2= " ,S$
123 INPUT "INPUT COLOR N.3= " ,T$
124 INPUT "INPUT COLOR N.4= " ,Z$

140 IF F$="BLACK" THEN F$="0."
145 IF F$="BROWN" THEN F$="1"
150 IF F$="RED" THEN F$="2"
155 IF F$="ORANGE" THEN F$="3"
160 IF F$="YELLOW" THEN F$="4"
165 IF F$="GREEN" THEN F$="5"
170 IF F$="BLUE" THEN F$="6"
175 IF F$="VIOLET" THEN F$="7"
180 IF F$="GREY" THEN F$="8"
185 IF F$="WHITE" THEN F$="9"

200 IF S$="BLACK" THEN S$="0"
210 IF S$="BROWN" THEN S$="1"
220 IF S$="RED" THEN S$="2"
230 IF S$="ORANGE" THEN S$="3"
240 IF S$="YELLOW" THEN S$="4"
250 IF S$="GREEN" THEN S$="5"
260 IF S$="BLUE" THEN S$="6"
270 IF S$="VIOLET" THEN S$="7"
280 IF S$="GREY" THEN S$="8"
290 IF S$="WHITE" THEN S$="9"
295 IF T$="BLACK" THEN T$=""

300 IF T$="BROWN" THEN T$="0"
310 IF T$="RED" THEN T$="00"
320 IF T$="ORANGE" THEN T$="000"
330 IF T$="YELLOW" THEN T$="0000"
340 IF T$="GREEN" THEN T$="00000"
350 IF T$="BLUE" THEN T$="000000"
360 IF T$="VIOLET" THEN T$="0000000"
370 IF T$="GREY" THEN T$="00000000"
380 IF T$="WHITE" THEN T$="000000000"
400 IF Z$="GOLD" THEN Z$="5%"
410 IF Z$="SILVER" THEN Z$="10%"

420 PRINT ""
980 PRINT ""
990 PRINT "YOUR RESISTOR VALUE IS:"
995 PRINT ""
1000 PRINT F$;S$;T$;" OHMS TOLERANCE ";Z$;
1010 PRINT ""
1011 PRINT ""
1100 INPUT "ANOTHER RESISTOR [Y/N]", W$
1101 PRINT ""
1110 IF W$="Y" THEN GOTO 121
1111 PRINT ""
1120 PRINT "BYE BYE"
1130 END

italianapple's picture
Offline
Last seen: 4 years 9 months ago
Joined: Jan 28 2007 - 04:50
My line 4 of the code has a b

My line 4 of the code has a bit of sun on his face :),

i did not think about the "smiles" on the forum, the DIM was an 8, but you can put a 10 too.

4 DIM Z$(10)

Sorry.

IA.

Offline
Last seen: 2 years 11 months ago
Joined: Sep 23 2005 - 13:29
very nice

nice, simple and to the point. makes me remember my old days of messing around on my commodores... (LONG TIME commodore user, PET, VIC-20, C64, C128, A500, A2000) [still use the C64 and the A500]

also though i noticed a problem on line 11.

you had typed:

11 PRINT " --- 4 BAND CODE ---

which leaves the print statement open. i dont know how apple basic handles that, maybe its not a problem... but you should edit your post to include the closing quote mark. i.e.:

11 PRINT " --- 4 BAND CODE ---"

BASIC used to be TONS of fun. I really should do some programming on my old machines again. Once again, very nice.

enjoy,
Bill

italianapple's picture
Offline
Last seen: 4 years 9 months ago
Joined: Jan 28 2007 - 04:50
a cut & paste issue :( Tha

a cut & paste issue Sad

Thanks !

IA

Log in or register to post comments