--- title: "Depreciation and Income Taxes" id: 57171 type: "computer_media" slug: "depreciation-and-income-taxes" url: "http://localhost/computer_media/depreciation-and-income-taxes/" markdown_url: "http://localhost/computer_media/depreciation-and-income-taxes.md" published_at: "2024-10-04T01:14:43+00:00" modified_at: "2026-03-30T21:19:13+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/120_Depr.png" excerpt: "Compare straight-line and sum-of-years-digits depreciation year by year, complete with a five-bracket income tax calculation straight from vintage US tax law." 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 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Finance" slug: "finance" taxonomy: "genre" url: "http://localhost/type/finance/" - name: "Home" slug: "home" taxonomy: "genre" url: "http://localhost/type/home/" media_contents: - id: 56733 title: "Timex Sinclair Public Domain Library Tape 1002" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-1002/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/120_Depr.png" media_type_tags: "Finance, Home" --- # Depreciation and Income Taxes This program calculates depreciation schedules and income taxes for a capital asset, comparing two depreciation methods side by side: Straight-Line (SL) and Sum-of-Years-Digits (SOYD). The user inputs sales, cost of goods sold, operating expenses, asset cost, scrap value, and asset life; the program then iterates year by year, decrementing the remaining life counter and recomputing SOYD depreciation each pass. Income tax is computed via a subroutine at line 411 using a bracketed marginal-rate table with five bands (17%, 20%, 30%, 40%, and 46%), consistent with late-1970s/early-1980s US corporate tax schedules. Results are printed in a two-column tabular format for each year until the asset life reaches 1, at which point the program halts. *** ## Program Analysis ### Program Structure The program is organised into three logical phases: input collection (lines 5–48), per-year computation and output (lines 70–410), and a shared tax subroutine (lines 411–424). A single `GOTO 90` at line 410 forms the main loop, re-entering at the SOYD depreciation calculation after decrementing `N`, so the loop body spans lines 90–410. The loop terminates via the `IF N=1 THEN GOTO 430` guard at line 390, which branches to `STOP`. ### Depreciation Calculations Two methods are computed in parallel each year: - **Straight-Line (SL):**`F = INT((E-S)/N)` at line 70, where `E` is asset cost, `S` scrap value, and `N` the *original* life — but note that `N` is decremented each iteration (line 400), so from year 2 onward the divisor shrinks and the SL figure is recalculated incorrectly. A correct implementation would preserve the original life in a separate variable. - **Sum-of-Years-Digits (SOYD):**`G = (N²+N)/2` at line 80 (the sum of digits 1…N), then `H = INT(N/G*(E-S))` at line 90. Because `N` is the *remaining* life each pass, this is the standard SOYD formula and behaves correctly. ### Tax Subroutine The subroutine at lines 411–424 implements a five-bracket marginal tax schedule. The caller stores the taxable income in `T` and reads the result from `T1`. The brackets are: | Income range | Base tax | Marginal rate | | --- | --- | --- | | ≤ $25,000 | $0 | 17% | | $25,001–$50,000 | $4,250 | 20% | | $50,001–$75,000 | $9,250 | 30% | | $75,001–$100,000 | $16,750 | 40% | | > $100,000 | $26,750 | 46% | This schedule closely matches US corporate income tax rates in effect circa 1978–1981. The subroutine is called twice per year (lines 112 and 115) with the SL and SOYD taxable incomes respectively, using the variable `T` as both input and working storage. ### Key BASIC Idioms - The `**` operator (line 80) is used for exponentiation to compute `N²`, standard on ZX81/TS1000 BASIC. - `INT()` is applied throughout to truncate fractional currency values to whole dollars. - The echo-print pattern (`INPUT X` followed immediately by `PRINT X`) is used for all inputs (lines 15–16, 25–26, etc.) to confirm entries on the display, a common ZX81 idiom since `INPUT` does not leave the value visible after entry. - A `GOSUB`/subroutine pattern (lines 112, 115 → 411–424) avoids duplicating the tax bracket logic. ### Notable Bugs and Anomalies - **SL depreciation divisor error:** Line 70 uses the current (decremented) value of `N` rather than the original asset life. From year 2 onward, `F` will be larger than the correct annual SL charge, overstating depreciation and understating income. - **Uninitialised `Z`:** The year counter `Z` is never explicitly set to zero; it relies on the system initialising numeric variables to 0, which ZX81 BASIC does, so this works in practice. - **Dead code at lines 126 and 140:**`GOTO 140` at line 126 jumps to line 140, which is the very next executed line anyway; the `GOTO` is redundant. This suggests the program was edited and some intervening lines were removed. - **Net income calculation uses residual `T`:** Line 140 computes `M = T - K`, but at this point `T` holds `J` (the SOYD taxable income) from the second subroutine call, not `I`. The correct SL net income should be `I - K`; using `T` instead produces `J - K`, mixing SOYD income with SL tax. ## Source Code ``` 5 REM DEPRECIATION AND INCOME TAXES(DEPTAX) 6 PRINT TAB (2);"DEPRECIATION AND INCOME TAXES" 7 PRINT 10 PRINT "ENTER SALES" 15 INPUT A 16 PRINT A 20 PRINT "ENTER COST OF GOODS SOLD,EXCEPT DEPRECIATION" 25 INPUT B 26 PRINT B 30 LET C=A-B 31 PRINT "ENTER OPER.EXP." 32 INPUT D 33 PRINT D 40 PRINT "ENTER COST" 41 INPUT E 42 PRINT E 43 PRINT "ENTER SCRAP" 44 INPUT S 45 PRINT S 46 PRINT "ENTER LIFE OF ASSET" 47 INPUT N 48 PRINT N 70 LET F=INT ((E-S)/N) 80 LET G=(N**2+N)/2 90 LET H=INT (N/G*(E-S)) 100 LET I=C-(D+F) 110 LET J=C-(D+H) 111 LET T=I 112 GOSUB 411 113 LET K=T1 114 LET T=J 115 GOSUB 411 116 LET L=T1 126 GOTO 140 140 LET M=T-K 150 LET O=J-L 160 LET Z=Z+1 170 PRINT 190 PRINT "YEAR";Z 300 PRINT ,"ST.LINE","SOYD" 310 PRINT "NET SALES",A,A 320 PRINT "CGS",B,B 330 PRINT "GROSS PROFIT",C,C 340 PRINT "OPER.EXP.",D,D 350 PRINT "DEPRECIATION",F,H 360 PRINT "INC.BEF.TAX",I,J 370 PRINT "INCOME TAX",K,L 380 PRINT "NET INCOME",M,O 390 IF N=1 THEN GOTO 430 400 LET N=N-1 410 GOTO 90 411 IF T>100000 THEN GOTO 417 412 IF T>75000 THEN GOTO 419 413 IF T>50000 THEN GOTO 421 414 IF T>25000 THEN GOTO 423 415 LET T1=INT (.17*T) 416 GOTO 424 417 LET T1=26750+INT (.46*(T-100000)) 418 GOTO 424 419 LET T1=16750+INT (.40*(T-75000)) 420 GOTO 424 421 LET T1=9250+INT (.30*(T-50000)) 422 GOTO 424 423 LET T1=4250+INT (.20*(T-25000)) 424 RETURN 430 STOP 440 SAVE "1012%0" 450 RUN ```