Elecform

This file is part of Synchro-Sette January 1984. Download the collection to get this file.
Developer(s): Gene G. Buza
Date: 1984
Type: Program
Platform(s): TS 1000

Works out seven common electrical formulas: resistance, voltage and current by Ohm’s law, capacitive reactance, inductive reactance, impedance, and power (from either volts and amps or amps and ohms). Choosing an item shows the formula and its symbols, asks for the two known values, and fills them into the equation on screen as each is entered before printing the result.


Program Analysis

Program Structure

The menu (lines 100–530) accepts a key from 1 to 7 by checking that its character code lies between 29 and 35, then jumps to VAL Y$*1000. Each formula has its own block at 1000, 2000 and so on up to 7000. The power option has a second menu for its two methods, at 7100 and 7300. Every block ends by jumping to the shared tail at line 1110, which clears the prompt line with the 32-space string D$, waits for a key and returns to the menu.

Notable Techniques

  • Screens are drawn in FAST mode, and the program switches to SLOW just before each INPUT or INKEY$ loop, so the display stays visible while it waits for the user.
  • The partly filled equation is printed again after each input (for example R = 12/?, then the full result), showing the calculation one step at a time.
  • Inverse characters are used as subscripts in labels such as X[C] and X[L].

Potential Issues

  • Inductive reactance (line 5100) calculates 1/(2*PI*F*L) and labels the result X[C]. Both were copied from the capacitive reactance routine; the correct formula, shown on the screen at line 5040, is 2πFL.
  • The impedance routine asks INPUT VOLTS? (line 6050) when it needs the resistance.
  • The menu screen at line 4000 gives the capacitive formula as “1/2 X PI X …” without brackets, although the worked equation further down shows it correctly.

Appears On

The January 1984 Synchro-Sette subscription cassette: seven programs, including a baccarat game, a fifteen puzzle, an electrical formula calculator and a notes database.

Image Gallery

Source Code

  10 DIM D$(32)
 100 FAST
 105 CLS
 110 PRINT "    [E][L][E][C][T][R][I][C][A][L]█[F][O][R][M][U][L][A][S]"
 120 PRINT AT 3,0;"OHMS";TAB 30;1
 130 PRINT AT 5,0;"VOLTS";TAB 30;2
 140 PRINT AT 7,0;"AMPERES";TAB 30;3
 150 PRINT AT 9,0;"CAPACITIVE REACTANCE";TAB 30;4
 160 PRINT AT 11,0;"INDUCTIVE REACTANCE";TAB 30;5
 170 PRINT AT 13,0;"IMPEDANCE";TAB 30;6
 180 PRINT AT 15,0;"WATTS";TAB 30;7
 300 PRINT AT 21,0;"CHOOSE ONE OF ABOVE?"
 490 SLOW
 500 LET Y$=INKEY$ 
 510 IF CODE Y$<29 OR CODE Y$>35 THEN GOTO 500
 515 FAST
 520 CLS
 530 GOTO VAL Y$*1000
