Page 1 of 1
zx_saddrpup code question
Posted: Mon Apr 27, 2020 5:17 pm
by derekfountain
Just following up here on a
thread over at Spectrum Computing. The Z88DK library code for finding the Spectrum screen address above a given one is in
asm_zx_saddrpup. I noticed
these instructions at the bottom of that function:
What are they for?
Posted: Mon Apr 27, 2020 6:03 pm
by dom
It will be to handle setting carry when it goes off screen.
H will have values from $40 to $57 in the valid exit case.
In the value range the bits corresponding to $18 can?t both be set.
Posted: Mon Apr 27, 2020 8:34 pm
by derekfountain
But the very next instruction is to clear carry...?
Posted: Mon Apr 27, 2020 9:14 pm
by dom
ccf = Complement Carry Flag.
Assuming we've stepped above the screen, then h=$3f. So $3f & $18 = $18. $18 cp $18 resets carry so it needs to be flipped for carry to be set to indicate above the screen.
Posted: Tue Apr 28, 2020 7:40 am
by derekfountain
lol... So much to learn... Thanks for the explanation.