2 Copyright © 1995-2007, 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 *****************************************************************************/
59 /* has this structure previously been initialized? */
61 if (ucl
->FirstCopList
!= NULL
&&
62 ucl
->FirstCopList
->MaxCount
!= 0 &&
63 ucl
->FirstCopList
->CopIns
!= NULL
)
65 ucl
->FirstCopList
->Count
= ucl
->FirstCopList
->MaxCount
;
66 ucl
->FirstCopList
->CopPtr
= ucl
->FirstCopList
->CopIns
;
67 return ucl
->FirstCopList
;
71 if (NULL
!= (ucl
->FirstCopList
=
72 (struct CopList
*)AllocMem(sizeof(struct CopList
),
73 MEMF_CLEAR
|MEMF_PUBLIC
)))
75 /* if we were successful with the memory allocation then let's get
76 * the buffer for the instructions
78 ucl
->CopList
= ucl
->FirstCopList
;
79 /* further init the coplist structure */
80 ucl
->FirstCopList
->MaxCount
= n
;
82 ucl
->FirstCopList
->CopIns
= (struct CopIns
*)AllocMem(n
*sizeof(struct CopIns
), MEMF_CLEAR
|MEMF_PUBLIC
);
83 ucl
->FirstCopList
->CopPtr
= ucl
->FirstCopList
->CopIns
;
85 /* did we get the memory? */
86 if (NULL
== ucl
->FirstCopList
->CopIns
)
89 return (ucl
->FirstCopList
);
91 } /* UCopperListInit */