#include <inline/stub.h>
#ifndef BASE_EXT_DECL
#define BASE_EXT_DECL extern struct Library * PotgoBase;
#endif
#ifndef BASE_PAR_DECL
#define BASE_PAR_DECL
#define BASE_PAR_DECL0
#endif
#ifndef BASE_NAME
#define BASE_NAME PotgoBase
#endif
__inline static long AllocPotBits(BASE_PAR_DECL long bits)
{
	BASE_EXT_DECL
	register long res __asm("d0");
	register void *a6 __asm ("a6");
	register long d0 __asm("d0");

	a6 = BASE_NAME;
	d0 = bits;
	__asm volatile ("
	jsr a6@(-0x6)"
	: "=r" (res)
	: "r" (a6), "r" (d0)
	: "d0", "d1", "a0", "a1");
	return res;
}
__inline static void FreePotBits(BASE_PAR_DECL long bits)
{
	BASE_EXT_DECL
	register void *a6 __asm ("a6");
	register long d0 __asm("d0");

	a6 = BASE_NAME;
	d0 = bits;
	__asm volatile ("
	jsr a6@(-0xc)"
	: /* no output */
	: "r" (a6), "r" (d0)
	: "d0", "d1", "a0", "a1");
}
__inline static void WritePotgo(BASE_PAR_DECL long word, long mask)
{
	BASE_EXT_DECL
	register void *a6 __asm ("a6");
	register long d0 __asm("d0");
	register long d1 __asm("d1");

	a6 = BASE_NAME;
	d0 = word;
	d1 = mask;
	__asm volatile ("
	jsr a6@(-0x12)"
	: /* no output */
	: "r" (a6), "r" (d0), "r" (d1)
	: "d0", "d1", "a0", "a1");
}
#undef BASE_EXT_DECL
#undef BASE_PAR_DECL
#undef BASE_PAR_DECL0
#undef BASE_NAME
