2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Graphics function UCopperListInit()
8 #include <graphics/copper.h>
9 #include <exec/types.h>
10 #include <exec/memory.h>
11 #include <proto/exec.h>
12 #include "graphics_intern.h"
14 /*****************************************************************************
17 #include <proto/graphics.h>
19 AROS_LH2(struct CopList
*, UCopperListInit
,
22 AROS_LHA(struct UCopList
*, ucl
, A0
),
23 AROS_LHA(WORD
, n
, D0
),
26 struct GfxBase
*, GfxBase
, 99, Graphics
)
29 Allocates and initializes copperlist structures and buffers
30 internal to UCopList structure.
33 ucl - pointer to a UCopList structure. Must not be NULL!
34 n - number of instructions the buffer must be able to hold
37 cl - pointer to a buffer that will accept n intermediate
40 NOTE: this is a pointer to UCopList->FirstCopList!
49 CINIT CMOVE CWAIT CEND graphics/copper.h
55 *****************************************************************************/
58 AROS_LIBBASE_EXT_DECL(struct GfxBase
*,GfxBase
)
60 /* has this structure previously been initialized? */
62 if (ucl
->FirstCopList
!= NULL
&&
63 ucl
->FirstCopList
->MaxCount
!= 0 &&
64 ucl
->FirstCopList
->CopIns
!= NULL
)
66 ucl
->FirstCopList
->Count
= ucl
->FirstCopList
->MaxCount
;
67 ucl
->FirstCopList
->CopPtr
= ucl
->FirstCopList
->CopIns
;
68 return ucl
->FirstCopList
;
72 if (NULL
!= (ucl
->FirstCopList
=
73 (struct CopList
*)AllocMem(sizeof(struct CopList
),
74 MEMF_CLEAR
|MEMF_PUBLIC
)))
76 /* if we were successful with the memory allocation then let's get
77 * the buffer for the instructions
79 ucl
->CopList
= ucl
->FirstCopList
;
80 /* further init the coplist structure */
81 ucl
->FirstCopList
->MaxCount
= n
;
83 ucl
->FirstCopList
->CopIns
= (struct CopIns
*)AllocMem(n
*sizeof(struct CopIns
), MEMF_CLEAR
|MEMF_PUBLIC
);
84 ucl
->FirstCopList
->CopPtr
= ucl
->FirstCopList
->CopIns
;
86 /* did we get the memory? */
87 if (NULL
== ucl
->FirstCopList
->CopIns
)
90 return (ucl
->FirstCopList
);
92 } /* UCopperListInit */