90 likes | 174 Views
Selection – If statement. Sum of two negative numbers is positive?. AND. Page 93. CBA. CMPA, CMPB. Compare two numbers in A&B: CBA ;compare B to A (sub A-B) BEQ EQUAL ;label for code BMI NEGATIVE ;label for code do positive code here (A>B) BRA ENDIF
E N D
CBA CMPA, CMPB
Compare two numbers in A&B: CBA ;compare B to A (sub A-B) BEQ EQUAL ;label for code BMI NEGATIVE ;label for code do positive code here (A>B) BRA ENDIF EQUAL: do equal code here BRA ENDIF NEGATIVE: do negative code here (A-B is neg, so B>A) ENDIF:
Lab Assignment • Write a program that will • Store two numbers register A and B • Compare A and B, if • A>B turn on PA6 • A=B turn on PA5 • A<B turn on PA4