ST6 and ST7


The ST6 and ST7 are 8-bit microcontroller product lines from STMicroelectronics. They are commonly used in small embedded applications like washing machines.
Although they use similar peripherals and are marketed as part of the same product line, the two architectures are actually quite different.
Both have an 8-bit accumulator used for most operations, plus two 8-bit index registers used for memory addressing. Also both have 8-bit instructions followed by up to 2 bytes of operands, and both have support for manipulating and branching on individual bits of memory.
There, the similarities end.
The ST6 is a Harvard architecture with an 8-bit data address space and a separate 12-bit program space. Operands are always 1 byte long, and some instructions support two operands, such as "move 8-bit immediate to 8-bit memory address". Subroutine calls are done using a separate hardware stack. Data registers are memory-mapped.
The ST6's addressing modes are limited to immediate, 8-bit absolute memory address, and register indirect modes and.
The ST7 is a von Neumann architecture with a single 16-bit address space. The first 256 bytes of RAM have extra flexibility. There are no two-operand instructions except for "test bit and branch". Its registers are not memory-mapped, and it uses general-purpose RAM for subroutine calls.
The ST7 supports a wide variety of addressing modes, including base+index and double-indirect.

ST6 architecture

The ST6 has 64 bytes of RAM and 4096 bytes of program ROM. Larger amounts are accessed by bank-switching the low 2K section of the ROM.
The RAM address space is actually 256 bytes, divided as follows:
Not mapped into the address space is a 12-bit program counter and an associated hardware stack. There are only two status bits, and they are banked based on processor mode, with separate status bits for normal, interrupt and non-maskable interrupt operation.
The first four general-purpose RAM locations are also known as the X, Y, V and W registers, and some instructions can access them using special short addressing modes. The X and Y registers serve as index registers, and can use indirect addressing modes and .
The instruction set consists of one byte of opcode, followed by up to two one-byte operands. The instruction set can be summarized as follows:

ST7 architecture

The ST7 has six registers: the accumulator, X and Y index registers, stack pointer, program counter, and condition code register. Also, double-indirect addressing allows the zero page of RAM to serve as additional registers. An unusual but useful feature is that an interrupt pushes four of these registers on the stack, and interrupt return restores them.
ALU instructions fall into two categories, two-operand and one-operand.
Two-operand instructions use the accumulator as the first source. The addressing mode specifies the second source, which may be:
The destination is usually the accumulator, but a few instructions modify the second source.
One-operand instructions use the specified operand for both source and destination. The operand may be:
Register plus offset computes a full-width sum, so the 8-bit form may address memory up to 255+255 = 510.
In addition to the above, there are three prefix bytes which may be prepended to any instruction for which they make sense: