1

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?

Earlz
  • 62,085
  • 98
  • 303
  • 499
Andeeh
  • 99
  • 1
  • 4
  • 12
  • 1
    Which assembly language? The question hinges on how SUBB is defined, i.e. how it handles the carry flag. – starblue Dec 03 '12 at 21:44

1 Answers1

1

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.

stark
  • 12,615
  • 3
  • 33
  • 50
  • I The one thing I was missing was adding the carry bit on...cannot believe I didn't see that...thank you so much, saved me from hours of being confused. – Andeeh Dec 03 '12 at 20:26