Microsoft KB Archive/40531

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 19:22, 12 August 2020 by X010 (talk | contribs) (X010 moved page Microsoft KB Archive/Q40531 to Microsoft KB Archive/40531 without leaving a redirect: Text replacement - "Microsoft KB Archive/Q" to "Microsoft KB Archive/")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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