Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
For the ez80 can someone give me an example of how to do 24 bit subtraction.

For example if HL holds a 24 bit number how would I subtract from it a 24 bit number held within BC?

Code:
or a,a \ sbc hl,bc
MateoConLechuga wrote:

Code:
or a,a \ sbc hl,bc


Thanks Mateo.

Is the

Code:
or a,a
done to clear the flag register before doing SBC?
danielricci wrote:
MateoConLechuga wrote:

Code:
or a,a \ sbc hl,bc


Thanks Mateo.

Is the

Code:
or a,a
done to clear the flag register before doing SBC?


Correct. The SBC instruction is actuall 'Subtract with Carry' (or sometimes 'Subtract with Borrow') - which means it factors the state of the carry flag into the result. Using 'or a,a' will clear the carry flag so that it isn't factored in.
  
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 1 of 1
» All times are GMT - 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