home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / c / dcback15.lha / wbmain.a < prev   
Encoding:
Text File  |  1992-04-18  |  1.7 KB  |  47 lines

  1.  
  2.                     ;   AutoInit0 brought in if the normal _main entry
  3.                     ;   point is used (due to _main making a dummy
  4.                     ;   reference to __waitwbmsg)
  5.                     ;
  6.                     ;   Since this is the first module in AUTO.LIB and
  7.                     ;   always referenced on the first pass, it will occur
  8.                     ;   before ANY library is openned, which is what we
  9.                     ;   want.
  10.  
  11.                     section autoinit0,code
  12.  
  13.                     xref    _LVOWaitPort
  14.                     xref    _LVOGetMsg
  15.                     xref    __WBMsg
  16.                     xref    __IsDetached
  17.  
  18.                     xdef    __waitwbmsg
  19.  
  20. __waitwbmsg         move.l  $114(A6),A0     ; ThisTask
  21.                     cmp.b   #13,8(A0)       ; NT_PROCESS ?
  22.                     bne     wwm100
  23.                     tst.l   $AC(A0)         ; pr_CLI ?
  24.                     bne     wwm100
  25. ;
  26. ; Here this code checks wether or not the program
  27. ; is running detached from the Shell. It checks the
  28. ; __IsDetached global which is TRUE when the program
  29. ; is running "detached" from the shell. This is necessary
  30. ; because CreateProc'ed processes have no CLI structure
  31. ; which causes the original __waitwbmsg() to think it has
  32. ; been run from the workbench causing the program to wait for
  33. ; the workbench message that will never arive.
  34. ;
  35.                     tst.b   __IsDetached    ; Detached from cli ?
  36.                     bne     wwm100
  37.  
  38.                     lea     $5C(A0),A0      ; message port
  39.                     move.l  A0,-(sp)
  40.                     jsr     _LVOWaitPort(A6)
  41.                     move.l  (sp)+,A0
  42.                     jsr     _LVOGetMsg(A6)
  43.                     move.l  D0,__WBMsg(A4)
  44. wwm100
  45.  
  46.                     END
  47.