Section 7.5: Fetch/decode/execute cycle (Frame 4)                     [prev][home][next]

Third, several of the instructions alter the program counter, or PC register. This is done during the execute stage by writing a new value into PC. Notice that 1 is added to PC after the instruction is fetched. However, if PC is entirely overwritten, this incremented PC value is lost and has no effect. The following instructions all change PC: JMP, JZ, JC, JP, JN, JV, CAL, RET. Some of them always change the PC, like JMP, CAL, and RET. These are called unconditional jumps. Others are conditional because they depend upon the condition bits CNVZ. Note that JP, jump positive, is done when N=0. All others are done when one of the four condition bits is 1. Synonyms for jump are branch or goto.

CAL and RET are used to call a subroutine and return from it. Subroutine is another term for subprogram, function or procedure. All are implemented in the same way. These instructions are considered jumps because they alter PC.