JsSSEM                   

Notes
=====

The Manchester Small-Scale Experimental Machine ("Manchester Baby") was the world's first stored-program electronic computer, constructed in 1948 by Frederic C. Williams, Tom Kilburn, and Geoff Tootill. JsSSEM emulates the SSEM in a browser.

This program differs from other SSEM emulators, including David Sharp's excellent Manchester Baby Simulator in Java, by being written in pure JavaScript and HTML: this means it will work with effectively any browser, including browsers on mobile devices (which typically cannot run Java applets). In fact, JsSSEM is intended primarily for use on smartphones and tablets. If you are using Android or iOS, you can save it to your home screen as a web app.

The SSEM can store up to 32 words, each of 32 bits. Unusually, SSEM binary code is written with the least significant bit first: 01 means two, 001 means four, etc. Negative numbers are stored using two's complement. Two registers are accessible to the programmer: the 32-bit accumulator, and the program counter or CI ("Current Instruction") register.

If the word contains an instruction, as opposed to data, the instruction itself is encoded in bits 13-15 and the operand (if any) in bits 0-4. The operand is always a store address. For instance, 00111000000001010000000000000000 means "subtract (101) the number at address 28 from the number in the accumulator".

Instructions:
  000 -- <operand> to CI -- jump to one address after the address stored at <operand>
  100 -- Add <operand> to CI -- jump ahead by one more than the number stored at <operand>
  010 -- -<operand> to c -- load the negation of the number at <operand> into the accumulator
  110 -- c to <operand> -- store the contents of the accumulator at <operand>
  001 -- Sub. <operand> -- subtract the number at <operand> from the accumulator
  101 -- same as 001
  011 -- Test -- skip the next instruction if the accumulator is negative
  111 -- Stop.

Note that jumps are always indirect (a jump to address 10 would be written as, say, "16 to CI" with the value 9 stored in address 16); addition must be implemented using negation and subtraction; and the only conditional operation is to skip over one word if the accumulator holds a number less than zero.

To program the emulator, use the reddish switches to set or clear bits in the current word (indicated by the cursor on the left of the scrollable disassembly listing). The five switches on the bottom left that control the address field and the three switches on the right that control the instruction field are a slightly brighter red, to help them stand out. Use the other buttons to move forwards and backwards in the program. When you are ready, click "Back to word 0": you can then run the program either straight through or one step at a time. "Stop" halts the emulator while it is running. The "Speed" control allows you to choose between running the program at -- approximately -- the SSEM's full speed, and running it slowed down by a factor of 500 (so that you can watch the store and registers change, and follow the scrollable disassembly). Depending on your computer and browser, even "full speed" may be slower than the actual SSEM: this is particularly true of mobile devices.

You will probably find that you need to draft your SSEM programs in mnemonic notation before entering them at the front panel. To make this easier, a simple line-numbered text area is provided for use as a drafting pad: click the "Drafting pad" button to show it. The contents of the pad are preserved throughout your session, even if you click "Hide drafting pad", unless you use "Clear drafting pad" to empty it.

Two sample programs are provided: one to calculate 2+2, and one to find the twentieth number in the Fibonacci sequence. Once you have worked through these programs (and tried modifying them), you will be fully prepared to program the SSEM independently. If you would like to see some more example programs, consult the SSEM page -- to which JsSSEM users are encouraged to contribute -- at the programming chrestomathy site Rosetta Code.

The original SSEM did not provide any facilities for external storage. On the emulator, you can save your program by clicking the "Save / share" button: the contents of the machine's store are converted to hex and incorporated into a URL, which is then added to the bottom of the drafting pad. Copy this URL and paste it into a text editor program for safekeeping, or into an email, a tweet, etc.

Please email me if you have any questions or if you find a bug.

by Edmund Griffiths, 2016

   

Accumulator = CI =

   

   

   

   


 


 


 


   Current setting: full speed