I am using CW5.1 for HCS12X MCU; IDE Version 5.9.0 (licensed).
I need to identify the selected memory model within my assembler code. (*.asm)
there are internal defines like "__BANKED__" oder "__LARGE__" available in compiler (*.c) files but I am not able to find anything comparable for the assembler in the documentation or help.
there must be something, as I use the switch -Mb in the IDE.
Does anybody know, how to retrieve the information during assembly time?
Hi Bertram
The memory models are only important if you mix C and assembly code. In this case all sources must be compiled or assembled with the same memory model.
If you use assembly only, memory models are not important. This is because, with assembly, programmer manages assembly instruction to access 16bit address or 24bit(banked) address.
While if use C, the memory model setting tells compiler to access memory with 16bit or 24bit.
So if you use pure assembly, you couldn’t see memory model selection option when you create a new project.
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jennie
thank you for your reply.
you are absolutely right, what you say about the memory models. the assembler will not influence my code.
let me shortly explain what the detailed situation is.
the pure assembly module is a kind of micro operating system. though I am working in small model so far, I am able to register functions/modules in other pages, as the operating system switches the pages manually. this works excellent. unfortunatelly NOW I have the need to switch to a banked model as other 3rd party modules require this, since they do not follow the restict rules of my operating system. i.e. my OS need to be changed.
My assembly module needs to know how the parameters are passed (long pointer have 1 byte more, return calls have 1 byte more) and how to return from the subroutine RTS/RTC this is memory model dependent. I know It is not much to be done but I want a stable and easy to use extension without the need to pass defines through the commandline. (this will cause errors in the future, if I forget to do so.) I would rather look for an assembler internal define which is set, when the assembles sees the switch for the memory model.
if you happen to know such a internal define/label/constant I can use during assembly time please let me know. otherwise I have to go the other way with the commandline define. maybe it is also a good idea to wrap the assembly code in a C-File as an option. let's if I have the spare time.
best regards
Bertram.
Hi Bertram,
We can set memory model in assembler setting after creating a project:
Hope this helps.
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------