Post Reply 
HP110 FORTRAN / MASM Problem
04-24-2024, 04:49 PM
Post: #1
HP110 FORTRAN / MASM Problem
Hi,
i have MS Fortran 3.31 and MASM 3.0 running on my HP110.
I like to call a assembler proc from Fortran.
I have already read several hours manuals from MS, but it does not work as expected.

I have a working sunposition algorithm in Fortran on the HP110 and like to fetch the time from the dos with bios interrupts with the asm proc.

The external proc is defined in the fortran code like this:

PHP Code:
interface to integer*function getdate(ii)
          
integer*4 ii
      end
      PROGRAM sunpos
      REAL R
(10)
      
INTEGER I
      integer
*4 getdate
      ii 
2
      i
getdate(ii)
... 
This compiles without any errors.

The assembler source is just in test state nd does nothing and looks like this:
PHP Code:
    .8086
    CODE segment
        assume cs 
:CODE
    getdate proc near
        push bp
        pop bp
    getdate endp
    CODE ends
    end 
masm compiles it without error and i made a lib for the linker with MS lib
link sunpos.obj date.obj
or link sunpos,,,date.lib
have always the same error : unresolved externals. So there must be a problem in my definition of Fortran or ASM source.
Can anyone help?
Ralf

/41/48/
Find all posts by this user
Quote this message in a reply
04-25-2024, 10:52 AM
Post: #2
RE: HP110 FORTRAN / MASM Problem
Ralf,

you might want to
a) declare the function as PUBLIC in the assembler code,
b) change the name GETDATE to upper case,
c) make sure that the stack is cleaned up properly in the assembler routine, e.g. by a RET 4 instruction as there is only one parameter to the function GETDATE.

Best to follow the examples in the manual before starting into something more complex.

Martin
Find all posts by this user
Quote this message in a reply
04-28-2024, 09:27 AM (This post was last modified: 05-01-2024 01:12 PM by Martin Hepperle.)
Post: #3
RE: HP110 FORTRAN / MASM Problem
Ralf,

attached are some working examples using FORTRAN 3.31, Pascal 3.31, Quick Basic 4.5 and Quick C 2.5 for the main program and implementing some functions and subroutines in an assembler module. The code simply follows the calling conventions explained in the manuals. The assembler module is always the same.

I noted that the available archives containing Microsoft FORTRAN 3.31 seem to be based on an installed copy and include a few files which were not part of the original distribution (e.g. EGA... stuff and GRAPHICS.LIB and SUPPORT.LIB).

The early Microsoft FORTRANs up to 3.x were based on the CP/M versions and they were closely related to the Pascal compiler (in fact both compilers use the same back ends PAS2 and PAS3). The manual states that the FORTRAN compiler itself was written in Pascal.

Later versions, starting with 4.0, were obviously largely rewritten and differ in command line parameters and such. Version 5.1 was the last of this line and works very well together with "C" 5.1, MASM 5.1, as well as compiled BASIC.

Martin


Attached File(s)
.zip  MIXLANG.zip (Size: 877.43 KB / Downloads: 1)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)