Write a program that is able to check bits 2 and 5 of a byte

Write a program that is able to check bits 2 and 5 of a byte stored in memory address $2000: and jumps to code location with label Loop if either bit 2 or bit 5 is set, that is to say, when one of or both bits 2 and 5 are 1.

Solution

MOV AL,[2000]

MOV BL,AL

bt BL,2 ;; load bit 2 to carry flag

bt AL,5 ;; load bit 5 to carry flag

JNZ AL,LOOP1

JNZ BL,LOOP2

LOOP1:

LOOP2:

 Write a program that is able to check bits 2 and 5 of a byte stored in memory address $2000: and jumps to code location with label Loop if either bit 2 or bit

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site