calc84maniac wrote:
8-bit inc/dec do not touch the carry flag, and 16-bit inc/dec affect no flags at all.
Thanks calc84maniac. Smile Once again we learn the wisdom of consulting the z80 guide before making assumptions.
I ended up using CP skClear and taking out the whole overflow thing instead, although using LD HL, 0 and then ADD HL, DE would have set the carry/zero flag.
toraora wrote:
I ended up using CP skClear and taking out the whole overflow thing instead, although using LD HL, 0 and then ADD HL, DE would have set the carry/zero flag.
Yeah, but that's 4 bytes, where ld a,d \ or e \ ret z is a mere three bytes. Smile
Actually, another little-known fact is that 16-bit ADD does not affect the zero/overflow/sign flags. ADC and SBC do, though. But at any rate, adding 0 will never cause a carry. Adding 1 instead of using INC would detect carry just fine.
calc84maniac wrote:
Actually, another little-known fact is that 16-bit ADD does not affect the zero/overflow/sign flags. ADC and SBC do, though. But at any rate, adding 0 will never cause a carry. Adding 1 instead of using INC would detect carry just fine.
Thanks for the brain drain, calc84. Smile Having never had to be that precise with such things, I should probably explore the specifics of these flags a bit more precisely.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement