Specifications
Saturn ASM68K and ASMSH 2-9
Psy-Q Development System
• The assembler correctly calculates the relative value when an instruction with a PC
relative operand is used in a delay slot, e.g.
bra fred
mova z1,r0
The offset in the MOVA instruction is not the same when it is in a delay slot.
This value cannot be calculated for indirect jumps through registers since the
assembler does not know the destination of the jump. e.g. the following instruction
sequence will cause an error :
jmp @r0
mova z1,r0
• The assembler allows the index address mode operands to appear in either order,
eg:-
and #15,@(r0,gbr)
and #15,@(gbr,r0)
This also works for pc relative, with displacement, etc.
• Since the SH cpu cannot reference immediate data bigger than 1 byte, the
assembler supports ‘literal pooling’ so you can access 16 and 32 bit constants.
This is usually indicated by the ‘=‘ prefix on a constant. If the data is greater than
1 byte it will be put in a literal table further on in the code. Otherwise it will be
incorporated in the instruction as an immediate value. For compatibility, the prefix
‘##’ can also be used to indicate a literal pool entry.
If you want to specify that the value must only be an immediate, then you can use
the ‘#’ prefix. If the data is larger than 1 byte, then an error will occur during
assembly.
Also for compatibility, if the #+ assembler option is specified in an OPT statement
on the command line (with the /o command line switch), then the functions of the
‘#’ and ‘##’ prefixes are reversed. So that a ‘#’ is used to signify a literal, and ‘##’
is used to indicate an immediate value.
Literal constants are collected into a number of literal tables, and the assembler
generates PC relative load instructions to fetch the data from these tables. To
allow this you need to use the LITTAB pseudo-op to insert a literal pool at
various points in your code. The best place for this is after an unconditional branch
or jump.
Note that this table must come after the constant reference because the offset on
PC relative instructions are unsigned. e.g:-