1.3 Computer Hardware Organization
We begin by familiarising ourselves with the computer hardware.

Figure 1.1 Internal block diagram of a CPU.
The function of the CPU is to fetch these instructions from memory and execute them. To perform the actions of fetch and execute, they use the following:
- Foremost among the resources at disposal of the CPU are a number of registers. The CPU uses registers to store information temporarily. More on this topic in section 1.8.
- The CPU also has what is called the ALU (arithmetic logic unit). The ALU section of the CPU is responsible for performing:
- arithmetic functions — add, subtract, multiply, and divide
- logic functions — AND, OR, and NOT
- Every CPU has a program counter. The function of the program counter is to point to the address of the next instruction to be executed.
- The contents of the program are placed on the address bus to find and fetch the desired instruction.
- In the control unit, the function of the instruction decoder is to interpret the instructions fetched into the CPU. It kind of acts as a dictionary.
1.5 Memory System Operation
Every computing system has a memory map, which is a structure of data that indicates how memory is laid out. Every memory location has two components: contents and address.

Figure 1.2 9S12 Memory Map.
The HCS12 has 64k bytes of memory space. This memory space has addresses $0000
to $FFFF
, which are divided into four sections.
- Register:
$0000
to $03FF
- EEPROM:
$0800
to $0FFF
- RAM:
$2000
to $3FFF
- Code ROM:
$4000
to $FFFF
The important one to look at is the code ROM space, which is set aside for program space used for the program code. The RAM space is for data storage and the EEPROM is used mainly for storage of critical data.
1.8 The HCS12 CPU Registers