Search › A-Z › T › TX-0

TX-0

1956 Open source · MIT Online

This is a from-scratch, in-browser emulator of the MIT TX-0, one of the first transistor computers, finished at Lincoln Laboratory in 1956 and lent to MIT in 1958, where students could sit down at it alone. It is an 18-bit, one's-complement machine with an accumulator, a live register and, by the end, 8,192 words of core. It began with only four orders: store, add, transfer on negative and operate, whose address bits were themselves a row of micro-orders.

All three of its order codes are here: the original four orders, the code of July 1960 and the code with an index register that it had from 1961 and 1962. The real tapes that survive run on them. By default it reads in the MOUSE tape of August 1961, with its first sample maze, and sets a mouse looking for cheese on the scope. Other configurations play Tic-Tac-Toe with the light pen, run Munching Squares and LEARN, play Bach through the speaker on bit 14 of the accumulator when you press Restart, debug with FLIT, and assemble with MIDAS.

The surface is the console: lamps for every register, toggles for TAC, TBR and all sixteen toggle switch storage registers, and the Stop, Restart, Read-In, Test and Tape Feed buttons, all live, beside the point-plotting scope and the Flexowriter's two-colour paper. The keyboard is the Flexowriter's.

Because the entire machine is plain JavaScript, it plugs into the shared debugger: single-step instructions, watch the accumulator and live register, disassemble with the symbols of whichever order code the tape needs, set breakpoints and write watchpoints, and read core word by word in octal.

Runs on: Web browser

TX-0 Online Emulator

Play TX-0 using JavaScript directly in your browser.

Configurations

ConfigurationEmulatorMachineOSLegal
MOUSE, sample mazeTX-0TX-0greyOpen ⛶
Tic-Tac-ToeTX-0TX-0greyOpen ⛶
Munching SquaresTX-0TX-0greyOpen ⛶
Convolution, Feb 1959, on the original four ordersTX-0TX-0greyOpen ⛶
Bourree, MUSIC X (speaker)TX-0TX-0greyOpen ⛶
Jesu, Joy of Man's Desiring, MUSIC X (speaker)TX-0TX-0greyOpen ⛶
Die wohl temperirte Rechnungsmaschine, MUSIC X (speaker)TX-0TX-0greyOpen ⛶
Type Music (speaker)TX-0TX-0greyOpen ⛶
LEARN: a Perceptron with 200 samplesTX-0TX-0greyOpen ⛶
Flexowriter testTX-0TX-0greyOpen ⛶
Op code test (machine diagnostic)TX-0TX-0greyOpen ⛶
Light gun testTX-0TX-0greyOpen ⛶
Toggle switch storage displayTX-0TX-0greyOpen ⛶
FLIT II, the debuggerTX-0TX-0greyOpen ⛶
MIDAS assembling a real source tapeTX-0TX-0greyOpen ⛶

Machines emulated

Chips

Notes

Embedding

The core has no dependencies and no DOM, so it runs under Node as well as in a page. Load it, add the console if you want one, and own the loop:

<script src="tx-0.js"></script>         // window.TX0, the machine
<script src="tx-0-render.js"></script>  // window.Console0, scope, console and paper
<script src="tx-0-sound.js"></script>   // window.Speaker0, AC bit 14

var m = new TX0({ order: TX0.ORDER_1962 });
m.loadTape(bytes);            // a Uint8Array, one byte a line of tape
m.pushReadIn();
m.run(m.cycles + 166667);     // one second of machine time, 6 microseconds a cycle
m.pushRestart();               // after a delayed start the tape stops and waits for this
MemberWhat it does
m.run(c), m.step()Run to a cycle count, or one instruction or one word of read-in.
m.pushStop(), pushRestart(), pushReadIn(), pushTest()The console push buttons.
m.AC, LR, MBR, MAR, PC, IR, XR, PFRegisters. Bit 0 of the memos is the top of 18.
m.TAC, m.TBR, m.tss, tssCm, tssLr, cmSelectThe toggle registers and toggle switch storage with its routing.
m.onPoint(x, y), onPrint(code), onPunch(line), onChime()Callbacks for the scope, typewriter, punch and chime.
m.penX, penY, penOpen, penGun, penRadiusThe light pen, in raster positions from the lower left.
m.typeChar(c), m.typeCode(n)Strike a key, by host character or by Flexowriter code. A host character brings its own case shift.
m.spkEdgesGive it an array and it collects the cycle stamp of each change of AC bit 14.

A tape image holds one byte per line: channels 1 to 6 in bits 0 to 5 and the seventh hole in bit 6. As on the machine, the reader passes over any line with no seventh hole, so a tape's punched title costs time and nothing else.

Debugger integration

The plug-in is tx-0-debug.js, with a new decoder in /debugger/src/cpus/tx0.js. The decoder asks the machine which order code it has and uses that code's symbols, so one word can read cla at 740000 under the 1960 code and something else under the 1962 code. Words with no symbol of their own are spelled out in micro-orders.

Registers are read and written live. The debugger's fields are hexadecimal, as everywhere on this site, and the console panel shows octal beside each row of lamps. The flags are RUN, IOS, CH (chime), R (read-in), T (test), LP1 and LP2, from the indicator list in the Functional Description.

