Machine Instruction Formats
There are several instruction formats (templates that indicates the role of each byte of an instruction) for S08 instructions. I will start with a very basic one. Its official name is the Extended Addressing format. Each extended addressing instruction consists of a one-byte operation code (opcode, for short) followed by a two-byte address called the instruction operand. It is a good idea to think of the two-byte address portion as a pointer constant. It is a pointer in that its 16-bit value is going to be used to identify a memory location involved in the instruction. It is a constant in that instructions normally reside in ROM and cannot change during program execution. Thus, every time a given extended addressing instruction is executed, the same memory location will be involved.
We discover that every machine instruction format will consist of an opcode followed by zero to two operands. Each operand will be one or two bytes. The opcode is normally a single byte (a few are two). Each opcode specifies several things. It identifies any and all registers that will be directly involved when the instruction is executed. The div for example involves the A, H and X registers. Besides the directly involved registers, the PC is always indirectly involved as is often the CCR. During instruction fetch, the PC’s value is increased by the size of the instruction. The machine opcode also identifies the number of operands that follow it in the instruction format along with their order and their size.
Perhaps the most important thing it specifies is the action (or interaction between specified registers and memory, that often involves the ALU) to be carried out during instruction execution. By identifying the number, order and size of each operand, the exact instruction format is identified.