All rights reserved.
But How Do It Know? - The Basic Principles of Computers for Everyone.
Fortunately for you and me, one happy reader of the book is Siegbert Filbinger from Germany. Among many other things, he is an absolute wizard
with his tools, svg and javascript, and he is highly skilled at creating fancy web applications. He decided that he could create a working model of the
Computer described in the book that emulates all aspects of its operation, and he did so. (He also discovered another item now included in the
Errata page.)
Further, he has decided to allow me to share his work with other interested parties.
Therefore, many thanks to you, Mr. Filbinger!
In the Control panel are these controls:

run - The computer will run until you press stop.

stop - Stop the current operation, whether run, cycle or step.

reset - Stop, and set RAM and all Registers to zero.

do tick - Step the clock through one of its four phases. You can watch the ticks by watching 'clk e' and 'clk s'. First, both are off. Then clk e turns
on, then both are on, then just clk e, then back to both off. At the stage where they are both on, you can see which Registers are involved in
copying data from place to place.

do step - Run the clock for one clock cycle. The stepper will advance one, or go from 6 back to 1. If you had started a step by doing a few ticks,
then this will finish that step.

do cycle - Run the clock for one instruction cycle (=six clock cycles) (or finish a cycle you may have started above.)

clock speed - How long does one clock cycle take, in milli-seconds (thousandths of a second.)

wire color, width - Wires that are off are black, wires that are on are red, but you can change the color and width of the 'on' wires here.

start at ram address - The RAM address that the program will be loaded to, when you press 'load to ram.'

load to ram - Copy the compiled program (lower window) into RAM so that the model can execute it.

dump ram - This opens a pop-up window that shows the entire contents of RAM, one line per address. There are four columns, the first is 'ADR'
which shows the address (in decimal), The other three columns show the contents of that address in three different number systems, BINary,
HEXadecimal and DECimal.

program code - This window is where you can write a program using the programming language from the book. When you press the <F2> key
or <Enter>, the program will be compiled and shown in the window below it.
As mentioned above, there are links at the bottom of the model for Copyright Details and Help. At the bottom of the window that pops up, there is a
link that says 'Load sample multiplying 5x5'. When you click this, a program will be placed into 'program code', it will be compiled, and loaded to
RAM. This sample program is similar to the demonstration of multiplication from the book, page 142.
About the CPU Model
Terms of Use
The model is copyright Siegbert Filbinger. The design of the Computer contained therein is copyright John Clark Scott. The model may be used
freely for personal and educational use, as long as the copyrights and contact information on the model are visible. For commercial use, please
contact this web site.
Working Computer Model in your Browser
Differences Between the Book and the Model
When you click on the picture above, a new window or tab will open containing the CPU model. It may take a few seconds to open. It was designed
for a full HD monitor, so it is suggested that you maximize your browser. There is no spare room in the model for the menus that are on every other
page of this web site, so it is suggested that if you create a bookmark or favorite, or share it with a friend, do it from this introduction page.
The model is quite complex, but it is easy to use. Click the buttons and watch it run, see what the parts do.
The ALU is on the left, the Control Section is in the middle, and the RAM on the right. Above and below are the bus and the various registers. On
the far right is a control panel which has buttons to run or step the cpu, and below is a place to write 'program code' in the programming language
we created in the book. Below that is a place that shows what the language becomes when it is compiled. There are links at the bottom for Copyright
Details and Help. They both open the same pop-up window, which contains Copyright details, contact information, a computer instruction reference,
instructions about how to write and compile programs, a handy link that will load a sample program into RAM, and a picture of the book, which when
clicked goes to the web site.
The model is also zoomable and scrollable if you don't have an HD screen.
-First of all, the model shows the details of the cpu and the control unit all in the same diagram, something that wouldn't fit in the book.
-The model includes all of the fixes that are shown on the errata page of this website.
-In both the book and the model, when registers are shown horizontally, they are the same - you read it as a number from left to right. But in the
book, when registers are shown vertically, they are rotated clockwise, the left becomes the top. In the model, vertical registers are rotated
counter-clockwise, the left becomes the bottom. Because of this, the direction of the shifters are opposite. The shapes in the book and model are
the same, but in the book, the upper one is SHL. In the model, the upper one is SHR. To make this work correctly, the order of the outputs of the
3X8 decoder at the bottom of the ALU are adjusted. From the right, after 000, the next two are 010 and 001. The rest are the same. These are
labelled in the model.
Detailed Instructions
Programming Instructions
You can write your own program in 'program code' using the programming language from the book. Pressing the <F2> key or <Enter> will cause
the program to be compiled into 'instruction code' (the only language the computer 'understands') and it will be shown in the window below it.
Clicking 'load to ram' will cause the bytes in the lower window to be copied into the RAM in the model. You can then run or step through your
program and see what it does.

Be aware that the line numbers in both windows start at 0 and step up one at a time. BUT, some instructions compile to one byte, and some
compile to two bytes. Therefore, the top and bottom do not always correspond by line number. In the sample program, the first instruction (line 0) is
'DATA R0, 5'. This compiles into two bytes, which show up below as '00100000' (line 0) and '00000101' (line 1). The next instruction in the top will
be on line 1, and whatever it compiles to, will be in line 2 below, as well as line 3 if it is a 2 byte instruction.

You can also write programs with a plain text editor, such as Windows Notepad. You can do a multi-line select/copy of an entire program in the text
editor, and then place your cursor in the 'program code' window, and do a 'paste' operation. You can also copy from the 'program code' window
into your text editor. Thus you can build a library of programs, and not lose them when you close your browser.

Remember the links at the bottom for Copyright Details and Help. These open a pop-up window which contains a reference of the full computer
instruction set, and further instructions about how to write and compile programs.

Here is another program written by Mr. Filbinger. It calculates fibonacci-numbers and stores them to RAM. You can use your mouse to select the
entire program below, then copy and paste it into the model.
DATA R2, 34
ST R3, R2
DATA R3, 32
LD R3, R0
ST R3, R1
ADD R0, R1
JC 25
DATA R3, 33
LD R3, R2
DATA R0, 1
ADD R0, R2
ST R3, R2
ST R2, R1
JMP 25
Click to open