--- title: "Resval" id: 71954 type: "computer_media" slug: "resval" url: "http://localhost/computer_media/resval/" markdown_url: "http://localhost/computer_media/resval.md" published_at: "2026-10-20T14:56:01+00:00" modified_at: "2026-10-20T14:56:02+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "Calculates the resistance needed for a given voltage and current, then picks the nearest standard resistor value and shows the resulting current and wattage." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Electronics" slug: "electronics" taxonomy: "genre" url: "http://localhost/type/electronics/" media_contents: - id: 71965 title: "Long Island Sinclair Timex (LIST) User Group Library Tape #3.5" type: "computer_media" url: "http://localhost/computer_media/long-island-sinclair-timex-list-user-group-library-tape-3-5/" media_type: "Program" tsrun_member: "LIST LIB 3.5 (198x)(Long Island Sinclair Timex User Group)(TS2068)(US)(Cassette)/List_Lib_3.5A(Unk)(Unk)(TS2068)(Cassette)/13_RESVAL.tap" mediadate: "198x" media_type_tags: "Electronics" --- # Resval Asks for a voltage and a current, prints the exact resistance by Ohm’s law, and then picks the next standard value at or above it from the 10–12–15–18–22–27–33–39–47–56–68–82 series. It also reports the current and power dissipation that the chosen resistor gives at that voltage. ## Program Analysis ### How It Works Line 200 finds the decade with `INT (LN R/2.303)-1`, and lines 210–240 read the series from DATA and scale each value by `10^L` until one is at least as large as the computed resistance. Current and wattage are rounded to two decimal places with `INT (x*100)/100`. ### Potential Issues - Line 170, `LET R=(V*100/I)/100`, looks like an intended rounding to two places but omits `INT`, so it just computes V/I. - There is no `RESTORE` before the series is read, so each later calculation continues from wherever the previous one stopped in the DATA and soon runs out. ## Source Code ``` 10 REM ************************* 20 PRINT "resval" 30 PRINT 40 PRINT "PROGRAM DERIVES PREFERRED VALUE"'"OF RESISTOR FROM INPUT"'"VOLTAGE AND CURRENT VALUES" 50 PRINT 70 PRINT "SAVE WITH GOTO 340" 80 PAUSE 800 90 CLS 100 PRINT "VOLTAGE?";: INPUT V 120 PRINT TAB 12;V;"VOLTS" 130 PRINT 140 PRINT "CURRENT?";: INPUT I 160 PRINT TAB 12;I;"AMPS" 170 LET R=(V*100/I)/100 180 PRINT 190 PRINT "ACTUAL RESISTANCE ";R;" OHM" 200 LET L=INT (LN R/2.303)-1 210 FOR N=1 TO 13 215 READ X 220 IF R<=X*10^L THEN GO TO 240 230 NEXT N 240 LET X=X*10^L 245 PRINT 250 PRINT "PREFERRED RESISTOR:";X;" OHM" 255 PRINT 260 PRINT "GIVES CURRENT"; TAB 19;INT (V*100/X)/100;" AMP" 270 PRINT "AND ";INT (V^2*100/X)/100;" WATTS" 280 PRINT 290 PRINT "AGAIN? (Y/N)": INPUT Q$ 300 DATA 10,12,15,18,22,27,33,39,47,56,68,82,100 310 IF Q$="N" THEN STOP 320 CLS 330 GO TO 100 340 SAVE "RESVAL" LINE 10 ```