2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function CBump()
8 #include <exec/types.h>
9 #include <graphics/copper.h>
10 #include "graphics_intern.h"
11 #include <proto/exec.h>
13 /*****************************************************************************
16 #include <proto/graphics.h>
21 AROS_LHA(struct UCopList
*, ucl
, A1
),
24 struct GfxBase
*, GfxBase
, 61, Graphics
)
27 Increment user copper list pointer. If the current user copper list
28 is full a new one will be created and worked on.
31 ucl - pointer to a UCopList structure
36 CWAIT() and CMOVE() automatically call this function!
43 CINIT(), CWAIT(), CMOVE(), CEND(), graphics/copper.h
49 *****************************************************************************/
54 #define NewCopListSize 10
57 /* increment the instruction counter */
58 ucl
->CopList
->Count
++;
60 /* is the current CopList full? */
61 if (ucl
->CopList
->MaxCount
== ucl
->CopList
->Count
)
63 struct CopList
* NextCopList
;
65 /* switch to the next CopList in the list, if it exists,
66 otherwise alloc some memory for it */
67 if (NULL
!= ucl
->CopList
->Next
)
68 NextCopList
= ucl
->CopList
->Next
;
71 NextCopList
= (struct CopList
*)AllocMem(sizeof(struct CopList
), MEMF_CLEAR
|MEMF_PUBLIC
);
72 if (NULL
!= NextCopList
)
74 ucl
->CopList
->Next
= NextCopList
;
75 /* this new one should hold 10 instructions */
76 if (NULL
==( NextCopList
->CopIns
=
77 AllocMem(NewCopListSize
*sizeof(struct CopIns
),
78 MEMF_CLEAR
|MEMF_PUBLIC
)))
79 return; /* couldn't get memory */
81 NextCopList
->CopPtr
= NextCopList
->CopIns
;
82 NextCopList
->MaxCount
= NewCopListSize
;
84 else /* couldn't get memory */
88 /* move the very last instruction from the old buffer to the new one... */
89 NextCopList
->CopPtr
->OpCode
= ucl
->CopList
->CopPtr
->OpCode
;
90 NextCopList
->CopPtr
->u3
.nxtlist
= ucl
->CopList
->CopPtr
->u3
.nxtlist
;
92 /*... and leave a concatenation OpCode at that place */
93 ucl
->CopList
->CopPtr
->OpCode
= CPRNXTBUF
;
94 ucl
->CopList
->CopPtr
->u3
.nxtlist
= NextCopList
;
96 /* don't forget to increment the pointer and counter in the new list */
97 NextCopList
->CopPtr
++;
100 /* leave a pointer to the new list in the UCopList */
101 ucl
->CopList
= NextCopList
;
103 else /* current CopList is not full */
105 /* increment the pointer for the next instruction */
106 ucl
->CopList
->CopPtr
++;
109 #undef NewCopListSize