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

  1.  
  2. ;    FILENAME: OSTORTAB.ASM
  3. ;    Copyright (c) 1988 by Borland International, Inc.
  4. ;
  5. ;    Description: This module implements the routine StoreTab. StoreTab
  6. ;    stores a tab character if there are any spaces to compress.
  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. ;        TASM ostortab
  11.  
  12. include globals.inc
  13.  
  14. _TEXT   segment
  15.  
  16.     StoreTab proc
  17.  
  18.     ;    Input 
  19.     ;       SpcCnt - flag to determine if there are any spaces to compress 
  20.     ;       TAB - tab character defined to be ASCII 09 
  21.     ;       cx - the current byte count 
  22.     ;       TabOff - offset into the tab table 
  23.     ;    Output 
  24.     ;       TabOff - is decremented 
  25.     ;       SpcCnt - is set to zero 
  26.     ;    Registers modified 
  27.     ;       cx
  28.  
  29.     cmp     SpcCnt, 0       ;check if any spaces to compress
  30.     je      stotab1         ;jump if not
  31.     push    ax
  32.     mov     al, TAB         ;load tab
  33.     stosb                   ;store
  34.     inc     cx              ;increment byte count
  35.     dec     TabOff          ;adjust column
  36.     mov     SpcCnt, 0       ;reset space count
  37.     pop     ax
  38. stotab1:
  39.     ret
  40.  
  41.     StoreTab endp
  42.  
  43. _TEXT    ends
  44.  
  45. end
  46.