2.7. Object Files

LWASM supports generating a proprietary object file format which is described in Chapter 6. LWLINK is then used to link these object files into a final binary in any of LWLINK's supported binary formats.

Object files also support the concept of sections which are not valid for other output types. This allows related code from each object file linked to be collapsed together in the final binary.

Object files are very flexible in that they allow references that are not known at assembly time to be resolved at link time. However, because the addresses of such references are not known at assembly time, there is no way for the assembler to deduce that an eight bit addressing mode is possible. That means the assember will default to using sixteen bit addressing whenever an external or cross-section reference is used.

As of LWASM 2.4, it is possible to force direct page addressing for an external reference. Care must be taken to ensure the resulting addresses are really in the direct page since the linker does not know what the direct page is supposed to be and does not emit errors for byte overflows.

It is also possible to use external references in an eight bit immediate mode instruction. In this case, only the low order eight bits will be used. Again, no byte overflows will be flagged.