Summary
We started this chapter by designing a computer simulator. However, we haven’t created a final product yet. Instead, we looked at some of the issues involved, such as the nature of an instruction set and the structure of an opcode.
We examined how an instruction can be decoded and how it can be executed. We also took the opportunity to broaden our knowledge of Python and introduced Python’s bit-manipulation facilities, which let us implement machine-level instructions that operate on bits.
We also introduced an important component of Python, known as a function, which allows the programmer to create a self-contained unit of code that can be called to perform a specific job from many points in a program. Functions are vital to modern programming because they facilitate elegant design by bundling a complex sequence of operations into a unit, which you call to carry out a task.
In Chapter 5, we’ll return to Python and look at some topics in a little...