Finding LSB in a register

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
lister_of_smeg
Berk
Posts: 37
Joined: Thu Nov 16, 2017 1:44 pm

Re: Finding LSB in a register

Post by lister_of_smeg » Fri Jan 18, 2019 3:22 pm

arkannoyed wrote:
Fri Jan 18, 2019 2:01 pm
Seems to almost do what it needs to. The only thing left that I should've mentioned before is that it needs to RESet the LSB in HL (the data register).
So whereas maybe HL=05c0h, after creating the mask, bit 6 of L needs to be cleared, giving the result HL=0580h.

Does that make sense?
This any good?

Code: Select all

ld	d, h
ld	e, l
dec	de
ld	a, d
xor	h
ld	d, a
cpl
and	h
ld	h, a
ld	a, e
xor	l
ld	e, a
cpl
and	l
ld	l, a
rr	d
rr	e
0 x

Post Reply