LODSB            Load String Byte                    Flags: not altered
 
LODSB
 
          Logic:    AL  (DS:SI)
                    if DF = 0
                        SI  SI + 1
                    else
                        SI  SI - 1
 
    LODSB transfers the byte pointed to by DS:SI into AL and increments or
    decrements SI (depending on the state of the Direction Flag) to point
    to the next byte of the string.
 
  --------------------------------------------------------------------------
   Operands                  Clocks   Transfers  Bytes   Example
      -                        12         -        1     LODSB
   (repeat)                 9+13/rep    1/rep      1     REP LODSB
  --------------------------------------------------------------------------
 
       Note:          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:  LODSB                   ;Load a byte into AL...
          OUT     250,AL          ;   ...and output it to the port.
          LOOP    AGAIN

Seealso:



This page last updated on Fri Nov 30 10:49:50 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster