Search   
Home  Print View  

 

Architecture

Branch Content

Status Registers

Status registers (PC, F, S) define the current state of the machine as programs execute. That is why interrupts take care of saving PC, F and S content to the stack before branching so the machine state is preserved for the interrupted program upon return. The same is also true for CALL instructions.

Program Counter (PC)

When button RUN is pressed in the Console, the CPU starts a "Opcode Fetch Cycle". The memory cell which address is currently indicated by PC, is read into register IR. Then the instruction is decoded and executed, and the Program Counter is incremented appropriately.

Once the instruction is complete, a next Opcode Fetch Cycle is initiated and so on, until the machine is halted some how.

Flags register (F)

Flags bits indicate whether the last instruction resulted in a Carry (C), Zero value (Z), Negative value (N) or Overflow (V) in the target register. All ALU operations (except "pass-through") affects flags, as well as transfer and increment/decrement instructions. Writing to memory does not affect flags.

When pushed or popped to/from the Stack, the Flags register is treated as a monolithic 12-bit register, but its real implementation is different. For one part, only 8 bits are implemented (the 4 most significant bits always read zero). For the other part, flags need to be set/reset individually.

The register F also holds the current ALU function. This is latched as a result of ALU instructions having the LOCK keyword in assembly language (see section "SubClass 010: ALU" in "Instructions Set Architecture").

The following table shows the F register format:


bit   designation   descript
--------------------------------------------------------------------
0     f0            ALU function
1     f1            ...
2     f2            ...
3     f3            ...
4     V             Overflow flag (result rolled-over to zero)
5     N             Negative flag (most significant bit of result is 1)
6     Z             Zero flag     (all bits in result are zero)
7     C             Carry flag    (ALU result did not fit in 12 bits)
8     0             (not used)
9     0             (not used)
10    0             (not used)
11    0             (not used)
--------------------------------------------------------------------

Selection register (S)

The Selection register (S) holds the current memory page number (5 bits) and currently selected channel number (4 bits). The remaining 3 bits are not used and always read zero.

bit   designation   descript
------------------------------------
0     c0            channel number
1     c1            ...
2     c2            ...
3     c3            ...
4     p0            memory page
5     p1            ...
6     p2            ...
7     p3            ...
8     p4            ...
9     0             not used
10    0             not used
11    0             not used
-------------------------------------

Powered by HelpBooks version 0.86, running at: melissa