
%macro callproc 1-*		;Call a procedure w/ stack frame (C-style)
%rep %0-1
%rotate -1
	push dword %1
%endrep
%rotate -1
	call	%1
	add	esp, byte %0*4-4
%endmacro

;---------------------------------------------------------------------
; Multiple push/pop
;	push eax,ebx,ecx...
;	pop eax,ebx,ecx...

%macro push 1-*.nolist
%rep %0
	push dword %1
%rotate 1
%endrep
%endmacro

%macro pop 1-*.nolist
%rep %0
%rotate -1
	pop dword %1
%endrep
%endmacro

;=========================================================================
%macro $at 2	;$at x,y
	mov dword [xy], %2+(%1<<16)
%endmacro

%macro $color 1	;$color 14
	mov [fore],byte %1
%endmacro

%macro case 2
cmp eax, %1
jz .%2
%endmacro

; Usage: autoexec <label>
;  Calls the label at startup (allows for modular driver code)
%macro autoexec 1
	%ifndef autoexec_list
	  %xdefine autoexec_list %1
	%else
	  %xdefine autoexec_list autoexec_list,%1
	%endif
%endmacro
