Memory models

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.

The Assembler supports all memory models of the compiler. Depending on your hardware, use the smallest memory model suitable for your programming needs.

The following table summarizes the different memory models. It shows when to use a particular memory model and which assembler switch to use.

Table 1. HC08 memory models
Option Memory Model Local Data Global Data Suggested Use
-Ms SMALL SP rel extended The SMALL memory model is the default. All pointers and functions are assumed to have 16-bit addresses if not explicitly specified. In the SMALL memory model, code and data must be in the 64k address space.
-Mt TINY SP rel direct In the TINY memory model, all data including stack must fit into the zero page. Data pointers are assumed to have 8-bit addresses if not explicitly specified with the keyword __far. The code address space is still 64k and function pointers are still 16 bits in length.
Note: The default pointer size for the compiler is also affected by the memory model chosen.