The Prime 9000-series CPUs could contain a mix of 2MB, 4MB, and 8MB memory boards (yes, this was Way Back When) in eight slots... but these had to be arranged in specific ways for the hardware to properly address them. This routine, when given a list of memory boards, determines if the arrangement was legitimate. I wrote a routine like this for each of the CPU series (6300/6500, 4000, 4450, 5300, and 2455).

```/*---------------------------------------------------------------------------
---------------------------------------------------------------------------*/

int

{
int
board_size,
i,
more,
next_board_size,
size = 0;

static int
/* For C9000, physical slot N is followed by next_board_xxx[N], plus
some exceptions (see the code) */
/* physical slot    0  1  2  3  4  5  6  7 */
next_board_4mb[] = {1, 4, 3, 6, 5, 2, 7,-1},
next_board_8mb[] = {4,-1, 6,-1, 2,-1,-1,-1};

/* Handle 9000-class weirdo addressing */
i = 0;
more = TRUE;
while (more)
{
/* Use nifty "next-board" arrays to figure out which board
is next in the addressing scheme of things */
board_size = mem_board[current_boards[i]].kw;
/* Nifty scheme breaks down if a 4MB board is in slot 0 or 4,
followed by a 2MB board.  Check for that and adjust: */
if ((i == 1 || i == 5)
&& mem_board[current_boards[i-1]].kw == 2048
&& mem_board[current_boards[i]].kw == 0)
{
i += 1;
board_size = mem_board[current_boards[i]].kw;
}
if (board_size != 0)
checked_boards[xlate_physical[i]] = TRUE;
if (board_size > last_board_size && board_size != 0)
{
/* Boards in wrong order! */
if (last_board_size == 0)
sprintf (message, "Skipped slot %d%s.",
xlate_logical[i] + 1, slotnamefunc (i));
else
sprintf (message,
"Board %d%s must be before smaller board, not after.",
xlate_logical[i] + 1, slotnamefunc (i));
return;
}
last_board_size = board_size;
size += board_size;
/* 8 MB board? */
if (board_size == 4096) i = next_board_8mb[i];
/* 4 MB board? */
else if (board_size == 2048) i = next_board_4mb[i];
/* 2 MB board? */
else i = i + 1;
if (i == -1 || board_size == 0 || i > 7) more = FALSE;
} /* end "while (more boards to check)" */

/* Some more checking:
8MB board cannot be immediately followed by a smaller board;
4MB board cannot be immediately followed by a smaller board. */
for (i = 0; i < cpu[current_cpu].maxmembd - 1; i++)
{
board_size = mem_board[current_boards[i]].kw;
next_board_size = mem_board[current_boards[i+1]].kw;
if (next_board_size < board_size && next_board_size != 0)
{
i++;      /* NEXT board has the problem */
sprintf (message,
"%dMB board in slot %d%s cannot follow a %dMB board.",
next_board_size / 512,
xlate_logical[i] + 1,
slotnamefunc (i),
board_size / 512);
return;
}
}

return;
}
```