Introducing computer concepts by simulating a simple computer

The simulated computer consists of (1) main memory, (2) a register known as the accumulator, (3) a central processing unit (CPU), and (4) an instruction counter. This computer recognizes 8 op codes (Halt, Load, Store, Add, Subtract, Read, Write, and Branch On Zero). The computer is simulated by creating a program in Pascal or C++. This program simulates the execution of programs written by students, such as adding two numbers and printing their sum. Student programs are written in machine language and executed by the simulated computer. Students can write programs in assembly language, compile them by hand, and then test them by running them on the simulated computer. This example has been helpful in teaching students what a computer is and what computers can do.