STM8SF103汇编——加载立即数到ram寄存器

STM8SF103 Assembly - Load immediate value to ram register

我正在尝试用汇编语言为 stm8sf103 微控制器编写程序。 我想在 ram 寄存器中存储一个立即数的十六进制值(例如 $0),但这不起作用,我想知道为什么:

stm8/
    segment 'rom'

loop
    ld  [=10=],#5
    jp  loop

    end

我收到错误:

as1 : Error 54: Can't match Addressing mode ' ld [=12=],#5'

使用

MOV [=10=], #5

指令不会影响任何条件标志。

ST8 Programming Manual开始,MOV的描述是

Moves a byte of data from a source address to a destination address. Data is examined as it is moved1. The accumulator is not affected.

There are 3 addressing modes for the MOV instruction:

  • An immediate byte to a direct memory location
  • A direct memory location to another direct memory location (from [=14=] to $FF)
  • A direct memory location to another direct memory location (from [=14=]00 to $FFFF)

支持的寻址方式可以参考那个手册(共20种),这样就可以理解为什么ld [=13=],#5不能工作了(没有Direct with Immediate addressing)


1这句话我看不懂,估计是打错了(应该是资料未查...).手册明确指出没有任何标志受到影响。