How to Pass a Variable Length String from Basic to MASM (57363)



The information in this article applies to:

  • Microsoft Visual Basic for MS-DOS
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.1

This article was previously published under Q57363

SUMMARY

The example below demonstrates how to pass a variable-length string from a compiled Basic program to a MASM procedure.

This information is also included with the Help file provided with the Standard and Professional Editions of Microsoft Visual Basic for MS-DOS, version 1.0.

MORE INFORMATION

Basic to MASM Example

For Visual Basic for MS-DOS, compile and link as follows:
Compile: BC /d basmasm.bas;
         MASM masmtest;
Link:    LINK basmasm.obj masmtest.obj,,,VBDRT10E.lib;

For Basic PDS for MS-DOS and MS OS/2, compile and link as follows:

Compile: BC /Fs/d basmasm.bas;
         MASM masmtest;
Link:    LINK basmasm+masmtest,,,BRT70EFR;

REM ==Basic to MASM code===
DEFINT A-Z
DECLARE SUB printmessage (BYVAL segm, BYVAL offs)
CLS
a$ = "Assembly test successful" + "$"
CALL printmessage(SSEG(a$), SADD(a$))
LOCATE 10, 10
PRINT "Back from assembly"
END

; MASM code here
                    .Model    Medium,basic
                    .stack
                    .code
                    public    printmessage
printmessage        proc      uses ds,segm,offs
                    mov       ax,segm
                    mov       ds,ax
                    mov       dx,offs
                    mov       ah,9
                    int       21h
                    ret
printmessage        endp
                    end
				

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB57363