Simulator — Imaginary Computer

by Kari Laitinen

Through the link below you can activate IC8, a simulator for the imaginary computer that is presented in my programming books.


The imaginary computer is an extremely simple 8-bit computer with which it is easy to learn the basics of computer technology. The following links provide useful information:



IC8 is a useful tool for self study and in courses such as Introduction to Computer Architectures or Basics of Computer Technology.

The architecture of the imaginary computer simulated by IC8 is extremely simple. Thus the computer architecture should be easy to learn. Yet it is possible to perform many traditional computing tasks with this simple computer architecture.

The traditional computing tasks that IC8 can do include conditional jumps, loops, subroutine calls with the help of stack, basic arithmetic and stack operations. Despite the small size of the main memory, IC8 can run rather complicated programs. For example, the simulator includes programs which perform software-based multiplication operations.

You may use the IC8 simulator freely, but the JavaScript programs which it is made of are not public, and the program files may not be copied.


Instructions to use IC8

IC8 is a simulator program which imitates the behavior of the imaginary computer on a real computer.

  • By pressing the Load button, you can load an executable program into the main memory of the imaginary computer. There are many compiled ready-to-run executable programs built in the simulation program.
  • After a program has been loaded with the Load button, it can be executed by pressing the Execute button. The Execute button transforms to Pause button with which you can stop the execution temporarily. When the program is stopped, this button is the Continue button with which you can resume program execution.
  • The execution speed of the simulator can be adjusted with the 'leds' that you can find below the small screen. By clicking these leds with the mouse, you can switch them on or off. The more leds are on, the greater is the speed of the simulator.
  • The Reset button loads value 00H to register PROGRAM POINTER and value FFH to all other important processor registers. The INPUT READY signal is set to 0. The screen is cleared, but the contents of the main memory are not modified.
  • By clicking the Translate button, you can see a kind of textual form of the program in the main memory. Re-click it for returning back to the normal view.
  • With the Modify button you can put the simulator to a mode in which you can modify the contents of the main memory. After the Modify button has been pressed, you can click on memory locations with the mouse and enter new values to the selected locations through the keyboard. You must repress the Modify button to get back to the normal simulation mode.
  • By selecting one of the buttons with labels 16, 10, or 2, you can choose the numbering system in which numbers are shown inside the main memory and the registers. It is recommended that you select the hexadecimal numbering system because that numbering system is used when the simulator displays text lines while it is executing a program.
  • An important feature of the simulator is that if you click with the mouse on an instruction in a memory location, when the simulator is executing a program, the execution goes with maximum speed until the clicked instruction, and continues then with the normal, selected speed. (There is no Step button in IC8, but this feature can be used instead of the Step button.)
  • When the simulator starts operating, it displays some text lines and shows a red light on the Load button. This takes something like 10 seconds. You can, however, begin using the simulator while these starting ceremonies are going on.
  • WARNINGS: While you are using the IC8 simulator program, you should remember that there may be errors in it. Although I do not know about any serious errors, I cannot guarantee that the program always works correctly. And most importantly, I shall not assume any kind of responsibility for any kind of damages that may result from the use of the simulator. Because the simulator may consume quite a lot of computing power, it may be a wise decision to close the simulator page when it is no longer needed.
  • If it seems that the IC8 simulator is not operating properly, a wise thing to do is to first close your browser, restart the browser, and then go back to the page of the simulator.
  • You do not need to load a program before you press the Execute button. It is thus possible that you use the Modify mode and write your own program to the simulator. The simulator stops if it finds an unknown instruction code in the main memory.
  • When the simulator program is executing, it is possible that it is difficult to write a new Internet address into the address field of your browser. To solve this problem, use first the Back button of your browser to exit the simulator page. As the simulator is a computer program that is being run when its page is open, it may be a good idea to exit the simulator page when you are not actually using the simulator.


Exercises with the IC8 simulator

by Kari Laitinen

In order to do the exercises below you need to have a table of ASCII/Unicode character codes available. Such a table can be found here.

Load program hello.iml into the main memory and do the following:

  • Modify the program so that it prints "Hello?" instead of "Hello!"
  • Modify the program so that it prints "Cheers".
  • Modify the program so that it adds an exclamation mark to the end of the text and prints "Cheers!".

Load program hello_loop.iml into the main memory and do the following:

  • Modify one (and only one) byte of the program so that it prints "Hello?" instead of "Hello!".
  • Modify one (and only one) byte of the program so that it prints "Hello" instead of "Hello?".
  • Modify the program so that it prints "Hello, world".

Load program abcde.iml into the main memory and do the following:

  • Modify one (and only one) byte in the program so that it prints "GHIJK" istead of "ABCDE".
  • Modify two bytes (one operand and one instruction) in the program so that it prints the letters in reverse order so that instead of "GHIJK" it prints "KJIHG".

Load program aaaabbbbcccc.iml into the main memory and do the following:

  • Modify one (and only one) byte in the program so that it prints "xxxxyyyyzzzz" instead of "aaaabbbbcccc".
  • Modify the subroutine of the program so that it prints the given character five times, i.e., instead of "xxxxyyyyzzzz" the program should print "xxxxxyyyyyzzzzz".
  • Modify the already modified subroutine by replacing the second and fourth of the output_byte_from_register_a instructions with instructions decrement_register_a and increment_register_a, respectively, so that the whole program prints "xwxyxyzyz".

Videos about computing basics



Although the simulator architecture is designed by me, Kari Laitinen, I have had clever students working in the implementation of the simulator.

  • The first version of IC8 was a Java Applet. Jukka Tervaskanto wrote most of the Java programs for the first version of the simulator. He did great work and invented some nice features to it.
  • Joonas Salmela made most of the programming for the version 1.2 of the simulator. His work wasn't just transforming Java programs to JavaScript. He invented clever solutions which helped to make the animations possible in the single-threaded JavaScript environment.