11.07.2015 Views

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Macro AssemblerHI-TECH C Assembly Language• The space flag is used to differentiate areas of memory which have overlapping addresses,but which are distinct. Psects which are positioned in program memory and data memory mayhave a different space value to indicate that the program space address zero, for example,is a different location to the data memory address zero. Devices which use banked RAMdata memory typically have the same space value as their full addresses (including bankinformation) are unique.• The with flag allows a psect to be placed in the same page with a specified psect. For examplewith=text will specify that this psect should be placed in the same page as the text psect.• The width flag is used to control the maximum number of bytes placed at each address. Forexample, even if each address can take a four byte (32-bit) instruction, this flag could be usedto restrict this to a smaller value. On the <strong>dsPIC</strong>, this is used on data constants to limit onlytwo bytes of constants per address. This is needed because constants are mapped into datamemory where each addressable location is two bytes (16-bits) wide. This flag is useful onlywhen used in conjunction with the DB, DW and DDW assembler directives.Some examples of the use of the PSECT directive follow:PSECT fredPSECT bill,size=100h,globalPSECT joh,abs,ovrld,class=CODE,delta=24.3.8.4 ORGThe ORG directive changes the value of the location counter within the current psect. This means thatthe addresses set with ORG are relative to the base address of the psect, which is not determineduntil link time.•The much-abused ORG directive does not necessarily move the location counter to theabsolute address you specify as the operand. This directive is rarely needed in programs.The argument to ORG must be either an absolute value, or a value referencing the current psect. Ineither case the current location counter is set to the value determined by the argument. It is notpossible to move the location counter backward. For example:ORG 100h79

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!