Just wanted to have some Z80 NOP squeezing chit chat :)
I am doing this to convert a signed 8 bit value in A into a signed 16 bit value in DE:
ld e,a ; 1 copy lo-byte
rlca ; 2 rotate sign into carry flag
ld a,0 ; 4 subtract from 0 ..
sbc a ; 5 with carry, effectively subtracting the carry flag from 0 => a is either 0 or -1
ld d,a ; 6 copy as hi-byte
; => signed offset value in de
Is there a faster way to do that? If not: :-P
Quote from: BSC on 17:29, 26 March 14
Is there a faster way to do that? If not: :-P
Yes...
ld e,a ; 1 copy lo-byte
rlca ; 2 rotate sign into carry flag
sbc a,a ; 3 with carry, effectively subtracting the carry flag from 0 => a is either 0 or -1
ld d,a ; 4 copy as hi-byte ; => signed offset value in de
Quote from: TFM on 17:59, 26 March 14
Yes...
ld e,a ; 1 copy lo-byte
rlca ; 2 rotate sign into carry flag
sbc a,a ; 3 with carry, effectively subtracting the carry flag from 0 => a is either 0 or -1
ld d,a ; 4 copy as hi-byte ; => signed offset value in de
It seems that you are right ..
Auch ein blindes Huhn trinkt mal einen Korn oder so ;)