Fortunately for you and me, another happy reader of the book is Vladimir Dinev, from Bulgaria. He enjoyed the book so much that he wanted to
create a tool to help others to learn about the inner workings of CPUs. He has created a working 'virtual machine' of the computer described in the
book. It shows the contents of the RAM, Registers and Flags, and allows you to write programs, compile them, and watch them operate, one
instruction at a time. Further, he has decided to allow me to share his work with other interested parties. Therefore, many thanks to you, Mr. Dinev!
|Working Computer Virtual Machine
The virtual machine (or VM for short) runs in the Windows Command Prompt, as seen below. The RAM occupies most of the screen, with address
numbers above and to the left. On the right are the registers and the flags. The '@' next to IAR, and the '*' next to MAR also appear next to the
corresponding byte in RAM. Below are several decoded instructions with an arrow pointing to the next one to be executed. At the very bottom is
'cmd:', meaning this is where you type in the command you want it to do next. Entering nothing, and pressing the 'Enter' key will execute the next
Get your own copy of this VM in the next two minutes!
Just do these steps: (follow along in the picture below)
1. Open a Command prompt on your computer.
2. Create a new directory on your disk. (md \jcpvm)
3. Change into that new directory. (cd \jcpvm)
4. Click on the three links, below, to download the three files, and save them into this new directory.
5. Enter the compile command (jcpasm.exe Multiply.txt -o multiply.run) Ignore the warning.
6. Enter the command that runs the VM (jcpvm.exe multiply.run)
You should now see the working VM in the Command Prompt window, as in the top picture, above.
Start pressing Enter to watch it work.
GitHub is a website that programmers often use to store the source code to programs that they write.
If you've never heard of GitHub, then this section is probably not for you.
Vlad wrote this VM, assembler, disassembler and pre-processor, and placed it all on GitHub at the link below.
He dubbed it the "John Clark Processing" unit, thus you will see the JCP prefix on a lot of things.
There are versions for Windows, Linux and RaspberryPi.
If you have a GitHub account and want to contribute to the project, welcome!