I slightly tweaked the original macro to take different delimiters then made a set of wrappers with multiple variations.
.mi MACRO args:VARARG ;; multiple instructions
.multiple_instruction :,args
ENDM
.ma MACRO args:VARARG ;; multiple arguments
.multiple_instruction #,args
ENDM
.mn MACRO args:VARARG ;; alternate multiple arguments
.multiple_instruction ~,args
ENDM
.m MACRO args:VARARG ;; alternate multiple arguments
.multiple_instruction ^,args
ENDM
Using any of the alternatives allows you to use labels so you can produce nightmares like this.
; NOSTACKFRAME
;
; szLen proc
;
; ; rcx = address of string
;
; mov rax, rcx
; sub rax, 1
; lbl:
; REPEAT 3
; add rax, 1
; movzx r10, BYTE PTR [rax]
; test r10, r10
; jz lbl1
; ENDM
;
; add rax, 1
; movzx r10, BYTE PTR [rax]
; test r10, r10
; jnz lbl
;
; lbl1:
; sub rax, rcx
;
; ret
;
; szLen endp
;
; STACKFRAME
.ma NOSTACKFRAME # .szLen proc # mov rax,rcx # sub rax,1 # lbl:
REPEAT 3
.ma add rax,1 # movzx r10, BYTE PTR [rax] # test r10,r10 # jz lbl1
ENDM
.ma add rax,1 # movzx r10, BYTE PTR [rax] # test r10,r10
.ma jnz lbl # lbl1: # sub rax,rcx # ret # .szLen endp # STACKFRAME