This is no important :lol:

I’m still playing with my emulator, and now I’m playing with the ldd instruction (ld is just a ldd with q=0).

The instruction has this form

xxqx qqxd dddd xqqq

And for better reference I will call the bits this

x x q5 x q4 q3 x d4 d3 d2 d1 d0 x q2 q1 q0

I have the high byte in zl and the low byte in r16

And when done r16=q and r17=d (but can be any place)

lddinst:

mov r17,r16

swap r17

andi r17,0x0f l keep low 4 bit

sbrc zl,0; check d4

ori r17,16 ; if d4=1 place the bit

and r16,7;keep low 3 q

sbrc zl,2 ; check q3

ori r16,8 ; if q3=1 place the bit

sbrc zl,3 ; check q4

ori r16,16 ; if q4=1 place the bit

sbrc zl,5 ; check q5

ori r16,32 ; if q5=1 place the bit

Are there a faster way, the problem is that q5 is an odd ball for using roll etc.

Jens

[/code:1][code:1]