1000 PRINT "OHMS = VOLTAGE/AMPERES"
1010 PRINT ,,"OHMS (RESISTANCE) = R"
1020 PRINT "VOLTS (VOLTAGE)   = E"
1030 PRINT "AMPS (CURRENT)    = I"
1040 PRINT ,,"R = E/I"
1050 PRINT AT 21,0;"INPUT VOLTS?"
1060 INPUT E
1070 PRINT AT 15,0;"R = ";E;"/?"
1080 PRINT AT 21,0;"INPUT AMPERAGE?"
1085 SLOW
1090 INPUT I
1100 PRINT AT 15,0;"R = ";E;"/";I;" = ";E/I;" OHMS"
1110 PRINT AT 21,0;D$
1115 FAST
1120 PAUSE 40000
1130 GOTO 100
2000 PRINT "VOLTS = AMPERAGE X RESISTANCE"
2010 PRINT ,,"VOLTS (VOLTAGE)   = E"
2020 PRINT "AMPS (CURRENT)    = I"
2030 PRINT "OHMS (RESISTANCE) = R"
2040 PRINT ,,"E = IR"
2050 PRINT AT 21,0;"INPUT AMPS?"
2055 SLOW
2060 INPUT I
2070 PRINT AT 15,0;"E = ";I;" X ?"
2080 PRINT AT 21,0;"INPUT OHMS?"
2090 INPUT R
2100 PRINT AT 15,0;"E = ";I;" X ";R;" = ";I*R;" VOLTS"
2110 GOTO 1110
3000 PRINT "AMPERAGE = VOLTS/RESISTANCE"
3010 PRINT ,,"AMPS (CURRENT)    = I"
3020 PRINT "VOLTS (VOLTAGE)   = E"
3030 PRINT "OHMS (RESISTANCE) = R"
3040 PRINT ,,"I = E/R"
3050 PRINT AT 21,0;"INPUT VOLTS?"
3055 SLOW
3060 INPUT E
3070 PRINT AT 15,0;"I = ";E;"/?"
3080 PRINT AT 21,0;"INPUT OHMS?"
3090 INPUT R
3100 PRINT AT 15,0;"I = ";E;"/";R;" = ";E/R;" AMPERES"
3110 GOTO 1110
4000 PRINT "CAPACITIVE REACTANCE = 1/2 X PI X FREQUENCY IN HERTZ X FARADS"
4010 PRINT ,,"CAPACITIVE REACTANCE      = X[C]"
4020 PRINT "FREQUENCY IN HERTZ        = F"
4030 PRINT "CAPACITOR VALUE IN FARADS = C"
4040 PRINT ,,"X[C] = 1/(2 X PI X F X C)"
4050 PRINT AT  21,0;"INPUT FREQUENCY?"
4055 SLOW
4060 INPUT F
4070 PRINT AT 15,0;"X[C] = 1/(2 X PI X ";F;" X ?)"
4080 PRINT AT 21,0;"INPUT FARADS?           "
4090 INPUT C
4100 PRINT AT 15,0;D$;AT 15,0;"X[C] = 1/(2 X PI X ";F;" X ";C;")","= ";1/(2*PI*F*C);" OHMS"
4110 GOTO 1110
5000 PRINT "INDUCTIVE REACTANCE = 2 X PI X  FREQUENCY IN HERTZ X HENRYS"
5010 PRINT ,,"INDUCITIVE REACTANCE       = X[L]"
5020 PRINT "FREQUENCY IN HERTZ         = F"
5030 PRINT "INDUCTANCE VALUE IN HENRYS = L"
5040 PRINT ,,"X[L] = 2 X PI X F X L"
5050 PRINT AT  21,0;"INPUT FREQUENCY?"
5055 SLOW
5060 INPUT F
5070 PRINT AT 15,0;"X[L] = 2 X PI X ";F;" X ?"
5080 PRINT AT 21,0;"INPUT HENRYS?           "
5090 INPUT L
5100 PRINT AT 15,0;D$;AT 15,0;"X[C] = 1/(2 X PI X ";F;" X ";L;")","= ";1/(2*PI*F*L);" OHMS"
5110 GOTO 1110
6000 PRINT "IMPEDANCE = THE SQUARE ROOT OF  (RESISTANCE SQUARED + REACTANCE SQUARED)"
6010 PRINT ,,"IMPEDANCE         = Z"
6020 PRINT "RESISTANCE        = R"
6030 PRINT "REACTANCE         = X",,,"REACTANCE IS THE ALGEBRAIC SUM  OF THE INDUCTIVE REACTANCE AND  THE CAPACITIVE REACTANCE."
6035 PRINT "THE <**> IS THE POWER SYMBOL."
6040 PRINT ,,"Z = (R**2 + X**2)**.5"
6050 PRINT AT  21,0;"INPUT VOLTS?"
6055 SLOW
6060 INPUT R
6070 PRINT AT 15,0;"Z = (";R;" **2 + ? **2)**.5"
6080 PRINT AT 21,0;"INPUT REACTANCE? "
6090 INPUT X
6100 PRINT AT 15,0;"Z = (";R;" **2 + ";X;"**2)**.5";AT 16,0;"= ";(R**2+X**2)**.5;" OHMS"
6110 GOTO 1110
7000 PRINT "WATTS FORMULAE",,,,"VOLTS AND AMPS";TAB 31;1;"AMPS AND OHMS";TAB 31;2
7010 PRINT AT 15,0;"WHICH INPUTS DO YOU HAVE?"
7015 SLOW
7020 LET Y$=INKEY$ 
7030 IF CODE Y$<29 OR CODE Y$>30 THEN GOTO 7020
7035 FAST
7040 CLS
7050 IF Y$="2" THEN GOTO 7300
7100 PRINT "WATTS = VOLTS X AMPS"
7110 PRINT ,,"WATTS    = P"
7120 PRINT "VOLTS    = E"
7130 PRINT "AMPS     = I"
7140 PRINT ,,"P = E X I"
7150 PRINT AT  21,0;"INPUT VOLTS?"
7155 SLOW
7160 INPUT E
7170 PRINT AT 15,0;"P = ";E;" X ?"
7180 PRINT AT  21,0;"INPUT AMPS? "
7190 INPUT I
7200 PRINT AT 15,0;"P = ";E;" X ";I;" = ";E*I;" WATTS"
7210 GOTO 1110
7300 PRINT "WATTS = AMPS SQUARED X OHMS"
7310 PRINT ,,"WATTS    = P"
7320 PRINT "AMPS     = I"
7340 PRINT ,,"P = I**2 X R"
7350 PRINT AT  21,0;"INPUT AMPS?"
7355 SLOW
7360 INPUT I
7370 PRINT AT 15,0;"P = ";I**2;" X ?"
7380 PRINT AT  21,0;"INPUT OHMS?"
7390 INPUT R
7400 PRINT AT 15,0;"P = ";I**2;" X ";R;" = ";I**2*R;" WATTS"
7410 GOTO 1110
9996 FAST
9997 STOP
9998 SAVE "ELECFOR[M]"
9999 GOTO 10

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