previous | contents | next

26 Part 1 ½ Fundamentals Section 1½ Abstraction and Notation

Since the memory of the machine is 4,096 words long, addresses have to be 12 bits long. Of the 12 bits in an instruction, 3 bits have been allocated for the operation code (op) and there are only 9 bits (ib, pb, and pa) in the instruction register left for addressing information. These bits, together with some other portions of the processor state, are interpreted by the algorithm to yield the necessary 12 bits of addressing.

Address Computation

Instructions and data tend to be accessed sequentially or within address clusters. This property is called locality. The PDP-8 memory is logically divided into 32 pages of 128 words each. The concept of locality of memory references is used to reduce the addressing information by assuming that data are usually in the same page as the instructions that reference them. The pa portion of an instruction is that "address within the current page." The pb portion of an instruction is used as an escape mechanism to indicate when pa is to be used as an address within page 0 (MP[0:127]) instead of the current page.

The address of the current instruction is contained in last.pc and is used to compute the current page number.

The first step of the algorithm,

DECODE pb =>

begin

0 := MA ='00000 @ pa,

1 := MA = last.pc<O:4> @ pa

end next

indicates a group of alternative actions, to be selected according to the value of the expression following the DECODE operator. The alternatives appear enclosed between begin and end and separated by a comma. The expressions 0 : and 1 : are used to label the statements with the corresponding value of pb. The alternative statements can be left unnumbered, in which case they are treated as if they were labeled 0: =, 1: =, 2: =, etc.

The effective address (MA) is built by concatenating a page number with the page address (pa). The @ operator is used to indicate concatenation of operands. If pb is equal to 0, the effective address lies in page 0. If pb is equal to 1, the current page number is used instead.

Constants prefixed with the single quote represent binary numbers. '00000 represents a 5-bit string, which is concatenated with the 7 bits of pa to yield the 12 bits needed.

The transfer operator = modifies the memory or register specified on its left-hand side. If the right-hand side has more bits than the left-hand side, the right-hand side is truncated to the proper side by dropping the leftmost extra bits. If the right-hand side is shorter, enough 0 bits are added on its left until the length of the left-hand side is matched. Thus, the first conditional statement can be written as 0 : =MA = pa.

The expression <0:4> is used to select bits 0,……, 4 of last.pc. These 5 bits contain the current page number and, together with the 7 bits of pa, yield the necessary 12 bits.

Indirect Addresses

A frill 12-bit target address can be stored in a memory location used as a pointer. The instruction needs only to specify the address of this pointer location. Indirect addresses are specified via a bit in the instruction register (ib) which indicates whether we have a direct (ib=0) or an indirect (ib = l) address.

The second step of the algorithm,

IF not ib => LEAVE MA

is separated from the previous by the operator "next." The statement(s) preceding "next" must be completed before the statement following it can be executed. The first step computes a preliminary effective address. The second step tests the value of ib, and if it is equal to 0, then the preliminary effective address is used as the real effective address. If ib is equal to 1, the preliminary effective address is used to access a memory location containing the real effective address. In the former case, the expression "LEAVE MA" is used to indicate the termination of the procedure (this is similar to a RETURN statement in many programming languages).

Auto Indexing

Constants prefixed with the character # represent octal numbers. Thus #001 is equal to '000000001. The procedure treats indirect addresses as special cases. If a preliminary effective address in the range #0010:#0017 (8 to 15) is used as an indirect address (ib = l), the memory location is first incremented and the new value used as the indirect address:

IF MA<0:8> eqv #001 =>

MP[MA] = MP[MA] + 1 next

MA = MP[MA]

By comparing the high-order bits of MA with #001 and ignoring the lower three bits we are in fact specifying a range of ad dresses (#0010, #0011, #0012, . . . . , #0017). Memory locations #0010: #0017 constitute the autoindexing registers.

Regardless of whether autoindexing has taken place, the last step of the algorithm uses the preliminary effective address (which may have been modified by autoindexing) as the address of a memory location which contains the real effective address:

MA=MP[MA]

previous | contents | next