#include <stdarg.h>
#include "portab.h"
#include "slibc.h"
#include "glib.h"
#include "gemlib.h"
#include "jazobj.h"
#include "algobj.h"
#include "jazenv.h"
#include "jazsyn.h"
#include "jazosc.h"
#include "ptchptch.h"
#include "dos.h"

/*	---------
 *	EXTERNALS
 */
EXTERN WORD 	scrn_w;
EXTERN WORD 	scrn_h;
EXTERN ULONG	patchtab[][PATCH_SIZE];
EXTERN MDTAB	mdtab_table[];
EXTERN PATCHINFO patchinfo_table[];
EXTERN WORD	curr_pnr;
EXTERN ENVTAB	env_table[];
EXTERN ENVTAB	dflt_envtab;
EXTERN SMPTAB	sample_table[];
EXTERN WORD	smpslot_cnt;
EXTERN WORD	envslot_cnt;
EXTERN WORD	mdtabslot_cnt;
EXTERN WORD	patch_cnt;



jaz_debug()
{
	BYTE buf[128];
	WORD active, i;
	LONG size;

	dos_echo("\t\tUSED\tAVAIL\tRAM USE\tACTIVE\tMAX ACTIVE");
	active = 0;
	for (i = 0; i < patch_cnt; i++)
		if (patchinfo_table[i].active)
			active++;
	sprintf(buf,"patches:\t%d\t%d\t%d\t%d\tdepends", 
		patch_cnt, 
		128 - patch_cnt,
		128 * 21,
		active);
	dos_echo(buf);

	active = 0;
	size = 0L;
	for (i = 0; i < smpslot_cnt; i++)
		if (!sample_table[i].free) {
			active++;
			size += sample_table[i].size;
		}
	
	sprintf(buf,"samples:\t%d\t%d\t%ld\t%d\tx", 
		smpslot_cnt, 
		128 - smpslot_cnt,
		size,
		active);
	dos_echo(buf);

	active = 0;
	size = 0L;
	for (i = 0; i < mdtabslot_cnt; i++)
		if (!mdtab_table[i].free) {
			active++;
		}
	
	sprintf(buf,"mdtabs:\t%d\t%d\t%d\t%d\t%d", 
		mdtabslot_cnt, 
		128 - mdtabslot_cnt,
		(WORD)128 * (WORD)sizeof(MDTAB),
		active,
		10);
	dos_echo(buf);

	active = 0;
	size = 0L;
	for (i = 0; i < envslot_cnt; i++)
		if (!env_table[i].free) {
			active++;
		}
	
	sprintf(buf,"envs:\t\t%d\t%d\t%d\t%d\tx", 
		envslot_cnt, 
		128 - mdtabslot_cnt,
		(WORD)128 * (WORD)sizeof(ENVTAB),
		active);
	dos_echo(buf);

}
