Vahag Chakhoyan
Vahag Chakhoyan

Reputation: 779

Tasm macros default value

In turbo assembler i have a macro

subs macro x,y 
    mov ax,x
    sub ax,y
endm

how can I give to y a default value, equal to 1, so I can write

subs bx

and ax becomes equal to bx - 1?

Upvotes: 3

Views: 92

Answers (1)

rkhb
rkhb

Reputation: 14399

subs MACRO x,y
    IFB <y>
        mov ax,x
        sub ax,1
    ELSE
        mov ax,x
        sub ax,y
    ENDIF
ENDM

You need a reference: http://www.bitsavers.org/pdf/borland/turbo_assembler/

Upvotes: 1

Related Questions