vbdpss.hlp (Table of Contents; Topic list)
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