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.
StringAssign and StringRelease Programming Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
'This example uses the StringAssign and StringRelease routines to get
'a string from an assembly-language program.
'Note: To use this program, you must compile the following code and link
'it with the assembled MASM program (shown below in remarks) and the
'appropriate runtime library (BCL71ENR.LIB).
DEFINT A-Z
'Declare external MASM procedures.
DECLARE FUNCTION MakeString$
DECLARE SUB ReleaseIt
'Get string from MASM and print it.
PRINT MakeString
'Have MASM release the variable-length string it created.
CALL ReleaseIt
'; *********************** MakeString ********************************
'
';This MASM program creates a fixed-length string and
';then assigns it to a BASIC variable-length string.
';It then releases the string after BASIC has used it.
'
' .model medium, basic ;Use same model as BASIC
'
';Declare routines in BASIC library to be used.
' extrn StringAssign: far
' extrn StringRelease: far
'
' .data
';Create MASM string and a place for BASIC to create a
';variable-length string descriptor.
'String2 db "This is a string created by MASM."
'Descriptor dd 0
'
' .code
'
'MakeString proc ;Push arguments:
' push ds ;MASM string segment.
' lea ax, String2 ;MASM string offset.
' push ax
' mov ax, 33 ;MASM string length.
' push ax
' push ds ;BASIC descriptor segment.
' lea ax, Descriptor
' push ax ;BASIC descriptor offset
' xor ax, ax ;variable-length indicator.
' push ax
' call StringAssign ;Assign the string.
'
' lea ax, descriptor ;Return with descriptor
' ret ;address in AX.
'MakeString endp
'
'ReleaseIt proc ;Routine to release
' lea ax, Descriptor ;the string.
' push ax
' call StringRelease
' ret
'ReleaseIt endp
' end