How to Pass a Variable Length String from Basic to MASM

ID: Q57363


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2, versions 7.0, 7.1


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 

Additional query words: VBmsdos BasicCom 1.00 7.00 7.10

Keywords :
Version : MS-DOS:1.0; :7.0,7.1
Platform : MS-DOS
Issue type :


Last Reviewed: December 2, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.