Programming the CPU
To make the CPU perform a task, you need give it a corresponding program, describing how to perform that task.
From the CPU's point of view, a program is a list of native instructions. The only instruction the Qibec CPU can perform is called "IBC" (Invert, and Branch if Clear). Arguments to each such instruction specify what has to be inverted, and where to branch to.
The programmer can choose to write programs using only IBC-instructions, or use an abstraction-layer to generate programs more easily.
In this chapter...
- As mentioned above, the most spartan way of writing programs is directly at the machine-level, using only the IBC-instruction - Qibec's native tongue, so to say.
- In order to make Qibec appear more like a regular CPU, an extended assembly-language can be used to program in. This new layer implements more meaningful pseudo-instructions in terms of multiple native IBC-instructions.
- An assembler is a utility to convert assembly-language programs into machine-code to be executed by the CPU. Basic use of the assembler is explained.
- Humans make mistakes. To catch some programming-mistakes, an assembly-validation utility is introduced. Pieces of code can then automatically be checked against a behaviour-description in terms of input- and output-arguments.