From the unprivileged user’s perspective, the CPU have a register file of 16 16-bit registers (let us denote them as R0 to R15 for brevity) and the 16-bit status register (SR). Registers in the register file, with some minor assumptions, can be called general purpose registers, similar to other architectures.
Each general-purpose register in the register file can be addressed in any way by any capable instruction. In addition, some of the common purpose registers have specific meaning and can be used implicitly in some special instructions. Those registers are:
- R15, which holds a pointer to the next instruction or immediate operand and can be aliased as IP (Instruction Pointer),
- R14, which holds a copy of R15 in the beginning of a subroutine and can be aliased as LR (Link Register).
The status register can be accessed using dedicated instructions. It contains various flags for use with the only conditional instruction SKIP:
- P − parity flag; 1 if the result is odd, 0 if even,
- N − sign flag; 1 if the result is negative,
- Z − zero flag; 1 if the result is zero,
- V − overflow flag; 1 if the signed arithmetic’s overflow just happened,
- C − carry flag,
- other bits are reserved and reads as zeroes.
Some instructions can treat a register as a word or a byte. In the latter case, only the lower 8 bit of the register’s content is accessed.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.