Answer to Question #287353 in Assembler for hkjh

Question #287353

AL = 10101111b BL = 00001010b TEST AL, BL; Status of FLAGS =?

Example: Determine whether a character is uppercase or lowercase.

Example: Checking a sign or value:

Example: Determine whether a number is even or odd. 


1
Expert's answer
2022-01-13T16:11:56-0500


The TEST instruction works same as the AND operation, but unlike AND instruction, it does not change the first operand.

; test bl.

; even or odd

   mov al, 10101111b

   mov bl, 00001010b ; value

   test al,bl                 ; cf=0, zf=0, sf=0, of=0, pf=1, af=0

; pf = 1 => bl even 

 

Determine whether a character is uppercase or lowercase

bl= 00001010b = ASCII code of LF

character is uppercase:          010x xxxxb

character is lowercase:          011x xxxxb

;test bl

; uppercase or lowercase

   mov al, 00100000b

   mov bl, 01001010b            ; bl = ASCII code of char ('J')

   test al,bl                              ; zf = 1 => bl upper   ; else character is lowercase

 

; test sigh

     mov al, 10000000b

     mov bl, 00001010b

     test al, bl                          ; zf = 0 => bl positive number



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS