The TK-82C that arrived in my family's living room in 1984, as I told in 1984, São Paulo: what Brazil's market reserve actually built, came into a world where software was printed. Programs reached most home computers on paper, in magazines and books, as listings to be typed in one line at a time, and the magazines printed a great deal about themselves too: who owned them, who edited them, how many copies they sold. The history of that press, title by title and country by country, is in the Learn article Computing magazines of the world, from BYTE, INPUT and Usborne to Wired and Phrack. This post looks at three kinds of number those pages carried and works each one out by hand: the small number at the end of a line of a listing, the circulation figures in a postal statement, and the arithmetic of a course sold by the week.

The problem with typing a program

A listing is a complete program set in type. In the 1980s you bought the magazine, sat at the computer and typed it in, line by line, then saved it to cassette. A game in (Beginner's All-purpose Symbolic Instruction Code) could run to two or three hundred lines, and every character mattered. A missing comma could stop the program with a syntax error, which was the good case, because the computer told you which line was wrong. The bad case was a wrong character that was still valid BASIC: a 3 typed for an 8 in a number that set a colour or an address, a variable named B where the listing said R. The program ran, and did something else, and you had no idea which of three hundred lines to look at.

The publisher , of Greensboro, North Carolina, answered this with a printed number and a program to check it. Robert Camp's book Creating Arcade Games on the Commodore 64, published by COMPUTE! Publications in 1984, explains the arrangement in its listings chapter: "all of the programs and many of the one-line listings include a checksum number at the end of each line", printed after :rem so that, if a reader typed it by mistake, it would be a harmless remark. The reader was not to type the number. The reader was to type the line, press RETURN, and compare: a short program called the , printed in the book's Appendix J, displayed a number at the top of the screen, and "this checksum number must match the checksum number in the printed listing. If it doesn't, it means you typed the line differently than the way it is listed."

The program that checked the typing

The Proofreader is printed as a BASIC loader of three lines and a block of DATA statements: 133 numbers, poked into the computer's memory at addresses 886 to 1018. Line 100 of the loader reads them, adds them up as it goes into a variable CK, and line 110 refuses to start the Proofreader if the total is not 17,539: "YOU MADE AN ERROR IN DATA STATEMENTS". So the program that checked the reader's typing first checked the typing of itself, with the simplest check there is, a sum.

I added up the 133 numbers as the Internet Archive's text layer of the book gives them. They come to exactly 17,539. That is worth saying, because a scanned book's machine-read text is often wrong; here it is right to the last digit, and the next sections rely on it.

Reading the 133 bytes

The numbers are machine code in the instruction set of the , which the Commodore 64 runs, and they can be read with any table of 6502 instructions. Here are the parts that matter, with the address of each instruction, the bytes as printed (in decimal) and what they do.

AddressBytesInstructionWhat it does
886173 36 3LDA 804Read the low byte of the vector at 804 and 805
889201 150CMP #150Is it already 150 (the Proofreader's own address, 918, is 3 x 256 + 150)?
891208 1, 96BNE, RTSIf it is, the Proofreader is already on: return
894 to 912...STA, LDA, STASave the old vector into bytes 919 and 920, then point the vector at 918
91832 87 241JSR (old vector)Call the computer's own input routine; the two address bytes were overwritten with the saved vector
928201 13CMP #13Was the character RETURN?
932201 32CMP #32Was it a space?
93624CLCClear the carry
937101 254ADC 254Add the character to the running total kept in memory location 254
939133 254STA 254Store the new total
949 to 980...JSR 65490 (several times)On RETURN: print a carriage return, move to the top of the screen, switch on reverse video, print a colon
981166 254LDX 254Take the total
983169 0, 133 254LDA #0, STA 254Reset it to zero for the next line
987 to 1002...LDY, CPY #87, JSRPrint the total as a number, with one of two routines in read-only memory (at 48589 or 56781) chosen by looking at the old vector's low byte

The vector at addresses 804 and 805 (hexadecimal 0324 and 0325) is, in the Commodore 64's memory map, the indirect address of the operating system's routine that fetches the next input character, normally at hexadecimal F157, which is 61783. The Proofreader puts itself in that path. Every character the screen editor hands to BASIC while a line is being entered passes through the instructions at 918 to 948; when the character is neither RETURN (code 13) nor a space (code 32), its code is added, with ADC, to the byte at location 254. When RETURN arrives, the total is printed at the top left of the screen and set back to zero. The book's own description agrees: the Proofreader "is not picky with spaces".

The test at 987 to 992 is a small piece of portability: if the low byte of the original input vector is 87 (hexadecimal 57, as in F157), the number is printed with the routine at 48589; otherwise with the one at 56781. The book does not say which other machine the second address serves, so I will not guess.

The total wraps at 256

The total lives in one byte, location 254, and one byte holds the numbers 0 to 255. When ADC adds past 255 the byte keeps only the remainder: 250 plus 10 leaves 4 in the byte (260 minus 256) and sets the carry flag, which the next CLC clears before the next addition. So the number shown is the sum of the character codes, divided by 256, keeping the remainder: the sum modulo 256. Every :rem number in the book is between 0 and 255, as it must be.

Working a line by hand

The book's first long program, "Screendemo", ends with the line printed as 80 NEXT:NEXT :rem 32. Type 80 NEXT:NEXT and the Proofreader sees these characters, without the space:

Character80NEXT:NEXT
Code5648786988845878698884

The codes are those of the Commodore character set, which agrees with (the American Standard Code for Information Interchange) for digits, capital letters and punctuation.

  1. The line number: 56 + 48 = 104.
  2. The word NEXT: 78 + 69 + 88 + 84 = 319. It appears twice: 638.
  3. The colon: 58.
  4. The sum: 104 + 638 + 58 = 800.
  5. Modulo 256: 3 x 256 = 768, and 800 - 768 = 32.

The screen shows 32; the book says 32. The line was typed correctly.

A longer line from the same program, printed as 70 FOR T=0 TO 1000:NEXT :rem 236:

  1. 7 and 0: 55 + 48 = 103.
  2. FOR: 70 + 79 + 82 = 231.
  3. T, =, 0: 84 + 61 + 48 = 193.
  4. TO: 84 + 79 = 163.
  5. 1000: 49 + 48 + 48 + 48 = 193.
  6. The colon: 58.
  7. NEXT: 319.
  8. The sum: 103 + 231 + 193 + 163 + 193 + 58 + 319 = 1,260.
  9. Modulo 256: 4 x 256 = 1,024, and 1,260 - 1,024 = 236.

The book says 236. The four other lines of the program check the same way: 20 FOR BR=0 TO 15 sums to 851, which leaves 83; 30 FOR BG=0 TO 15 to 841, leaving 73; 40 POKE 53280,BR to 853, leaving 85; 50 POKE 53281,BG to 844, leaving 76. Those are the numbers printed in the listing.

What a sum cannot see

Now break the line on purpose, three ways.

One wrong character. Type 80 NEXT:NEXR. R is 82, two less than T, so the sum is 798 and the Proofreader shows 30, not 32. Caught. Any single wrong character changes the sum by the difference between the two codes, and since letters, digits and punctuation all have codes less than 256 apart, a single substitution always changes the number. That is the error a typist makes most, and the check catches all of them.

Two characters swapped. Type 80 NEXT:NETX. The same characters, in a different order: the sum is still 800, and the Proofreader shows 32. Not caught. Addition does not care about order, so a transposition, the second most common typing error, passes.

Two errors that cancel. Type 20 FOR AS=0 TO 15 instead of 20 FOR BR=0 TO 15. A is one less than B (65 against 66), S one more than R (83 against 82). The sum is unchanged, the Proofreader shows 83, and the program now counts with a variable the rest of the listing never uses. Not caught. This is rarer, but it shows the principle: a sum sees only the total, and many different lines share a total. With 256 possible values, a random garbling of a line has about one chance in 256 of showing the right number by accident.

Spaces. The Proofreader skips them by design. The book warns that "occasionally proper spacing is important, so be extra careful with spaces"; inside quotation marks, where a program prints text on the screen, a missing space is a real difference the check will never see.

Why not something stronger?

A check that notices order has to give each position a different weight: multiply the running total by a constant before adding the next character, or shift it, as the cyclic redundancy checks used by disk drives and modems do. On a 6502 that costs instructions. The whole Proofreader, including the code that hooks it into the input routine, prints the number and restores the registers, is 133 bytes, at addresses 886 to 1018. The adding part is three instructions: CLC, ADC, STA, four bytes in all. A weighted check would have been longer, slower on every keystroke, and harder for the reader to type in correctly in the first place, which matters when the reader types the checker too. The designers chose the check that catches the commonest error and costs almost nothing. The book also gives the reader a way round its one practical trap: lines entered with abbreviated keywords give a different sum, so it tells the reader to LIST the line and press RETURN on it again, so that the Proofreader sees the keywords spelled out.

The second number: how many copies

A magazine printed numbers about itself as well. In the United States, a periodical mailed at the second-class rate had to publish once a year a Statement of Ownership, Management and Circulation, required by section 3685 of title 39 of the United States Code, and it was a legal declaration, signed by the publisher. BYTE printed its statement, filed on 1 October 1983, in the December 1983 issue. It names McGraw-Hill as owner, Gene W. Simpson as publisher and Lawrence J. Curran as editor, and gives, for the average issue of the previous twelve months:

  • A, copies printed: 418,833
  • B1, sold through dealers, newsstands and counters: 119,624
  • B2, mail subscriptions: 266,805
  • C, total paid: 386,429
  • D, free copies: 5,165
  • E, total distribution: 397,594 (as the text layer reads it)
  • F1, office use, left over and spoiled: 6,130
  • F2, returned by news agents: 21,109
  • G, total: 418,833

Add it up, as the form intends. B1 plus B2 is 386,429, which is C: good. C plus D should be E: 386,429 + 5,165 = 391,594, not 397,594. Which is right? The form gives a second check: E plus F1 plus F2 must equal G, the copies printed. With 391,594 the total is 391,594 + 6,130 + 21,109 = 418,833, exactly. With 397,594 it would be 424,833, six thousand more copies than were printed. So the statement said 391,594, and the 7 is a 1 misread by the scanner's character recognition, or misprinted in 1983; only the page image can say which. The lesson is the same as with the Proofreader: a column of figures carries its own check, and a figure copied without adding its column can be wrong by thousands.

The figures then say something about the magazine. Subscriptions were 266,805 of 386,429 paid copies, 69.0 per cent: BYTE was a magazine people committed to for a year at a time. Of the copies sent to newsstands, 119,624 sold and 21,109 came back: a sell-through of 119,624 divided by 140,733, which is 85.0 per cent. The same statement in Microcomputing, the former Kilobaud, filed the same day and owned by the International Data Group, shows a smaller and more newsstand-bound magazine: 81,156 paid copies of 104,270 printed, only 48.5 per cent of them by subscription, and a sell-through of 41,817 out of 58,512, which is 71.5 per cent. Its column adds up first time: 81,156 + 802 = 81,958, and 81,958 + 5,617 + 16,695 = 104,270.

British magazines printed a different kind of figure, a circulation certified by an audit bureau, beside the bureau's mark. Your Sinclair of April 1993, published by Future Publishing in Bath, prints 40,648 next to the line "Your guarantee of value". It is one number, without the columns that let you check it, which is why the American statement is the better document.

The third number: what a reader paid, and what a reader was paid

A partwork. INPUT, Marshall Cavendish's course in weekly parts, told its readers in part 1 how to order the binders: "There are four binders each holding 13 issues." Four times thirteen is 52 parts, one a week: a year at the newsagent, and a four-volume reference at the end of it. The Italian edition, published by De Agostini in Novara in 1984, adds the business terms: back issues cost a supplement of 400 lire once twelve weeks had passed since publication, and the publisher reserved the right to change the cover price during the run "if compelled by changed market conditions". A partwork was sold on the promise of the whole, and priced on the reader's reluctance to leave a gap in the binder.

A weekly. MicroHobby, published every week in Madrid by Hobby Press from November 1984, sold the programs printed in its pages on cassette, four issues to a tape: the first tape held the programs of issues 1 to 4, the second those of 5 to 8, at a special price of 550 pesetas plus 75 for registered post. So a reader could buy the typing instead of doing it, for 625 pesetas every four issues.

A paper that paid its readers. Hebdogiciel, the French weekly of Shift Éditions, put it on its first front page: its readers would become "the journalists of your own newspaper", and it would pay 1,000 francs per printed page for the programs, tips and articles they sent in. The listing ran in both directions. A reader who typed in other people's programs one week could be paid for their own the next.

The listing's afterlife

The listing did not survive the 1990s. Cover tapes and then cover discs gave readers the programs without the typing, and the reader stopped reading the code. What the numbers in this post show is how much care went into the transfer of a program by paper: a checksum on every line, a checksum on the checker, a printed statement that adds up to the copy. The same ideas carry every file you download today, with stronger checks, longer numbers and no human in the loop.

One title of that press still prints its own numbers on paper. , which began as a text file on a St. Louis bulletin board on 17 November 1985, released issue 73 on 17 November 2026, forty-one years to the day, and its index page lists every issue's date from the first. Its story, and that of 2600, is told in Phrack, 2600 and the underground press. The magazines of the market-reserve years in Brazil, which printed their own listings for the TK-82C and its cousins, are in the article on Brazil's computing press.

Sources