DarrenY
09-17-2007, 05:17 PM
I have a simple problem that's driving me mad as I can't get it to work!
In my main module I (want to) declare a DAT block of bytes, that I get the address of via F8
I then use this address within a 'MemoryMap.spin' file:
CON BaseAddr = $54 ' Base Memory location - should be address of DataBlock in main module
CON
Var1 = 0
Var2 = 4
Var3 = 8
Var4 = 12
...
LastVar = 192
I then include the MemoryMap.spin object in all the spin files that need to access the memory block.
The main files memory block can then be read/written from any module using the following:
readvar1 := long[constant(memmap#BaseAddr + memmap#Var1)]
long[memmap#BaseAddr + memmap#Var2] := writevar2
(where memmap is OBJ memmap : "MemoryMap")
Trouble is, I am having trouble getting the main module to declare an array of bytes in the DAT block:
DAT
DataBlock byte memmap#LastVar ' this is the last (i.e. size of) var in the global memory map
Is this the correct syntax?
Cheers all.
In my main module I (want to) declare a DAT block of bytes, that I get the address of via F8
I then use this address within a 'MemoryMap.spin' file:
CON BaseAddr = $54 ' Base Memory location - should be address of DataBlock in main module
CON
Var1 = 0
Var2 = 4
Var3 = 8
Var4 = 12
...
LastVar = 192
I then include the MemoryMap.spin object in all the spin files that need to access the memory block.
The main files memory block can then be read/written from any module using the following:
readvar1 := long[constant(memmap#BaseAddr + memmap#Var1)]
long[memmap#BaseAddr + memmap#Var2] := writevar2
(where memmap is OBJ memmap : "MemoryMap")
Trouble is, I am having trouble getting the main module to declare an array of bytes in the DAT block:
DAT
DataBlock byte memmap#LastVar ' this is the last (i.e. size of) var in the global memory map
Is this the correct syntax?
Cheers all.