Multiple DAT sections
David Betz
Posts: 14,516
Starting to work on PropGCC cache drivers again and I have a PASM question. What happens if I have a program structured like this:
Am I guaranteed that the code in the second DAT will immediately follow the code from the first DAT in memory? I'm trying to factor out common code from the cache drivers so I can use #include to add it to cache drivers that need it rather than duplicating the same code in each driver but some of the code snippets require a CON section to setup constants. Is it poor coding practice to assume that the DAT sections will be contiguous?
CON ' some constants DAT ' some code CON ' some more constants DAT ' some more code
Am I guaranteed that the code in the second DAT will immediately follow the code from the first DAT in memory? I'm trying to factor out common code from the cache drivers so I can use #include to add it to cache drivers that need it rather than duplicating the same code in each driver but some of the code snippets require a CON section to setup constants. Is it poor coding practice to assume that the DAT sections will be contiguous?
Comments
Var does get reorganized though..
This is good to hear since I have been contemplating putting CON and DAT sections in individual PRI and PUB sections so I can paste them in (or #include them) as needed.
Here is a clean solution for beginners.
There should be only one DAT section.
Each cog you are are going to start starts with org 0 and ends with FIT.
All the code for each cog
All variables for that cog and
All constants for that cog
have to be between the org 0 and FIT for that cog.
Here is some code and notes that clarifies and demonstrates this {copied from the book}
erase the notes
Run the code
Watch on PST.
Harprit
And you cannot use the same variable names and constant names in more than one cog
All variables and constants have to have unique names between cogs except the shared
variables that are NOT even mentioned in the PASM code. They are accessed via the PAR
parameter and are never mentioned by name in any of the PASM code!!!
You wiii also need test file 2 and 3 in your working folder
Here they are
testfile2
and testfile3
Kuroneko
there is one extra space on all the lines
I don't know why it did that
The are easily selected in one sweep with the Alt key down and removed
My Apologies.
H
Good answer to a different question.
So, it turns out I don't even understand the questions yet....
Life continues to blow me away.
Getting old.
H