Overriding Expression Sizes

With the 65816 comes addressing modes with byte, word, and xword (24 bits) sizes. There are times where you want to use 16-bit immediate values, Absolute, or Absolute Long addressing modes but the value equates to a smaller size and the assembler "optimizes" the addressing mode. The methods described here allows you to force a parameter size to your needs.

Syntax:

[<label>[:]]     LDA  !#expr ; '!#' forces 2 byte immediate value
[<label>[:]]     LDA  \1expr ; force 1 byte using direct page addressing modes
[<label>[:]]     LDA  \2expr ; force 2 bytes using absolute addressing modes
[<label>[:]]     LDA  \3expr ; force 3 bytes using absolute long addressing modes

Example:

alpha:    LDA  !#$1234        ; will generate $1234 for the immediate value. 
alpha:    LDA  !#$12          ; will generate $0012 for the immediate value. 
alpha:    LDA  \1$12345678    ; will generate $78 - taking the lease significant byte of the expression.
beta:     LDA  \2alpha        ; will generate the 2 least significant bytes of the value of alpha.
          LDA  \3alpha-1      ; will generate the 3 least significant bytes of the value of alpha minus 1.