Question

Ok so I am revising for a test One of the revision questions is:

If

  • R4 = FEh
  • R5 = DCh
  • R6= ABh
  • Carry = 0

What are the contents of A and Carry after the following code:

MOV A,R6 
SUBB A,R4 
SUBB A,R5

The correct answer is Carry = 1 and A = D0h

I can work out what the registers are, but I can't get the correct answer for the carry bit. Can anyone help me understand this?

Was it helpful?

Solution

The first subtract is AB - FE => AD Since FE > AB the carry bit is set

The second subtrract is AD - (DC + 1) => DO Since DD > AD the carry bit is set again.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top