home *** CD-ROM | disk | FTP | other *** search
- **********************************************************************
- *
- * STDOPN version 1.1
- *
- * Open a console device and attach it as the standard I/O channel for
- * Fortran. For use with Amiga AbSoft Fortran v 2.3, the Fortran
- * startup module WBINIT.ASM, and the Fortran-Workbench shutdown module
- * WBEND.ASM (WBEND.SUB). Compatible with normal CLI startup, but does
- * not open a separate window when run from CLI.
- *
- * 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:
- *
- * CALL STDOPN('CON:Lside/Top/Rside/Bot/my window name')
- * where Lside is the pixel location of the left hand side of
- * the window, Top is the pixel location of the top, Rside
- * is the width of the window, Bot is the height of the window,
- * and "my window name" is self explanatory. Be careful not to set
- * the size of the window larger than the screen...the Guru will
- * come calling
- *
- * This call should precede any attempts to access the standard
- * Fortran console device from within your Fortran program.
- *
- * This routine should be present if a Fortran program is to be started
- * from Workbench. A bug in Workbench prevents the ToolWindow in the icon
- * from being passed to the application. As a result, the WBINIT.ASM
- * startup code will not open a default window for a program started from
- * Workbench. Such a window is not always needed, but if it is, use this
- * function.
- *
- * As an unexpected benefit, this program will enable you to close the
- * default window that you started with and open a new one. I am not sure
- * why you would want to do this, but the possibility is there.
- *
- * CHANGE HISTORY
- * 8 June 1989 Added capability to accept arguments in call
- *
- *****************************************************************************
-
- INCLUDE "exec/types.i"
- INCLUDE "exec/alerts.i"
- INCLUDE "exec/nodes.i"
- INCLUDE "exec/lists.i"
- INCLUDE "exec/ports.i"
- INCLUDE "exec/libraries.i"
- INCLUDE "exec/tasks.i"
- INCLUDE "libraries/dos.i"
- INCLUDE "libraries/dosextens.i"
- INCLUDE "workbench/startup.i"
-
- 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"
-
- _LVOOpen EQU -30
- _LVOClose EQU -36
-
- STDOPEN:
- tst.w WBSTAT(A0) * did we start from workbench?
- bne.s contnu * no.
- rts
-
- contnu:
- move.l 4(A7),A3 * move in window pointer
- movem.l A0/A4/A6,-(A7) * save some stuff
- movea.l DOS(A0),A6 * get the DOS lib pointer
- move.l STDIN(A0),D1 * get the old stdio file handle
- jsr _LVOClose(A6) * and close it
- movea.l (A7),A0
- move.l A3,D1
- move.l #MODE_OLDFILE,D2
- jsr _LVOOpen(A6) * open the new window
- movem.l (A7)+,A0
- move.l D0,STDIN(A0) * stick the file handles where
- move.l D0,STDOUT(A0) * they are needed
- move.l STDIN(A0),$9B0(A0)
- move.l STDOUT(A0),$AF6(A0)
- *
- * - set the console task (so Open("*",mode) will work)
- *
- movea.l OURTSK(A0),A4
- lsl.l #2,d0
- move.l d0,a0
- move.l fh_Type(a0),pr_ConsoleTask(A4)
- movem.l (A7)+,A4/A6
- rts
-
-
-