Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to check whether the fourth bit of the byte stored at location X is 0 or 1

Posted By: Sophie Brown     Category: Assembly Language     Views: 2023

Write an assembly program to check whether the fourth bit of the byte stored at location X is 0 or 1. If 0, store 00 at location Y else store
FF at location Y.

Code for Program to check whether the fourth bit of the byte stored at location X is 0 or 1 in Assembly Language

.model small

.data
        num db 16
        arr db 8 dup(0)
        cntr db 0
        two db 2

.code
        mov ax,@data
        mov ds,ax

        mov BX,0000
        mov ax,0000
        mov al,num

        L1:
                div two
                mov BYTE PTR arr[BX],ah
                mov ah,00
                add cntr,1
                add BX,1
                cmp al,00
                ja L1
                                

        mov al,00
        mov BX,4
        mov ah,arr[BX]
        cmp ah,1
        je one
        mov ah,00
        jmp ext

        one:
                mov ah,255
        ext:
                mov ax,4C00h
                int 21h
end
        
  
Share: 



Sophie Brown
Sophie Brown author of Program to check whether the fourth bit of the byte stored at location X is 0 or 1 is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!