AnsweredAssumed Answered

HC12 sections and pages

Question asked by Peter Richter on Jan 5, 2007
Latest reply on Jan 5, 2007 by Peter Richter
Hi,
may be somebody can support me with flw. problem.
I' ve to convert old assembler code written for HC11, to support now
a 9S12XDP512 controller. The assembler code is more than 20kB large and so does not
fit in one section for HCS12. I'm using relocatable model and build three sections, one for data, one for code and one for constants. I paged the code (>10kB) to Page FE and the constants (9kB) to Page FC. Now I've flw. problem, if I want to load an address from a constant like
LDX #CONSTANT and then LDD 0,X the program crash, due to wrong address and wrong contents.
So I do some like that:
LDX #GLOBAL(CONSTANT)
LDAB #GLOBAL_PAGE(CONSTANT)
STAB GPAGE
and then GLDD 0,X.
But this is not very practical, because I've to lookout every point there is an load to a constant and 10kB assembler code is a lot. Further sometimes in the code there are constructions like
LDX #CONSTANT
STX ADDRESSCONSTANT

LDX ADDRESSCONSTANT
LDD 0,X
STD DATACONST
to calculate a field address inside macros from the constant section. And here I can't use above mentioned GLOBAL identifier.
So my question. Is there another way to handle code and constants if the size of both does not fit on one page? Thanks for the support.

Message Edited by CrasyCat on 2007-04-13 11:14 AM

Outcomes