**********************************************************************
*
*   WBStrt version 1.1
*
*   Bring the location of a Workbench startup message into a Fortran 
*   application
*
*   Author:  Jim Locker, SofTech Inc.  Published in Amazing Computing.
*
*   This program is placed in the public domain.  Use as you see fit, but
*   the author accepts no liability for anything.
*
*   Usage:
*
*          INTEGER*4 Message
*          Message = CALL WBStrt
*
*   Change history:
*
*    14 June 1989  Modified to return a 0 if not started from workbench
*
*****************************************************************************


AEXEC   EQU     -16                     * "exec_lib" pointer
DOS     EQU     AEXEC-4                 * "dos.library" pointer
STDIN   EQU     DOS-4                   * file handle for STDIN
STDOUT  EQU     STDIN-4                 * file handle for STDOUT
H.BASE  EQU     STDOUT-4                * base of heap
H.SIZE  EQU     H.BASE-4                * size of heap
WBSTAT  EQU     H.SIZE-2                * running from workbench?
WBMSG   EQU     WBSTAT-4                * loc of WB message
OURTSK  EQU     WBMSG-4                 * loc of our TCB
AMIGA   EQU     -OURTSK                 * size of Amiga global storage

* - from "dos.library"


WBStrt:
         tst.w WBSTAT(A0)                   * did we start from workbench?
         bne.s contnu                       * no.
         moveq #0,D0                        * return a 0
         rts

contnu:
         move.l WBMSG(A0),D0
         rts
