# Jump Instructions on the CDC 160

This document is one section of the CDC 160 Programmer's Reference Manual.

## Relative Jump Instruction Format

```            11 10 09 08 07 06 05 04 03 02 01 00
___________________________________
|  |  |  |  |  |  |  |  |  |  |  |  |
|__|__|__|__|__|__|__|__|__|__|__|__|
|        |f/|     |                 |
|        |/b|     |                 |
|                 |                 |
|                 |                 |
|     6-bit F     |     6-bit E     |
```
This group of instructions allows program counter relative jumps that are conditional on the value in the accumulator A. Bit 8, the f/b bit, determines whether the jump is forward (0) or backward (1). The destination address computation is as follows:
```    if f/b = 0
then dst = P + E
else dst = P - E
```
In all cases, jumping loads dst into PC; if the conditional jump fails, PC is merely incremented by 1, as usual for sequential execution.

### 110x00 - Zero Jump

Jump if all bits of A are zero.

### 110x01 - Non-Zero Jump

Jump if any bit of A is nonzero.

### 110x10 - Positive Jump

Jump if A is positive.

### 110x11 - Negative Jump

Jump if A is negative.

## Indirect Jump Instruction Format

```            11 10 09 08 07 06 05 04 03 02 01 00
___________________________________
|  |  |  |  |  |  |  |  |  |  |  |  |
|__|__|__|__|__|__|__|__|__|__|__|__|
|                 |                 |
|                 |                 |
|     6-bit F     |     6-bit E     |
```
This group of instructions allows indirect jumps to any location in memory.

### 111000 - Jump Indirect

Use E to address one of the first 64 memory locations, and load the contents of that location into P.

## Function Calls

The CDC 160 has no instruction to both transfer control to a function and save the return address. Therefore, the programmer must create this effect using an instruction sequence. The most common way to do this on early CDC machines follows the following model, coded assuming the hardware upgrades released with Serial Number 37 and up (and probably retrofitted into most of the other 36 machines):

```x  : 010010000000 - Load Forward Relative
x+2: 100001000000 - Store Indirect
x+3:      p       - (destination return link)
x+4: 111001000000 - Jump Forward Indirect
```p-1: 111001000000 - Jump Forward Relative