Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1, Write code that jumps to label L1 if either bit 4, 5 or 6 is set in the BL re

ID: 3719599 • Letter: 1

Question

1, Write code that jumps to label L1 if either bit 4, 5 or 6 is set in the BL register

2, Write code that jumps to label L1 if bits 4, 5 and 6 are all set in the BL register

3, Write code that jumps to label L2 if AL has even parity.

4, Write code that jumps to label L3 if EAX is negative.

5, Write code that jumps to label L4 if the expression(EBX - ECX) is greater than zero

WRITE ALL THE CODES IN ASSEMBLY LANGUAGE OF 5 QUESTIONS AND WRITE THE COMMENTS AFTER EACH LINE OF CODE SO THAT I CAN UNDERSTAND. THANK YOU

Explanation / Answer

ANSWER

GIVEN BY

my code for first 2 Question

1Q

Write code that jumps to label L1 if either bit 4, 5, or 6 is set in the BL register.

; test cases

;MOV BL, 00110000b ;jump to L1

;MOV BL, 00010000b ;jump to L1

;MOV BL, 00001000b ;jump to L1

;MOV BL, 00110000b ;jump to L1

MOV BL, 10110001b ;jump to L1

;MOV BL, 10000000b ;not jump

; code that jumps to label L1 if either bits 4, 5, or 6 are set in the BL register

TEST BL, 00111000b

JNZ L1

RET

L1:

XOR BX, BX

RET

2Q

Write code that jumps to label L1 if bits 4, 5, and 6 are all set in the BL register.

;test cases

MOV BL, 00111001b ;jump to L2

;MOV BL, 10111001b ;jump to L2

;MOV BL, 11111000b ;jump to L2

;MOV BL, 00111000b ;jump to L2

;MOV BL, 00101000b ;not jump

;MOV BL, 00100001b ;not jump

; code that jumps to label L2 if bits 4,5 or 6 are all set in the BL register

AND BL, 00111000b

CMP BL, 00111000b

JE L2

RET

L2:

XOR BX, BX

RET