1.

Write a program to convert binary to gray code for the numbers 0 to F using translate instruction.

Answer»

Let the binary number is stored at 0350 and its equivalent gray code is stored at 0351 after the program execution. 

Look up table is as follows. 

Memory Data Data in look up table 0300 00 

Exampe: If (0350) = 03 Result (0351) = 02 0301: 01 0302 03 0303 02

030F 08 

MOV BX, 0300 : Let BX points to the starting address of the look up table. 

MOV SI, 0350 : Let SI points to the address of binary numbers 

LOD SB : Load the string byte into AL register. 

XLAT : Translate a byte in AL from the look up table stored in the memory pointed by BX. MOV [SJ+1], 

AL : Move the equivalent gray code to location SI+1 INT20



Discussion

No Comment Found

Related InterviewSolutions