vbdpss.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Article Q57363
                                                 Contents  Index  Back
─────────────────────────────────────────────────────────────────────────────
                           Knowledge Base Contents  Knowledge Base Index
 
 How to Pass a Variable Length String from BASIC to MASM - Q57363
 
 The example listed below demonstrates how to pass a variable-length
 string from a compiled BASIC program to a MASM procedure.
 
 More Information:
 
 BASIC to MASM Example
 ---------------------
 
 Compile and link as follows:
 
 Compile: BC /d basmasm.bas;
          MASM masmtest;
 Link:    LINK basmasm.obj masmtest.obj,,,VBDRT10E.lib;
 
 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