home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
d07xx
/
d0744.lha
/
FO2
/
Sources_FO2
/
mem.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-10-12
|
1KB
|
77 lines
#include "defs.h"
Prototype RendMem();
Prototype RendAdrVar();
Prototype FreeBusy();
Prototype FreeDiskList();
RendMem()
{
LONG *M=(void *)0x1;
WORD i=0;
if (VarAdr) {
if (VarAdr->BuffBitMap)
{
FreeMem(BBM,512L);
BBM=0L;
}
if (VarAdr->BuffTrack)
{
FreeMem(BT,11*512L);
BT=0L;
}
if (VarAdr->Empty)
{
FreeMem(VarAdr->Empty,512L);
VarAdr->Empty=0;
}
i=0;
while (M)
{
M=(LONG *)(*VarAdr->TableMem)[i++];
if (M)
{
FreeMem(M,512L);
(*VarAdr->TableMem)[i-1]=0;
}
else break;
}
if (VarAdr->TableMem)
{FreeMem(VarAdr->TableMem,VarAdr->TotalBlocks*4+4); VarAdr->TableMem=0;}
if (dsklist) FreeDiskList();
if (VarAdr->inCHIP) {FreeMem(VarAdr->inCHIP,512L); VarAdr->inCHIP=0;}
if (FPointer) {fclose(FPointer); FPointer=0;}
}
}
RendAdrVar()
{
if (VarAdr) {FreeMem(VarAdr,sizeof(struct var)); VarAdr=0;}
}
FreeBusy()
{
DiskBUSY(drivebusy,0);
}
FreeDiskList()
{
struct DiskList *dlist;
LONG length=0;
LONG *tmp;
dlist=dsklist;
do
{
length=Length(dlist);
tmp=dlist->dl_NextB;
if (dlist && length) FreeMem(dlist,length);
dlist=tmp;
}
while (dlist->dl_NextB!=0);
FreeMem(dlist,Length(dlist));
dsklist=0;
}