Michael,
There are several ways to create your assembly project.
If you want to use the default startup function and able to add some C code in future you can create a mixed project which included .c and .asm files.
If you want to use asm code only you can create this project too.
In both case a prm file is used to allocated code and ram in memory.
The object codes generated with the assembler and compiler contain some information used by the linker to correctly allocated memory.
If in your code, a variable is not defined to an existing memory segment defined in prm, the linker will place it in DEFAULT_RAM.
If in your code, a function is not defined to an existing memory segment defined in prm, the linker will place it in DEFAULT_ROM.
The allocation can be done via ORG or via SECTION for instance:
| MY_ZEROPAGE: SECTION SHORT | ; Insert here your data definition |
fiboCount DS.W 1
These 2 variables will be associated in the MY_ZEROPAGE section.
If this section is defined in prm (this is the case), the variables will be placed in this memory area.
If this section is not listed in the prm, the variables will be placed in DEFAULT_RAM by default.
If an assembly variable is not exported with XREF/XDEF, the variable will be available for the asm module only.
If the same variable is defined in x asm file, the variables will use x memory locations.
So we can say each variable will be as "Local" one very similar to static variable in C.
You could find some information in the Assembler_HC08.pdf manual in the folder: \CodeWarrior for Microcontrollers V6.3\Help\PDF
Attached you will find a new example based on Fibonacci code in asm.
With a linker option you can generate a map file which will give you all memory allocation information.
This option is -M.
Have a great day,
Pascal Irrle
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------