[BITS 32]
[segment .text align 4]
;extern _basic_call
;extern _basic_fcall
extern _basic_inf
extern _basic_regfun
extern _basic_ccall
extern _basic_ncall
extern _basic_create_array
extern _basic_create_var
extern _basic_array
extern _basic_addr
extern _basic_vstart
extern _basic_astart
;extern _basic_array2
extern _basic_ret
extern _basic_inc
extern _basic_apop
extern _basic_begin
extern _basic_print
;extern _basic_print2
extern _basic_input
extern _basic_nop
extern _basic_add
extern _basic_jmp
extern _basic_jz
extern _basic_je
extern _basic_sub
extern _basic_mul
extern _basic_div
extern _basic_lt
extern _basic_gt
extern _basic_lteq
extern _basic_gteq
extern _basic_neq
extern _basic_eq
extern _basic_and
extern _basic_or
extern _basic_xor
extern _basic_not
extern _basic_push
extern _basic_ipush
extern _basic_apush
extern _basic_spush
;extern _basic_push2
extern _basic_pop
extern _basic_concat
extern _basic_uminus
extern _basic_init
extern _basic_fin
extern _basic_import
extern _basic_use
extern _basic_l_val
extern _basic_r_val
extern _exit

%macro BASIC_EXIT 1
	push dword %1
	call _exit
%endmacro

%macro BASIC_ADDR 1
	push dword %1
	call _basic_addr
	add esp,4
%endmacro

%macro BASIC_VSTART 2
	push dword %2
	push dword %1
	call _basic_vstart
	add esp,8
%endmacro

%macro BASIC_L_VAL 2
	push dword %2
	push dword %1
	call _basic_l_val
	add esp,8
%endmacro

%macro BASIC_R_VAL 2
	push dword %2
	push dword %1
	call _basic_r_val
	add esp,8
%endmacro

%macro BASIC_INIT 1
	push dword %1
	call _basic_init
	add esp,4
%endmacro

%macro BASIC_START 0
	push ebp
	mov ebp,esp
%endmacro

%macro BASIC_IMPORT 1
	push dword %1
	call _basic_import
	add esp,4
%endmacro

%macro BASIC_USE 2 
	push dword %1
	call _basic_use
	add esp,4
%endmacro

%macro BASIC_APUSH 3
	push dword %3
	push dword %2
	push dword %1
	call _basic_apush 
	add esp,12
%endmacro 

%macro BASIC_SPUSH 1
	push dword %1
	call _basic_spush 
	add esp,4
%endmacro 

%macro BASIC_IPUSH 1
	push dword %1
	call _basic_ipush 
	add esp,4
%endmacro 

%macro BASIC_PUSH 1
	push dword %1
	call _basic_push 
	add esp,4
%endmacro 

%macro BASIC_POP 1
        push dword %1
	call _basic_pop
%endmacro 

%macro BASIC_PRINT 1
	push dword %1
	call _basic_print
	add esp,4
%endmacro

%macro BASIC_FIN 0
	call _basic_fin
%endmacro

%macro BASIC_FCALL 1
	call _basic_pop
	call %1
%endmacro

%macro BASIC_CALL 2
	call %2
%endmacro

%macro BASIC_COMPCALL 2
	call %2
%endmacro

%macro BASIC_REGFUN 2
	push dword %2
	push dword %1
	call _basic_regfun
	add esp,8
%endmacro

%macro BASIC_NCALL 2
	push dword %2
	push dword %1
	call _basic_ncall
	add esp,8
%endmacro

%macro BASIC_CCALL 1
	push dword %1
	call _basic_ccall
	add esp,4
%endmacro

%macro BASIC_ASTART 2
	push dword %2
	push dword %1
	call _basic_astart
	add esp,8
%endmacro

%macro BASIC_CREATE_ARRAY 3
	push dword %3
	push dword %2
	push dword %1
	call _basic_create_array
	add esp,12
%endmacro

%macro BASIC_CREATE_VAR 3
	push dword %3
	push dword %2
	push dword %1
	call _basic_create_var
	add esp,4+4+4
%endmacro

%macro BASIC_ARRAY 2
	push dword %2
	push dword %1
	call _basic_array
	add esp,8
%endmacro

%macro BASIC_ARRAY2 0
	call _basic_array2
%endmacro

%macro BASIC_INF 0
	call _basic_inf
%endmacro

%macro BASIC_RET2 1
	;call _basic_ret
	mov eax,%1
	leave
	ret
%endmacro

%macro BASIC_RET 0
	;call _basic_ret
	leave
	ret
%endmacro

%macro BASIC_PRINT2 0
	call _basic_print2
%endmacro

%macro BASIC_INPUT 0
	call _basic_input
%endmacro

%macro BASIC_NOP 0
	call _basic_nop
%endmacro

%macro BASIC_ADD 0
	call _basic_add
%endmacro

%macro BASIC_JMP 1
	jmp %1
%endmacro

%macro BASIC_JZ 1
	call _basic_jz
	cmp eax,1
	jz %1
%endmacro

%macro BASIC_JE 1
	call _basic_je
	cmp eax,1
	je %1
%endmacro

%macro BASIC_SUB 0
	call _basic_sub
%endmacro

%macro BASIC_MUL 0
	call _basic_mul
%endmacro

%macro BASIC_DIV 0
	call _basic_div
%endmacro

%macro BASIC_LT 0
	call _basic_lt
%endmacro

%macro BASIC_GT 0
	call _basic_gt
%endmacro

%macro BASIC_LTEQ 0
	call _basic_lteq
%endmacro

%macro BASIC_GTEQ 0
	call _basic_gteq
%endmacro

%macro BASIC_NEQ 0
	call _basic_neq
%endmacro

%macro BASIC_EQ 0
	call _basic_eq
%endmacro

%macro BASIC_AND 0
	call _basic_and
%endmacro

%macro BASIC_OR 0
	call _basic_or
%endmacro

%macro BASIC_XOR 0
	call _basic_xor
%endmacro

%macro BASIC_NOT 0
	call _basic_not
%endmacro

%macro BASIC_PUSH2 1
	push dword %1
	call _basic_push2
	add esp,4
%endmacro

%macro BASIC_CONCAT 0
	call _basic_concat
%endmacro

%macro BASIC_UMINUS 0
	call _basic_uminus
%endmacro

%macro BASIC_APOP 3
	push dword %3
	push dword %2
	push dword %1
	call _basic_apop
	add esp,12
%endmacro

%macro BASIC_INC 3
	push dword %3
	push dword %2
	push dword %1
	call _basic_inc
	add esp,12
%endmacro

%macro BASIC_BEGIN 0
	push ebp
	mov ebp,esp
	;call _basic_begin
%endmacro

%macro BASIC_END 0
	leave
	ret
%endmacro
