Tuesday 20 November 2012

PROGRAM TO CONVERT 8-BIT BINARY NUMBER TO ITS GRAY CODE FORM

mmicroprocessor.blogspot.com
.model small

.data
opr db 04h
res db ?

.code
.startup
mov al,opr
mov bl,al
rcr al,1
xor al,bl
mov res,al
mov al,res
mov dl,al
mov bh,al
and dl,0f0h
mov cl,4
ror dl,cl
add dl,30h
cmp dl,'9'
jbe a1
add dl,7h
a1:
mov ah,02h
int 21h
mov dl,bh
and dl,0fh
add dl,30h
cmp dl,'9'
jbe a0
add dl,7h
a0:
mov ah,02h
int 21h
mov ah,4ch
int 21h
end


Output:
06

No comments:

Post a Comment