Memory. core is word addressed, so the PC, breakpoints, watchpoints and disassembly all use real TX-0 addresses, but the shared address column and fields are hexadecimal: octal 520 is 150 there. Each disassembly line therefore starts with the octal address, as in @00520. Its hex column shows the low byte of each word. core18 shows every bit, three bytes a word, and tss the toggle switch storage. Reads go straight to the arrays and have no side effects.

Single step is one instruction, or one word during read-in. Execution breakpoints are checked before each instruction in normal mode, against the PC, and are not checked during read-in or test mode. Write watchpoints hook the one store path, including writes aimed at toggle switch storage, which the switches then ignore. Pausing stops the emulator's clock and leaves the machine's own state alone, so it is not the same as the console's STOP.

Architecture

The TX-0 was built at MIT's Lincoln Laboratory and first ran in 1956, one of the first computers built mainly of transistors. Its job was to test transistor circuits and a very large core memory for the TX-2. In 1958 it came to MIT on long loan, without most of its memory, and students were allowed to sit at it alone. The people who taught themselves there went on to the PDP-1.

  • Eighteen bits, one's complement. The accumulator is a ring adder: a carry out of the top comes round into the bottom. The live register is a register of flip-flops with no address, the machine's main link to its typewriter and later a second working register.
  • Three order codes. It began with four orders: sto, add, trn and opr, with two bits of code and 16 of address over 65,536 words. Back at MIT it had 4,096 words at first, then 8,192, and the code grew as the memory shrank: tra in May 1959, llr and slr that July, then a new operate layout by June 1961 and an index register in the same code soon after. Tapes from different years expect different machines, so each configuration here sets the code its tape needs: the 1958 code of the Functional Description, the code of memo M-5001-27 (July 1960), and the code of M-5001-27-1 (June 1961) and M-5001-27-4 (1966). The operate class is decoded bit by bit in the time-pulse order of each memo's chart, so any combination of micro-orders does what the chart says, including the odd ones.
  • Read-in mode. READ-IN needs no program in the machine. Three lines of tape make a word; if it is sto or opr, three more are stored there; trn leaves read-in and transfers; add stops, and RESTART then does the trn. Real tapes use this to load an input routine at the top of memory, which reads the rest in blocks with a checksum.
  • The scope plots 511 by 511 points. Bits 0 to 8 of AC are x and bits 9 to 17 are y, with the origin in the centre and one's complement below it. The 1966 memo adds a switch to move the origin to the lower left, and that is the ORIGIN switch. The tube's phosphor is not recorded in the memos used here, so the look of the flash and tail is an approximation. The display order's time is not recorded either: 48 microseconds is assumed.
  • The light pen sets a flip-flop when it sees a point being plotted, and the program reads and clears it with pen. Nothing is sensed from the glow on the screen, only the flash. The memo on the focusing pen gives a view 1/16 to 1/3 inch across and a shutter; here the shutter is the pointer button and the view is 8 points in radius.
  • The speaker hangs on AC bit 14. MUSIC X depends on that. Its pitch words have the low four bits clear, so bit 14 only moves when an end-around carry reaches it, and the bit divides the carry rate by 16. Adding once every 12 microseconds, 5a in its table comes to 439.96 cycles a second where the listing's comment says 440. Any program makes noise this way, as it did on the machine, so the speaker starts off except where the tape is music. The audio amplifier's volume knob is not here. The chime is real, the tone given to it here is not recorded anywhere, and NO CHIME, a real console switch, starts on.
  • The Flexowriter prints a real two-colour ribbon at ten characters a second, and the punch runs at ten lines a second. A key struck sets the sign of the live register and puts its code in the register. The 1958 memo gives bits 2, 5, 8, 11, 14 and 17 and the 1958 code here does that; no later memo that was read describes it, but the key tables in MICROFLIT (1960) and FLIT only work with the code in bits 1 to 6, so the later codes do that.
  • Toggle switch storage is 16 registers of 18 switches that can stand in for core 0 to 17, each with its own cm and lr switches and a master CM SELECT, routed as the Functional Description tabulates: switches, or the live register, or core.
  • Test mode runs the one instruction in TBR, with sto taking its word from TAC, and the STEP and REPEAT switches stepping its address and repeating it.

The software is all real. Every configuration reads its tape in through the real read-in mode and the tape's own input routine, faster than real time so that the page does not open half a minute into a load: REWIND then READ-IN shows the true speed, 250 lines a second. A configuration that sets TAC or presses RESTART for you says so in its note. The MOUSE statements and steps come from John Ward's 1959 memo, and those for Tic-Tac-Toe and Type Music from the machine's demonstration sheets. Nothing here was written for this site.

Not modelled. Magnetic tape: sel and cpy do nothing. External equipment: ex0 to ex7 are counted and do nothing, tlv never transfers, and the three-voice flip-flops of Samson's later music are absent. The analog input. The Automatic Restart, Read-In and Test switches, Stop on Cycle Zero and One, and the alarm. Parity. The 1958 reader running free without an in-out stop. The console's layout is this site's, and the speed button, the ring on the scope and the card buttons for TAC are the emulator's own. The 1958 code comes from the Functional Description. No tape here needs its full 65,536 words: the February 1959 tape runs in the 4,096 the machine then had.