; std headers
%pragma once
%ifndef Xstd
%define Xstd
bits 16

%define multiply(x,y)   _multiply x,y   ; multiply :: int16 -> int16 -> int16

%ifdef xstd
    global Multiply
%else
    extern Multiply
%endif

%macro _multiply 2
    mov ax,%2
    push ax
    mov ax,%1
    push ax
    call Multiply
    add sp,4
%endmacro

; carry <num args>
%macro carry 1
    jc %%carry
    add sp,(%1*2)
    clc
    jmp %%end

    %%carry:
        add sp,(%1*2)
        stc
    %%end:
%endmacro

%endif