There are many straight forward ways to 'force' code space data.
Here are two simple examples.
The first example uses an assembly routine to make a smart data array.
The second example is simply data placed in code space, but used directly.
asm UInt32 GetBitRate(UInt16 bits)
{
move.w 4(sp),d0 // retrieve 'bits' parameter
asl.w #2,d0 // make it a dword offset
lea @table,a0 // get the address of the lookup table
move.l (a0,d0.w),d0 // retrieve the entry from the table
rts // return with the entry in d0
@table:
dc.l 0, 32000, 40000, 48000, 56000, 64000, 80000, 96000
dc.l 112000, 128000, 160000, 192000, 224000, 256000, 320000
}
#define GetBitRate(bits) (((UInt32*)BitRateTable)[bits])
void BitRateTable(void);
asm void BitRateTable(void)
{
dc.l 0, 32000, 40000, 48000, 56000, 64000, 80000, 96000
dc.l 112000, 128000, 160000, 192000, 224000, 256000, 320000
}
On 10/25/07, Rob <[EMAIL PROTECTED]> wrote:
> On Thu, 25 Oct 2007 18:16:16 +0100, Ben Combee <[EMAIL PROTECTED]>
> wrote:
>
> > You can also try making it static const inside the function to do the
> > same thing... right now, the function is setting up an array on the
> > stack then copying from global memory on each call to the function.
>
> ...tried that ;)
>
> --
> For information on using the ACCESS Developer Forums, or to unsubscribe,
> please see http://www.access-company.com/developers/forums/
>
--
[Jeff Loucks, Gig Harbor, WA, USA]
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/