3

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?

Vahag Chakhoyan
  • 873
  • 1
  • 10
  • 21
  • Instead of a default value, it would be better to have a whole different expansion: `lea ax, [bx - 1]`. This is better for any constant, not just a default 1, though. – Peter Cordes Apr 09 '19 at 01:52

1 Answers1

1
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/

rkhb
  • 14,159
  • 7
  • 32
  • 60