MASM Version 5.00 Mixed-Language Example with PASCAL

ID Number: Q40530

5.00

MS-DOS

Summary:

Below are the demonstration files PA.ASM and PAMAIN.PAS from the MASM

Version 5.00 Disk 1 mixed directory.

More Information:

The following is PA.ASM:

.MODEL medium

.CODE

PUBLIC Power2

Power2 PROC

push bp ; Entry sequence - save old BP

mov bp,sp ; Set stack framepointer

mov ax,[bp+8] ; Load Arg1 into AX

mov cx,[bp+6] ; Load Arg2 into 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 PAMAIN.PAS:

program Asmtest(input, output);

function Power2(a:integer; b:integer): integer; extern;

begin

writeln('3 times 2 to the power of 5 is ', Power2(3,5));

end.