loading...

Read status of the eight input bits from the logic controller interface

Assembly language program to read the status of the eight input bits from the logic controller interface and display FF if it is even parity bits otherwise display 00. Display number of 1’s in the input data.

 
DATA SEGMENT
pa equ 0d880h
pb equ 0d881h
pc equ 0d882h
cw equ 0d883h
Data ends
CODE SEGMENT
assume       cs:code,ds:data
Start:       mov ax,data
             mov ds,ax
             mov dx,cw
             mov al,82h
             out dx,al
             mov cx,0008h
             clc
             XOR bh,bh
again:       mov dx,pb
             in al,dx
l1:          rcl al,01
             jnc skip
             inc bh
skip:        loop l1
             mov al,bh
             mov bl,02h
             mov ah,00
             div bl
             cmp ah,00h
             jz even1
             mov al,00h
             jmp disp
even1:       mov al,0ffh
disp:        mov dx,pa
             out dx,al
             mov dl,bh
             add al,’0’
             mov ah,02h
             int 21h
             mov ah,4ch
             int 21h
             code ends
             end start



The output of the above code is –

 
Output:
If all the LED's are on then the given number is even.
If all the LED's are off then the given number is odd.

Also read: What to delete when storage is full on your Android device?

 

0 5

Leave a Reply

Your email address will not be published.