[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
XLAT             Translate                           Flags: not altered

XLAT translate-table

          Logic:    AL . (BX + AL)

    XLAT translates bytes via a table lookup. A pointer to a 256-byte
    translation table is loaded into BX. The byte to be translated is
    loaded into AL; it serves as an index (ie, offset) into the
    translation table. After the XLAT instruction is executed, the byte in
    AL is replaced by the byte located AL bytes from the beginning of the
    translate-table.

  --------------------------------------------------------------------------
   Operands                  Clocks   Transfers  Bytes   Example
   translate-table             11         1        1     XLAT SINE_TABLE
  --------------------------------------------------------------------------

       Notes:         Translate-table can be less than 256 bytes.

                      The operand, translate-table, is optional since a
                      pointer to the table must be loaded into BX before
                      the instruction is executed.

    The following example translates a decimal value (0 to 15) to the
    corresponding single hexadecimal digit.

          lea     bx, hex_table           ;pointer to table into BX
          mov     al, decimal_digit       ;digit to be translated to AL
          xlat    hex_table               ;translate the value in AL
             .                            ;AL now contains ASCII hex digit
             .
  hex_table       db      '0123456789ABCDEF'

See Also:
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson