User`s manual

54 rabbit.com The Rabbit BIOS
6.5.2.6 Origin Directive Examples
The diagram below shows how the origin directives define the mapping between the logical and physical
address spaces.
#define DATASEGVAL 0x91
#rvarorg rootdata (DATASEGVAL) 0xC5FF 0x6600 apply // grows down
#rcodorg rootcode 0x00 0x0000 0x6000 apply
#wcodorg watcode (DATASEGVAL) 0xC600 0x0400 apply
#xcodorg xmemcode 0xF8 0xE000 0x1A000 apply
// data declarations start here
Dynamic C defines macros that include information about compiling to RAM or flash, and identifying
memory device types, memory sizes, and board type. The origin setup shown above differs from that
included in the standard BIOS included with Dynamic C as the standard BIOS uses additional macro val-
ues for dealing with a wider range of boards and memory device types.
NOTE: This mapping assumes separate I&D space is disabled.
6.5.2.7 Origin Directives in Program Code
To place programs in different places in root memory or to compile a boot strapping program, such as a
pilot BIOS or cold loader, origin directives may be used in the users program code.
For example, the first line of a pilot BIOS program, pilot.c, would be
#rcodorg rootcode 0x0 0x0 0x6000 apply
A program with such an origin directive could only be compiled to a .bin file, because compiling it to the
target would overwrite the running BIOS.
xmemcode
stack
rootdata
rootcode
Logical Address Space
Physical Address Space
watcode
0x6000
0xC5FF
0xCDFF
0xE000
0x00000
0x06000
0x20000
0x97000
0x9DDFF
0xFFFFF
rootcode
xmemcode
rootdata
watcode
0xFFFF
0x0000