2. Program layout

There are three macros that make section definition as simple as possible: CODESEG, DATASEG and UDATASEG (similar to tasm ideal mode syntax). END macro marks end of file.

Program must have at least CODESEG (.text) section, other sections are optional. CODESEG is read-only, DATASEG and UDATASEG are read-write; i.e. you can place data in CODESEG as long as you will not change it. You can also define your own sections if you want, but there's very rare need of doing so. Each section (even if it is empty) will enlarge your file.

START macro tells linker the entry point, and MUST be present.

So, program skeleton should look like:

%include "system.inc"

CODESEG

START:			;entry point

    your_code_here

DATASEG

    your_data_here

UDATASEG

    your_bss_here

END