home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / tasm / ospaces.asm < prev    next >
Assembly Source File  |  1988-08-28  |  1KB  |  46 lines

  1.  
  2. ;    FILENAME: OSPACES.ASM
  3. ;    Copyright (c) 1988 by Borland International, Inc.
  4. ;
  5. ;    Description: This module implements the routine Spaces.  Spaces 
  6. ;    stores a specified number of spaces at particular location. 
  7. ;    This module uses MASM mode syntax and standard segment directives. 
  8. ;    ASSEMBLY INSTRUCTIONS: To assemble this module use the following 
  9. ;    TASM command line. 
  10. ;
  11. ;        TASM ospaces
  12.  
  13. include globals.inc
  14.  
  15. _TEXT   segment
  16.  
  17.     Spaces proc
  18.  
  19.     ;    This function inserts the number of spaces (20h) specified in the
  20.     ;    dx register at the value of the location in di and returns the 
  21.     ;    padded result in di.
  22.     ;
  23.     ;    Input
  24.     ;        dx - number of spaces to insert
  25.     ;        di - memory location to insert spaces
  26.     ;    Output
  27.     ;        di - memory location padded with the specified number of
  28.     ;             spaces
  29.     ;    Registers modified
  30.     ;        dx, di
  31.  
  32.     push    ax
  33.     push    cx
  34.     mov     cx, dx          ;load count
  35.     mov     al, ' '         ;space
  36.     rep
  37.     stosb                   ;store bytes
  38.     pop     cx
  39.     pop     ax
  40.     ret
  41.     Spaces  endp
  42. _TEXT    ends
  43.  
  44. end
  45.