Skip to main content
Visitor II
June 28, 2022
Solved

hello sir i use the nucleo stm8s208rb with asembler language, so i start with the st visual develop and write even a small program l

  • June 28, 2022
  • 2 replies
  • 1480 views

hello sir

a very simple asembler program ,with a big problem

its in ST visual develop , with the inside st assembler

that simple program

ldw X,#stack_end

ldw SP,X

 PUSH $C

 SUB SP,#$02

gives that error

 Error 54: Can't match Addressing mode ' SUB SP,#$02'

how can that besolved?

and please no answer as learn c.

many thanks

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    https://www.st.com/resource/en/release_note/rn0005-st-assemblerlinker-asm-452-lyn-319-obsend-215-stmicroelectronics.pdf

    "3.1 ASM limitations 3.1.1 Limitations for STM8 assembler �? The mnemonics of the following STM8 instructions: ADD SP,#byte SUB SP,#byte have been replaced by: ADDW SP,#byte SUBW SP,#byte"

    Use SUBW SP,#$9

    2 replies

    Technical Moderator
    July 1, 2022

    Essentially the same question as this one.

    Regards

    /Peter

    Graduate II
    July 1, 2022

    Perhaps there's some issue with spaces, or that the syntax for SP is always immediate,ie SUB SP, 2

    Graduate II
    July 1, 2022

    >>and please no answer as learn c

    Ok, so won't tell you to do that, but if you want to find a richer set of examples and use cases for instructions and forms that you're unfamiliar or unsure of, having the compiler generate a LISTING file, or having a disassembler or debugger generate a disassembly can be quite useful.