In and Gen Sets

The pseudo instruction below announces to the Compiler that registers in <in-set> are used further, and those in <gen-set> are not.


_INGEN  <in-set>, <gen-set>

The notation below declares which registers are used and which ones are modified by an instruction:

<instr> <args> ! <in-set>, <gen-set>

This works well for JSR, JMP, and RTS (and similar) instructions. The default is always on the conservative side. Consider the following example.

Listing: Example Program
    LDA a:1
    ADD b:1

    STA b:1

    LDA a:0

    ADC b:0

    STA b:0

    RTS ! {}, {}

This allows the Compiler to discard the H:X register for accesses to local variables. With the simple RTS, the Compiler does not know if the H:X register is to be preserved or not. Separate multiple registers with a +. For example:

RTS ! {A+X},  {}