User`s manual

Dynamic C Users Manual digi.com 335
Place assembly language code into xmem
Pure assembly language code functions can go into xmem.
#asm
foo_root::
[some instructions]
ret
#endasm
The same function in xmem:
#asm xmem
foo_xmem::
[some instructions]
lret ; use lret instead of ret
#endasm
The correct calls are call foo_root and lcall foo_xmem. If the assembly function modifies
the XPC register with
LD XPC, A
it should not be placed in xmem. If it accesses data on the stack directly, the data will be one byte away
from where it would be with a root function because lcall pushes the value of XPC onto the stack.
17.4.2 Increasing Root Data Space
Increasing the available amount of root data space may be done in the following ways:
Enable Separate Instruction and Data Space
A hardware memory management scheme that uses address line inversion to double the amount of logi-
cal address space in the base and data segments is enabled on the Compiler tab of the
Options | Project
Options
dialog. Enabling separate I&D space doubles the amount of root code and root data available
for an application program.
Decrease DATAORG
The macro DATAORG is the beginning logical address for the data segment.
Root data space can be increased by decreasing DATAORG in the BIOS (in RabbitBios.c prior to
Dynamic C version 9.30 or in StdBIOS.c thereafter) in increments of 0x1000. At the time of this
writing, RAM compiles should be done with no less than the default value (0x6000) of DATAORG when
separate I&D space is off. This restriction is to ensure that the pilot BIOS does not overwrite itself.
When separate I&D space is on, DATAORG defines the boundary between root variable data and root
constant data. In this case, decreasing DATAORG increases root variable space and descreases root con-
stant space.
When separate I&D space is off, DATAORG defines the boundary between root variable data and the
combination of root code and root constant data. Note that root constants are in the base segment with
root code. In this case, decreasing DATAORG increases root data space and decreases root code space.
Use xmem for large RAM buffers
xalloc() can be used to allocate chunks of RAM in extended memory. The memory cannot be
accessed by a 16 bit pointer, so using it can be more difficult. The functions xmem2root() and
root2xmem() are available for moving from root to xmem and xmem to root. Large buffers used by
Dynamic C libraries are already allocated from RAM in extended memory.