再看reparg (arg1) 宏
; -----------------------------------------------------------
; This macro replaces quoted text with a DATA section OFFSET
; and returns it in ADDR "name" format. It is used by other
; macros that handle optional quoted text as a parameter.
; -----------------------------------------------------------
reparg MACRO arg
LOCAL nustr
quot SUBSTR <arg>,1,1
IFIDN quot,<"> ;; if 1st char = "
.data
nustr db arg,0 ;; write arg to .DATA section
.code
EXITM <ADDR nustr> ;; append name to ADDR operator
ELSE
EXITM <arg> ;; else return arg
ENDIF
ENDM
If you want a prompt use this version
mov lpstring, input("Type text here : ")
If you don't need a prompt use the following
mov lpstring, input()
NOTE : The "lpstring" is a preallocated
DWORD variable that is either LOCAL
or declared in the .DATA or .DATA?
section. Any legal name is OK.
LIMITATION : MASM uses < > internally in its
macros so if you wish to use these symbols
in a prompt, you must use the ascii value
and not use the symbol literally.
EXAMPLE mov var, input("Enter number here ",62," ")
; ----------------------------------------------------------
; str$ macros that takes a DWORD parameter and
; returns the address of the buffer that holds the result.
; The return format is for use within the INVOKE syntax.
; ----------------------------------------------------------
str$ MACRO DDvalue
LOCAL rvstring
.data
rvstring db 20 dup (0)
align 4
.code
invoke dwtoa,DDvalue,ADDR rvstring
EXITM <ADDR rvstring>
ENDM
include windows.inc
include user32.inc
include kernel32.inc
include masm32.inc
include c:\masm32\macros\macros.asm
includelib masm32.lib
includelib kernel32.lib
includelib user32.lib