Microsoft KB Archive/40531

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

MASM Version 5.00 Mixed-Language Example with FORTRAN ID Number: Q40531

5.00 MS-DOS

Summary:

Below are the demonstration files FA.ASM and FAMAIN.FOR from the MASM Version 5.00 Disk 1 mixed directory.

More Information:

The following is FA.ASM:

.MODEL large .CODE PUBLIC Power2 Power2 PROC push bp ; Entry sequence - save old BP mov bp,sp ; Set stack framepointer

    les     bx,[bp+10]      ; Load Arg1 into
    mov     ax,[bx]         ;   AX
    les     bx,[bp+6]       ; Load Arg2 into
    mov     cx,[bx]         ;   CX
    shl     ax,cl           ; AX = AX * (2 to power of CX)
                            ; Leave return value in AX

    pop     bp              ; Restore old framepointer
    ret     4               ; Exit, and restore 4 bytes of args

Power2 ENDP END

The following is FAMAIN.FOR:

    INTERFACE TO INTEGER*2 FUNCTION POWER2(A,B)
    INTEGER*2 A,B
    END

C INTEGER2 POWER2 INTEGER2 A,B A = 3 B = 5 WRITE (,) ‘3 times 2 to the power of 5 is’,POWER2(A,B) END