3.15.4 MOS6502 Memory Models

SDCC implements two memory models for the MOS6502: small and large (default). Modules compiled with different memory models should never be combined together. The library routines supplied with the compiler are compiled for all models.

In the small model all data objects are placed by default in Page Zero. This is normally only useful in embedded systems.

In the large memory model, data is placed by default in 16-bit addressable memory. Critical data can still be placed in Page Zero using the __ZP or __near storage modifier. Code generated for the large model is slightly bigger and slower than code generated for the small model.