home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
514b.lha
/
ToolLib_v8.1
/
Source
/
freqmem.s
< prev
next >
Wrap
Text File
|
1991-06-08
|
3KB
|
87 lines
opt l+,o+,ow-
*
* freqmem.s version 8.1 - © Copyright 1990 Jaba Development
*
* Author : Jan van den Baard
* Assembler : Devpac vesion 2.14
*
incdir 'sys:devpac_inc/'
include 'tool.i'
include 'mymacros.i'
include 'exec/exec_lib.i'
xdef AllocFreq
xdef FreeFreq
xref InitMemoryChain
xref CloseDir
xref FreeDir
*
* special definition so the filerequester buffers are allocated in one call
*
STRUCTURE BigFreq,fr_SIZEOF
STRUCT fr_HeadPtr,28
STRUCT fr_FilePtr,32
STRUCT fr_DirPtr,256
STRUCT fr_PatPtr,32
STRUCT fr_MemPtr,dr_SIZEOF
LABEL fr_BIGSIZEOF
*
* allocate and initialize a filerequester structure
*
AllocFreq: movem.l a2/a6,-(sp)
move.l #fr_BIGSIZEOF,d0
move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
move.l (_SysBase).w,a6 ; allocate the structure &
libcall AllocMem ; buffers
move.l d0,a2
bne.s FreqOK
cldat d0
EndAF: movem.l (sp)+,a2/a6
rts
FreqOK: lea.l fr_HeadPtr(a2),a0 ; initialize the structure
clr.b (a0)
move.l a0,fr_HeadLine(a2)
lea.l fr_FilePtr(a2),a0
clr.b (a0)
move.l a0,fr_FileName(a2)
lea.l fr_DirPtr(a2),a0
clr.b (a0)
move.l a0,fr_DirName(a2)
lea.l fr_PatPtr(a2),a0
clr.b (a0)
move.l a0,fr_DontShow(a2)
lea.l fr_MemPtr(a2),a0
move.l a0,fr_Directory(a2)
lea.l dr_DirMem(a0),a0
move.l #DIRBLOCK,d0
bsr InitMemoryChain
move.l fr_Directory(a2),a0
clr.l dr_NumEntries(a0)
NEWLIST a0
move.w #10,fr_LeftEdge(a2)
move.w #15,fr_TopEdge(a2)
clr.l fr_Caller(a2)
clr.l fr_Screen(a2)
clr.l fr_Reserved(a2)
move.l a2,d0
bra.s EndAF
*
* free a filerequester structure
*
FreeFreq: movem.l a2/a6,-(sp)
move.l a0,a2
move.l fr_Directory(a2),a0
bsr CloseDir ; close the directory
move.l fr_Directory(a2),a0
bsr FreeDir ; Free the directory
move.l #fr_BIGSIZEOF,d0
move.l a2,a1
move.l (_SysBase).w,a6
libcall FreeMem ; free struct & buffers
movem.l (sp)+,a2/a6
rts