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

  1.  
  2. ;    FILENAME: OBYTELOW.ASM
  3. ;    Copyright (c) 1988 by Borland International, Inc.
  4. ;
  5. ;    Description: This module implements the routine ByteLow. ByteLow
  6. ;    processes the current low byte value in al.
  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 obytelow
  11.  
  12. include globals.inc
  13.  
  14. _TEXT   segment
  15.  
  16.     ByteLow proc
  17.  
  18.     ;    This procedure processes a low byte character (ASCII value < 32) 
  19.     ;    in al.  
  20.     ;
  21.     ;    Input 
  22.     ;       al - low byte character
  23.     ;       cx - byte count
  24.     ;       dx - number of spaces to insert
  25.     ;       EOL -  defined to be the end of line character
  26.     ;       InpSta - input status
  27.     ;       INP_EOL - designates an end-of-line condition
  28.     ;       Options - the options being used
  29.     ;       REP_TAB - replace tabs without spaces
  30.     ;       TAB - tab character defined to be ASCII 09
  31.     ;       Sav_CR -  denotes CR are to be saved
  32.     ;       CR - ASCII 13
  33.     ;       SKP_EOF - skip input eof
  34.     ;       EOF - ASCII 26
  35.     ;       INP_EOF - designates the end of the input file
  36.     ;       STR_LOB - strip low (control) bytes
  37.     ;
  38.     ;    Output 
  39.     ;       al - low byte processed
  40.     ;       cx - byte count incremented
  41.     ;    Registers modified 
  42.     ;       ax, cx
  43.  
  44.     ; Process low byte.
  45.  
  46.     ;--- end of line
  47.  
  48.     cmp     al, EOL         ;check if end of line
  49.     jne     bytlo1
  50.     or      InpSta, INP_EOL
  51.     ret
  52.  
  53.     ;--- replace tabs with spaces
  54.  
  55. bytlo1:
  56.     test    Options, REP_TAB ;test if replace tabs
  57.     jz      bytlo3
  58.     cmp     al, TAB  ;check if tab
  59.     jne     bytlo3
  60.     call    TabNext         ;get spaces needed
  61.     call    Spaces          ;store spaces
  62.     add     cx, dx          ;byte count
  63.     ret
  64.  
  65.     ;--- carriage return
  66.  
  67. bytlo3:
  68.     test    Options, SAV_CR  ;check if saving CR's
  69.     jnz     bytlo4
  70.     cmp     al, CR    ;check if carriage return
  71.     jne     bytlo4
  72.     ret
  73.  
  74.     ;--- end of file
  75.  
  76. bytlo4:
  77.     test    Options, SKP_EOF ;check if ignore EOF
  78.     jnz     bytlo6
  79.     cmp     al, EOF   ;check if end of page
  80.     jne     bytlo6
  81.     or      InpSta, INP_EOF ;set flag
  82.     or      cx, cx          ;check if any bytes
  83.     jz      bytlo5
  84.     or      InpSta, INP_EOL ;set end of line also
  85. bytlo5:
  86.     ret
  87.  
  88.     ;--- remove low bytes
  89.  
  90. bytlo6:
  91.     test    Options, STR_LOB ;test if remove low bytes
  92.     jz      bytlo7
  93.     ret
  94.  
  95.     ;--- write byte
  96.  
  97. bytlo7:
  98.     stosb
  99.     inc     cx
  100.     ret
  101.  
  102.     ByteLow endp
  103.  
  104. _TEXT    ends
  105.  
  106. end
  107.