LODS             Load String (Byte or Word)          Flags: not altered

LODS source-str

Logic:    Accumulator   (DS:SI)
if DF = 0
SI   SI + n         ; n = 1 for byte, 2 for word scan
else
SI   SI - n

LODS transfers the value (word or byte) pointed to by DS:SI into AX or
AL.  It also increments or decrements SI (depending on the state of
the Direction Flag) to point to the next element.

                                                                          
Operands                  Clocks   Transfers  Bytes   Example
                        byte(word)
source-str                12(16)       -        1     LODS LIST
(repeat) source-str    9+13(17)/rep  1/rep      1     REP LODS LIST
                                                                          

Notes:         This instruction is always translated by the
assembler into either LODSB, Load String Byte, or
LODSW, Load String Word, depending upon whether
source-str refers to a string of bytes or words. In
either case, however, you must explicitly load the
SI register with the offset of the string.

Although it is legal to repeat this instruction, it
is almost never done since doing so would
continually overwrite the value in AL.

                                 Example                                  

The following example sends the eight bytes at INIT_PORT to port 250.
(Don't try this on your machine, unless you know what's hanging off
port 250.)

INIT_PORT:
DB      '$CMD0000'      ;The string we want to send
.
.
CLD                     ;Move forward through string at INIT_PORT
LEA     SI,INIT_PORT    ;SI gets starting address of string
MOV     CX,8            ;CX is counter for LOOP instruction
AGAIN:  LODS    INIT_PORT       ;"INIT_PORT" is needed only by the
OUT     250,AL          ;  assembler, for determining word or byte
LOOP    AGAIN

See also: LODSB
See also: LODSW
See also: CMPS
See also: MOVS
See also: SCAS
See also: STOS
See also: REP
See also: CLD

LODS Load String (Byte or Word)