Skip to main content
HTiwa.11
Associate II
February 5, 2020
Question

Loading value directly in the Index register "XL"

  • February 5, 2020
  • 3 replies
  • 1182 views

I am using STM8S103F2 controller in assembly language. I want to load directly value in "XL" index register in one instruction and i do not want to affect "XH" register. (Index "x" register is the combination of XH and XL). Other ways to load value in "X" index register:

  1. LDW x,#$50
  2. LD A,#$10 LD XL,A

    This topic has been closed for replies.

    3 replies

    Ozone
    Principal
    February 5, 2020

    > I want to load directly value in "XL" index register in one instruction ..

    Is this the question ?

    Check the STM8 family manuals for the instruction set. But I suppose there is none.

    Almost all 8-bit architectures have highly non-orthogonal instruction set, to cram as much as possible instructions into 8 bit words.

    This reduces instruction fetch and execution times.

    The donwside is, most instructions support only a very limited number of source registers, and many just one implicit target register (the accu register).

    Tesla DeLorean
    Guru
    February 5, 2020

    There might be some undocumented instructions, more of a Z80/6502 guy than an STM8, I've been using 32-bit micros for many decades.

    The LD XL,A method seems the least invasive.

    There are perhaps PUSH/POP methods also

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    Cristian Gyorgy
    Associate II
    February 14, 2020

    The only method is the one you wrote at point no. 2, and also @Community member​  mentioned above:

    LD A, #$10

    LD XL, A

    So, it will take 2 cycles.