User manual

ST7 and STM8 addressing modes ST Assembler-Linker
14/89 Doc ID 11392 Rev 4
addressing mode, while STM8 instruction
accepts both modes
push memory ; STM8 accepts only long addressing mode, push
memory does not exist for ST7
For ST7 instructions supporting both short and long formats, when external symbols are
referenced, long mode is chosen by the assembler.
For example:
EXTERN symb3;
symb1 equ $10;
...
ld A,symb1; short mode
ld A,symb3; long mode chosen
STM8 instructions using the extended addressing mode always have an F suffix. The
following instructions use the extended addressing mode:
callf $10000
jpf $20000
ldf A,($30000,X)
retf ; permits you to return to the previous function in the stack
in subroutines that are called by CALLF
3.4 Inherent addressing mode
This concept is hardware-oriented, meaning that instruction operands are coded inside the
operation code. At source code level, operands are written explicitly.
For example:
lab06 push A ; put accumulator A onto the stack
lab07 mul X,A ; multiply X by A
ldw SP,X ; load X to the stack pointer
3.5 Immediate operands
Immediate operands permit you to input a specific value for use with an instruction. They are
signaled by the use of a sharp sign (#) before the value. The range for an 8-bit immediate
operand is from 0 to 255.
For example:
lab08 ld A,#1 ; load A with immediate value 1
lab09 bset memory,#3 ; set bit #3 in memory location
btjt memory,#3,label ; test bit #3 of memory and jump if
true (set)
3.6 Direct and indirect modes
A direct addressing mode means that the data byte(s) required to do the operation is
found by its memory address, which follows the op-code.