cancel
Showing results for 
Search instead for 
Did you mean: 

Loading value directly in the Index register "XL"

HTiwa.11
Associate II

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

3 REPLIES 3
Ozone
Lead II

> 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).

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 Venmo
Up vote any posts that you find helpful, it shows what's working..
Cristian Gyorgy
Senior III

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.