HC12 sections and pages

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

HC12 sections and pages

ソリューションへジャンプ
2,424件の閲覧回数
Ghibli
Contributor I
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

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,167件の閲覧回数
Lundin
Senior Contributor IV
Note that you've got 32k of non-paged memory located at 4000-7FFF and from C000 to FFFF. When you try to access data from those addresses, the value in PPAGE is irrelevant. So unless you have more than 32k of constant data, you won't have to worry about PPAGE. Where the code using the constants is located doesn't matter.

What you do need to be careful with though, is the use of JSR/CALL and RTS/RTC, but that's another topic.

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,168件の閲覧回数
Lundin
Senior Contributor IV
Note that you've got 32k of non-paged memory located at 4000-7FFF and from C000 to FFFF. When you try to access data from those addresses, the value in PPAGE is irrelevant. So unless you have more than 32k of constant data, you won't have to worry about PPAGE. Where the code using the constants is located doesn't matter.

What you do need to be careful with though, is the use of JSR/CALL and RTS/RTC, but that's another topic.
0 件の賞賛
返信
1,167件の閲覧回数
Ghibli
Contributor I
Hi Lundin,
thanks for your answer, this was a great help.
Sometimes it is like: You can't see the trees, while you're standing in the forest.
best regards Ghibli
0 件の賞賛
返信