Skip to content

HSW12 Assembler Undocumented Features

hotwolf edited this page Sep 14, 2010 · 18 revisions

Here is a list of features that hasn’t made it into the project documentation, yet:


  • Automatic selection of long branch instructions, if a short branch is out of range → HC12, S12, S12X, S12XE


    For example:
            JOBSR   LABEL
    DS 50
    LABEL EQU *
    …produces the binary code: 27 32
            BEQ     LABEL
    DS 500
    LABEL EQU *
    …produces the binary code: 18 27 01 F4
            LBEQ    LABEL
    DS 500
    LABEL EQU *
    …also produces the binary code: 18 27 01 F4

    This feature can be disabled with the help of the “<” modifier:

            BEQ     <LABEL
    DS 500
    LABEL EQU *
    …results in a compile error
  • Pseudo mnemonic “JOB” (“jump or branch”) → HC12, S12, S12X, S12XE

    For example:

            JOB     LABEL
    DS 50
    LABEL EQU *
    …produces the binary code: 20 32
            JOB     LABEL
    DS 500
    LABEL EQU *
    …produces the binary code: 06 01 F7
            BRA     LABEL
    DS 50
    LABEL EQU *
    …also produces the binary code: 20 32
            JMP     LABEL
    DS 500
    LABEL EQU *
    …also produces the binary code: 06 01 F7
  • Pseudo mnemonic “JOBSR” (“jump or branch subroutine”) → HC12, S12, S12X, S12XE

    For example:

            JOBSR   LABEL
    DS 50
    LABEL EQU *
    …produces the binary code: 07 32
            JOBSR   LABEL
    DS 500
    LABEL EQU *
    …produces the binary code: 16 01 F7
            BSR     LABEL
    DS 50
    LABEL EQU *
    …also produces the binary code: 07 32
            JSR     LABEL
    DS 500
    LABEL EQU *
    …also produces the binary code: 16 01 F7
  • Pseudo address mode “Indirect Extended” [EXT] → S12, S12X, S12XE

    The address mode will be converted into “16-Bit Constant Indirect Indexed Addressing”.
    For example:

            JMP     [LABEL]
    JMP [LABEL-*,PC]
    …are equivalent