1 extended code space – Jameco Electronics Rabbit 3000 User Manual

Page 35

Advertising
background image

26

Rabbit 3000 Microprocessor

3.2.1 Extended Code Space

A crucial element of the Rabbit memory mapping scheme is the ability to execute pro-
grams containing up to a megabyte of code in an efficient manner. This ability is absent in
a pure 16-bit address processor, and it is poorly supported by the Z180 through its memory
mapping unit. On paged processors, such as the 8086, this capability is provided by paging
the code space so that the code is stored in many separate pages. On the 8086 the page size
is 64K, so all the code within a given page is accessible using 16-bit addressing for jumps,
calls and returns. When paging is used, a separate register (CS on the 8086) is used to
determine where the active page currently resides in the total memory space. Special
instructions make it possible to jump, call or return from one page to another. These spe-
cial instructions are called long calls, long jumps and long returns to distinguish them
from the same operations that only operate on 16-bit variables.

The Rabbit also uses a paging scheme to expand the code space beyond the reach of a 16-
bit address. The Rabbit paging scheme uses the concept of a sliding page, which is 8K
long. This is the XPC segment. The 8-bit XPC register serves as a page register to specify
the part of memory where the window points. When a program is executed in the XPC
segment, normal 16-bit jumps, calls and returns are used for most jumps within the win-
dow. Normal 16-bit jumps, calls and returns may also be used to access code in the other
three segments in the 16-bit address space. If a transfer of control to code outside the win-
dow is required, then a long jump, long call or long return is used. These instructions mod-
ify both the program counter (PC) and the XPC register, causing the XPC window to point
to a different part of memory where the target of the long jump, call or return is located.
The XPC segment is always 8K long. The granularity with which the XPC segment can be
positioned in memory is 4K. Because the window can be slid by one-half of its size, it is
possible to compile continuously without unused gaps in memory.

As the compiler generates code resident in the XPC window, the window is slid down by
4K when the code goes beyond F000. This is accomplished by a long jump that reposi-
tions the window 4K lower. This is illustrated by Figure 3-5. The compiler is not presented
with a sharp boundary at the end of the page because the window does not run out of space
when code passes F000 unless 4K more of code is added before the window is slid down.
All code compiled for the XPC window has a 24-bit address consisting of the 8-bit XPC
and the 16-bit address. Short jumps and calls can be used, provided that the source and tar-
get instructions both have the same XPC address. Generally this means that each instruc-
tion belongs to a window that is approximately 4K long and has a 16-bit address between
E000+n and F000+m, where n and m are on the order of a few dozen bytes, but can be up
to 4096 bytes in length. Since the window is limited to no more than 8K, the compiler is
unable to compile a single expression that requires more than 8K or so of code space. This
is not a practical consideration since expressions longer than a few hundred bytes are in
the nature of stunts rather than practical programs.

Program code can reside in the root segment or the XPC segment. Program code may also
be resident in the data segment. Code can be executed in the stack segment, but this is usu-
ally restricted to special situations. Code in the root, meaning any of the segments other

Advertising
This manual is related to the following products: