Reputation: 337
Is it possible to pass an array as a parameter in macro in assembly? For example,
setXY macro temp[0], temp[1] ; temp is word-sized
mov ax, temp[0]
mov bx, temp[1]
and somewhere in the body you'll call setXY coor[0], coor[1]
.
Is it permissible?
Upvotes: 1
Views: 1301
Reputation: 58507
If you have the following macro:
do_stuff MACRO x, y
mov ax,[x]
mov bx,[y]
add ax,bx
ENDM
And an array of words:
coor dw 1, 3, 5, 7
You could do e.g.:
; Use the do_stuff macro with the first two elements of coor as
; the arguments
do_stuff coor, coor+2
Which would give you ax
== 1 + 3
== 4
.
Upvotes: 1