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

  1.  
  2. ;    FILENAME: OPROCDOC.ASM
  3. ;    Copyright (c) 1988 by Borland International, Inc.
  4. ;
  5. ;    Description: This module implements the routine ProcDoc. ProcDoc
  6. ;    processes an entire document, one line at a time.
  7. ;
  8. ;    This module uses MASM mode syntax and standard segment directives. 
  9. ;    ASSEMBLY INSTRUCTIONS: To assemble this module use the following 
  10. ;    TASM command line. 
  11. ;        TASM oprocdoc
  12.  
  13. include globals.inc
  14.  
  15. _TEXT   segment
  16.  
  17.     ProcDoc proc
  18.  
  19.     ;    This procedure processes an entire document line by line.
  20.     ;
  21.     ;    Input 
  22.     ;       INP_EOF - designates an end-of-file condition
  23.     ;       INP_ERR - designates an input error condition
  24.     ;       OUT_ERR - output error
  25.     ;       Options - the options being used
  26.     ;       SUP_EOF - suppress output EOF
  27.     ;       LinBuf - starting location of the line buffer
  28.     ;       EOF - ASCII 26
  29.     ;       OutBlk - output control block
  30.     ;    Output 
  31.     ;       si - Line buffer updated
  32.     ;    Registers modified 
  33.     ;       bx, cx, si
  34.  
  35. propag1:
  36.     call    ProcLine
  37.     push    ax
  38.     sub     ax, ax
  39.     or      ax, INP_EOF
  40.     or      ax, INP_ERR
  41.     or      ax, OUT_ERR
  42.     test    InpSta, ax
  43.     pop     ax
  44.     jz      propag1
  45.  
  46.     ;--- write EOF
  47.  
  48.     test    Options, SUP_EOF    ;check if suppressed
  49.     jnz     propag2
  50.     test    InpSta, INP_ERR     ;
  51.     jnz     propag2             ;-- check for errors
  52.     test    InpSta, OUT_ERR     ;
  53.     jnz     propag2
  54.  
  55.     mov     cx, 1               ;bytes to write
  56.     lea     si, LinBuf          ;put it in line buffer
  57.     mov     BYTE PTR [si], EOF  ;EOF character
  58.     lea     bx, OutBlk          ;output control block
  59.     call    FileWrite           ;write to file
  60.  
  61. propag2:
  62.     ret
  63.     ProcDoc endp
  64.  
  65. _TEXT    ends
  66.  
  67. end
  68.