home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / MKEY19.ASM < prev    next >
Assembly Source File  |  1994-10-15  |  1KB  |  40 lines

  1.     page    66,132
  2. ;******************************** MKEY19.ASM *********************************
  3.  
  4. LIBSEG           segment byte public "LIB"
  5.         assume cs:LIBSEG , ds:nothing
  6.  
  7. ;----------------------------------------------------------------------------
  8. .xlist
  9.     include  mac.inc
  10.     include  common.inc
  11. .list
  12. comment 
  13. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
  14. is_stdout_console - check if stdout redirected to file.
  15. ;
  16. ; inputs:    none
  17. ; output:    al =  2  stdout is console
  18. ;                  0  stdout is file, printer, or other
  19. ;* * * * * * * * * * * * * *
  20. 
  21.     PUBLIC    is_stdout_console
  22. is_stdout_console        PROC    FAR
  23.     apush    bx,dx
  24.     mov    bx,1        ;handle 0=stdin 1=stdout 2=con 3=aux 4=prn
  25.     mov    ax,4400h    ;ioctrl (get device data)
  26.     int    21h        ;dx is returned with device/file info
  27.     mov    al,0
  28.     test    dh,80h        ;check if file or device
  29.     jz    stdout_file    ;jmp if file (redirected)
  30.     mov    al,dl
  31.     and    al,02h        ;isolate stdout bit
  32. stdout_file:
  33.     apop    dx,bx
  34.     retf    
  35. is_stdout_console ENDP
  36.  
  37. LIBSEG    ENDS
  38.     end
  39.