home *** CD-ROM | disk | FTP | other *** search
- This document describes the interface routines that I have written to permit
- AbSoft Fortran version 2.3 to interface properly with WorkBench and the ROM
- Kernel.
-
- All these routines are built into the fortran library AMIGALIB.
-
- Jim Locker
-
-
- Fortran callable subroutine calls RKM Function
- -----------------------------------------------------------
-
- Mov.sub (graphics) Move
- Draw.sub (graphics) Draw
- Fremem.sub (exec) FreeMem
- Curdir.sub (dos) CurrendDir
-
- -----------------------------------------------------------
-
- Other Interface Routines:
-
- CreatePort -- create a standard system message port (in Fortran)
- DeletePort -- delete a standard system message port (in Fortran)
- Init.sc -- Fortran startup module with workbench support. Source is WBINIT.ASM
- WBARGS.SUB -- pulls first argument out of WBench startup message (in Fortran)
- WBEND.SUB -- handles WorkBench shutdown from Fortran (Assembler)
- WBSTAT.SUB -- tests if started from workbench (Assembler)
- WBSTRT.SUB -- returns address of workbench startup message (null if CLI)
- (Assembler)
- STDOPN.SUB -- open a console window for Fortran modules (Assembler)
-
- -----------------------------------------------------------
-
- ARGUMENT LISTS:
-
- C
- C CreatePort version 1.1
- C by Jim Locker
- C Published in Amazing Computing
- C
- C This routine allocates memory and establishes a standard Amiga system
- C Message Port for a Fortran program.
- C
- C
- C INPUTS:
- C pname; A pointer to a null terminated string that contains
- C the name of the Message Port. May be a null string
- C
- C pri; The priority of the message port
- C
- C taskid; The name of the Fortran process that creates the port
- C
- C RETURNS:
- C
- C mp; The return variable that contains the pointer to the
- C Message Port
- C
- C
- C USAGE:
- C
- C integer*4 pri,mp,taskid
- C character*32 pname
- C
- C pname = 'myname'\\CHAR(0)
- C
- C call CreatePort(pname,pri,mp,taskid)
- C
- C When CreatePort returns, you should check mp to ensure that it is
- C not null. If it is null, the allocation failed and you should react
- C accordingly.
- C
- **************************************************************************
- *
- * CURDIR by Jim Locker, SofTech Inc.
- * 17 January, 1990
- *
- * called from AbSoft Fortran
- * calls system CurrentDir routine
- * Needed because Amiga.sub does it wrong.
- *
- * USAGE:
- *
- * OldDir = CURDIR(LOCK)
- *
- * where LOCK is a directory lock
- *
- ***************************************************************************
- C DeletePort
- C by Jim Locker
- C Published in Amazing Computing
- C
- C DeletePort deletes a port that was created by CreatePort from within
- C a Fortran process.
- C
- C INPUTS:
- C port: the pointer to the message port that was returned
- C by CreatePort
- C
- C OUTPUTS: None
- C
- C USAGE:
- C Integer*4 port
- C
- C Call DeletePort(port)
- C
- C
- **************************************************************************
- *
- * DRAW by Jim Locker, SofTech Inc.
- * 19 June, 1989
- *
- * called from AbSoft Fortran
- * calls system DRAW routine
- * Needed because Amiga.sub is too slow.
- *
- * USAGE:
- *
- * Call DRAW(GFXBASE,RastPort,X,Y)
- *
- ***************************************************************************
- **************************************************************************
- *
- * FREMEM by Jim Locker, SofTech Inc.
- * 13 April, 1989
- *
- * called from AbSoft Fortran
- * calls system FREEMEM routine
- * Needed because Amiga.sub does it wrong.
- *
- * USAGE:
- *
- * Call Fremem(MEMBLOCK,MEMSIZE)
- *
- ***************************************************************************
- **************************************************************************
- *
- * MOV by Jim Locker, SofTech Inc.
- * 19 June, 1989
- *
- * called from AbSoft Fortran
- * calls system MOVE routine
- * Needed because Amiga.sub is too slow.
- *
- * USAGE:
- *
- * Call MOV(GFXBASE,RastPort,X,Y)
- *
- ***************************************************************************
- **********************************************************************
- *
- * 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
- *
- *****************************************************************************
- C
- C WBArgs.FOR
- C by Jim Locker, SofTech Inc.
- C Oct 89
- C
- C version 1.2
- C
- C This routine needs WBInit.asm to run correctly. It accepts
- C the address of a WorkBench startup message as input, then tests
- C to see whether any arguments were passed to the Fortran program
- C by examining the message. If any arguments were passed (should
- C be a file name), WBArgs will copy the string found in the ArgList
- C into a character buffer. This version of the program will only
- C find and copy one string. Given the way Fortran works, it seems
- C unlikely that more than one string needs to be copied.
- C
- C
- C INPUTS:
- C
- C STARTUP. A pointer to a workbench startup message
- C as returned by WBSTRT
- C
- C OUTPUTS:
- C
- C FILNAM. A 32 byte character array containing a
- C null terminated string that is what was
- C found in the ArgList.
- C
- C OLDDIR. A file lock on the directory that was the
- C current directory when we entered this
- C routine. You need to CURDIR(OLDDIR) before
- C exiting, if there was a FILNAM passed in by
- C Workbench.
- C USAGE:
- C
- C INTEGER*4 WBSTRT,STARTUP,OLDDIR
- C CHARACTER*1 FILNAM(32)
- C
- C STARTUP = WBSTRT(0)
- C IF(STARTUP .NE. 0) CALL WBARGS(STARTUP,FILNAM,OLDDIR)
- C
- C When WBArgs returns, you should test the first element of FILNAM
- C to determine whether or not there was an argument in the startup
- C message. The first element of FILNAM will be CHAR(0) if there was
- C no argument.
- C
- C CHANGE HISTORY
- C
- C 17 Jan 1990 Modified to use assembly routine CURDIR instead of
- C using amiga.sub to call CurrentDir...Amiga.sub did not
- C call CurrentDir correctly.
- C 7 Feb 1990 Modified to return Old directory Lock. We need it
- C later, when we exit from program in order to eliminate
- C dangling locks.
- ************************************************************************
- *
- * WBEND version 1.0
- *
- *
- * Perform all necessary operations to shut down a Fortran program which
- * was started from Workbench. For use with Amiga AbSoft Fortran v 2.3,
- * the module STDOPEN.ASM, and the Fortran-Workbench startup module
- * WBINIT.ASM (INIT.SC). Compatible with normal CLI startup.
- *
- * Author: Jim Locker, SofTech Inc. Published in Amazing Computing
- *
- * This program is placed in the public domain, but the Author accepts no
- * responsibility whatsoever for anything that anyone does with it.
- *
- * USAGE:
- *
- * CALL WBEND
- *
- * This call must be the last statement in the program, except for the
- * normal END statement. If you call this from anywhere else in the
- * program, you will crash.
- *
- * This program must be linked into your executable using F77L. It will
- * crash if run unlinked.
- *
- *************************************************************************
- *************************************************************************
- * WBInit.asm---FORTRAN Compiler Startup Code *
- * Substantially based upon *
- * the *
- * ABSOFT CORPORATION FORTRAN 77 COMPILER *
- * *
- * MAIN PROGRAM START UP CODE *
- * FOR *
- * AMIGADOS BASED SYSTEMS *
- * *
- * Copyright (C) 1986,1987 *
- * Absoft Corporation, Royal Oak, MI 48072 *
- * *
- * *
- * This code segment is the main program start up procedure, with *
- * workbench support. It must be linked using Alink or Blink to *
- * amiga.lib. *
- * *
- * The resulting linker output file must be named "init.sc". *
- * *
- * The file is also used in source form as an INCLUDE file when *
- * assembly language source is being generated by the compiler *
- * for a main program. *
- * *
- * The routine performs the following functions: *
- * *
- * 1. Test for workbench vs CLI startup *
- * 2. If workbench, handle all necessary environment issues*
- * 3. allocate a memory segment for the heap *
- * 4. open "dos.library" *
- * 5. locate the STDIN and STDOUT file handles *
- * 6. load f77.rl into the heap *
- * *
- * The routine passes the following registers to f77.rl: *
- * *
- * D2 - run-time library specification: *
- * 0 = f77.rl *
- * 1 = hdw.rl (not available for Amiga) *
- * 2 = m81.rl *
- * D5 - command line length *
- * A0 - pointer to heap *
- * A2 - pointer to main program *
- * A3 - command line pointer *
- * A4 - debug or profil command line pointer *
- * A5 - pointer to f77.rl *
- * *
- * *
- *************************************************************************
- *
- * Edit history:
- *
- * 19 Feb 86 file created PAJ
- * 02 Jun 87 converted to V2.3 CAG
- * 06 Mar 89 WorkBench support provided Jim Locker
- *************************************************************************
- **********************************************************************
- *
- * WBStat version 1.0
- *
- * Let a Fortran application determine whether or not it started from
- * WorkBench
- *
- * Author: Jim Locker, SofTech Inc.
- *
- * 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 = WBStat(0)
- *
- *
- *****************************************************************************
- **********************************************************************
- *
- * 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
- *
- *****************************************************************************
-