2000-08-29 21:54:22 +02:00
|
|
|
/**************************/
|
|
|
|
/*** Memory Alloc Stuff ***/
|
|
|
|
/**************************/
|
|
|
|
|
|
|
|
#ifndef __MEMORY_HEADER__
|
|
|
|
#define __MEMORY_HEADER__
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _GLOBAL_HEADER_
|
|
|
|
#include "system\global.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-11-21 16:34:03 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef __VERSION_DEBUG__
|
2000-11-20 16:45:17 +01:00
|
|
|
#define __DEBUG_MEM__ // Define if you want to debug memory - TS
|
2000-11-21 16:21:20 +01:00
|
|
|
#endif
|
2000-08-29 21:54:22 +02:00
|
|
|
|
2000-11-21 16:34:03 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
2000-08-29 21:54:22 +02:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
#define LListLen 50
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char *Addr;
|
|
|
|
u32 Len;
|
|
|
|
u16 Prev;
|
|
|
|
u16 Next;
|
|
|
|
}sLLNode;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
u32 TotalRam;
|
|
|
|
u32 RamUsed;
|
|
|
|
|
|
|
|
u16 Head;
|
|
|
|
u16 Tail;
|
|
|
|
u16 SP;
|
|
|
|
|
|
|
|
u16 Stack[LListLen];
|
|
|
|
|
|
|
|
sLLNode Nodes[LListLen];
|
|
|
|
} sLList;
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
char * MemAllocate( u32 Size, char const *Name, char const * File, int LineNumber);
|
|
|
|
|
|
|
|
void MemInit();
|
|
|
|
void DebugMemFontInit();
|
|
|
|
void MemFree(void *Addr);
|
|
|
|
|
|
|
|
void * operator new(size_t Size, const char * name = NULL);
|
|
|
|
void * operator new[](size_t Size, const char * name = NULL);
|
|
|
|
void operator delete(void *Ptr);
|
|
|
|
void operator delete[](void *Ptr);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __VERSION_DEBUG__
|
2000-11-21 16:34:03 +01:00
|
|
|
void dumpDebugMem();
|
|
|
|
#define MemAlloc( Size, Name ) MemAllocate( (Size), (Name), __FILE__, __LINE__ )
|
2000-08-29 21:54:22 +02:00
|
|
|
#else
|
2000-11-21 16:34:03 +01:00
|
|
|
#define MemAlloc(Size,Name) MemAllocate( (Size), NULL, NULL, 0 )
|
2000-08-29 21:54:22 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
extern sLList MainRam; // Ah well!
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#endif
|