Compact Model

Using the compact model, all variables, by default, reside in one page of external data memory. (This is as if they were explicitly declared using the pdata memory type specifier.) This memory model can accommodate a maximum of 256 bytes of variables. The limitation is due to the addressing scheme used, which is indirect through registers R0 and R1 (@R0, @R1). This memory model is not as efficient as the small model, therefore, variable access is not as fast. However, the compact model is faster than the large model.

When using the compact model, C51 accesses external memory with instructions that utilize the @R0 and @R1 operands. R0 and R1 are byte registers and provide only the low-order byte of the address. If the compact model is used with more than 256 bytes of external memory, the high-order address byte (or page) is provided by Port 2 on the 8051. In this case, you must initialize Port 2 with the proper external memory page to use. This can be done in the startup code. You must also specify the starting address for PDATA to the linker. Refer to “STARTUP.A51” in the “Customization Files” section below for more information on using the compact model.