Sunday, February 23, 2020

ALP to convert a given sixteen bit binary number to its gray equivalent

ALP to convert a given sixteen bit binary number to its gray equivalent


ASSUME CS : CODE, DS : DATA

DATA SEGMENT
      BINARY  DW 1234H 
      GRAY DW 01H DUP(?)

DATA ENDS

CODE SEGMENT
START:   MOV AX, DATA
                  MOV DS, AX

                  MOV AX, BINARY
                  MOV BX, AX
                 
                  SHR AX, 01H
       XOR AX, BX
                  LEA DI, GRAY
                  MOV [DI], AX
      
                   MOV AH, 4CH
                   INT 21H

CODE ENDS

END START

No comments:

Post a Comment