www.pudn.com > virtual_gameboy-0.8.8.zip > IBMSTACK.C
/* IbmStack.c This file is part of the VGB-DOS project Copyright (C) Marcel de Kogel (m.dekogel@student.utwente.nl), 1996 You may not use this file for commercial purposes Please notify me if you make any changes to this file */ /* #define TEST */ #include "GB.h" #include "IbmMsdos.h" #include#include #include #include #include #define MIN_STACK_SIZE 1024 #define MAX_STACK_SIZE 65536 #define MIN_STACK_NR 4 #define MAX_STACK_NR 64 static unsigned **StackPtr; static int StackSize; static int NumStacks; static int NumStacksUsed; static int NumFailed; static int TotalFailed=0; static int TotalSuccess=0; static int MaxStacksUsed=0; void ExitStacks (void) { int i; if (!StackPtr) return; for (i=0;i MAX_STACK_SIZE) size=MAX_STACK_SIZE; if (nr MAX_STACK_NR) nr=MAX_STACK_NR; if (size&3) size=(size&(~3))+4; /* stack must be dword-aligned */ StackPtr=malloc (nr*4); if (!StackPtr) return 0; StackSize=size; NumStacks=nr; for (i=0;i