G'Day All,
I want to get a better understanding on why we need to use the directive absolute and how does one find what addresses should be used for a specific processor.
For example: If I was to use Dim var as Byte Absolute $30
what would most likely happen if I was to use just Dim var as Byte instead?
What part of the processor's datasheet provides address info that can be used to store directives?
Cheers
Fritzables.
Absolute ??
Hi,
It depends .
Go to chapter 3 of the device datasheet called Memory Organization, and look within this memory chapter for a section called Data Address Space. This section will tell you that data space from 0x0000 to 0x07FF is reserved for SFRs, and available RAM is from 0x0800 to 0xXXXX, ie, total of 2kB, 16kB, whatever. 0xXXXX is specific for your particular processor. Typically, you would want to put your absolutes from 0x0800 to 0xXXXX.What part of the processor's datasheet provides address info that can be used to store directives?
You should just use the Dim statement as it is, without the absolute keyword. The compiler will then look for a apropriate location to put the variable, and will try to optimise byte/word locations and boundaries and taking care of stack frame requirements.what would most likely happen if I was to use just Dim var as Byte
then will break loose, as location $30 is for the CPU program counter PC, and if you put something into the PC through *var* then the CPU will go bonkers.If I was to use Dim var as Byte Absolute $30
some reasons - to optimise by yourself the placement of variables to prevent fragmentation or to speed memory copies, to equivalence different variables to use the same memory space for memory re-use, for speed of remapping/conversion of byte variables to word/dword and vice versa, to create common SFR names for SFRs for different chips, eg renaming ADPCFG1 to ADPCFG so that your same program works for different chip types, and so on.why we need to use the directive absolute
It depends .
-
- Posts: 61
- Joined: 07 Jun 2008 13:20
- Location: Brisbane AUSTRALIA