2020-02-05 06:44 AM
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:
2020-02-05 07:11 AM
> 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).
2020-02-05 08:22 AM
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
2020-02-13 10:13 PM
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.