1 | /*
|
---|
2 | *
|
---|
3 | Copyright 1990, 1998 The Open Group
|
---|
4 |
|
---|
5 | Permission to use, copy, modify, distribute, and sell this software and its
|
---|
6 | documentation for any purpose is hereby granted without fee, provided that
|
---|
7 | the above copyright notice appear in all copies and that both that
|
---|
8 | copyright notice and this permission notice appear in supporting
|
---|
9 | documentation.
|
---|
10 |
|
---|
11 | The above copyright notice and this permission notice shall be included in
|
---|
12 | all copies or substantial portions of the Software.
|
---|
13 |
|
---|
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
17 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
18 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
20 |
|
---|
21 | Except as contained in this notice, the name of The Open Group shall not be
|
---|
22 | used in advertising or otherwise to promote the sale, use or other dealings
|
---|
23 | in this Software without prior written authorization from The Open Group.
|
---|
24 | *
|
---|
25 | * Author: Keith Packard, MIT X Consortium
|
---|
26 | */
|
---|
27 |
|
---|
28 | /*
|
---|
29 | * Stipple stack macro for 68k GCC
|
---|
30 | */
|
---|
31 |
|
---|
32 | #define STIPPLE(addr,stipple,value,width,count,shift) \
|
---|
33 | __asm volatile ( \
|
---|
34 | "lea 5f,%/a1\n\
|
---|
35 | moveq #28,%/d2\n\
|
---|
36 | addl %2,%/d2\n\
|
---|
37 | moveq #28,%/d3\n\
|
---|
38 | subql #4,%2\n\
|
---|
39 | negl %2\n\
|
---|
40 | 1:\n\
|
---|
41 | movel %0,%/a0\n\
|
---|
42 | addl %6,%0\n\
|
---|
43 | movel %3@+,%/d1\n\
|
---|
44 | jeq 3f\n\
|
---|
45 | movel %/d1,%/d0\n\
|
---|
46 | lsrl %/d2,%/d0\n\
|
---|
47 | lsll #5,%/d0\n\
|
---|
48 | lsll %2,%/d1\n\
|
---|
49 | jmp %/a1@(%/d0:l)\n\
|
---|
50 | 2:\n\
|
---|
51 | addl #4,%/a0\n\
|
---|
52 | movel %/d1,%/d0\n\
|
---|
53 | lsrl %/d3,%/d0\n\
|
---|
54 | lsll #5,%/d0\n\
|
---|
55 | lsll #4,%/d1\n\
|
---|
56 | jmp %/a1@(%/d0:l)\n\
|
---|
57 | 5:\n\
|
---|
58 | jne 2b ; dbra %1,1b ; jra 4f\n\
|
---|
59 | . = 5b + 0x20\n\
|
---|
60 | moveb %5,%/a0@(3)\n\
|
---|
61 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
|
---|
62 | . = 5b + 0x40\n\
|
---|
63 | moveb %5,%/a0@(2)\n\
|
---|
64 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
|
---|
65 | . = 5b + 0x60\n\
|
---|
66 | movew %5,%/a0@(2)\n\
|
---|
67 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
|
---|
68 | . = 5b + 0x80\n\
|
---|
69 | moveb %5,%/a0@(1)\n\
|
---|
70 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
|
---|
71 | . = 5b + 0xa0\n\
|
---|
72 | moveb %5,%/a0@(3) ; moveb %5,%/a0@(1)\n\
|
---|
73 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
|
---|
74 | . = 5b + 0xc0\n\
|
---|
75 | movew %5,%/a0@(1)\n\
|
---|
76 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
|
---|
77 | . = 5b + 0xe0\n\
|
---|
78 | movew %5,%/a0@(2) ; moveb %5,%/a0@(1)\n\
|
---|
79 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
|
---|
80 | . = 5b + 0x100\n\
|
---|
81 | moveb %5,%/a0@\n\
|
---|
82 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
|
---|
83 | . = 5b + 0x120\n\
|
---|
84 | moveb %5,%/a0@(3) ; moveb %5,%/a0@\n\
|
---|
85 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
|
---|
86 | . = 5b + 0x140\n\
|
---|
87 | moveb %5,%/a0@(2) ; moveb %5,%/a0@\n\
|
---|
88 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
|
---|
89 | . = 5b + 0x160\n\
|
---|
90 | movew %5,%/a0@(2) ; moveb %5,%/a0@\n\
|
---|
91 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
|
---|
92 | . = 5b + 0x180\n\
|
---|
93 | movew %5,%/a0@\n\
|
---|
94 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
|
---|
95 | . = 5b + 0x1a0\n\
|
---|
96 | moveb %5,%/a0@(3) ; movew %5,%/a0@\n\
|
---|
97 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
|
---|
98 | . = 5b + 0x1c0\n\
|
---|
99 | moveb %5,%/a0@(2) ; movew %5,%/a0@\n\
|
---|
100 | andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
|
---|
101 | . = 5b + 0x1e0\n\
|
---|
102 | movel %5,%/a0@\n\
|
---|
103 | andl %/d1,%/d1 ; jne 2b ; \n\
|
---|
104 | 3: dbra %1,1b ; \n\
|
---|
105 | 4:\n"\
|
---|
106 | : "=a" (addr), /* %0 */ \
|
---|
107 | "=d" (count), /* %1 */ \
|
---|
108 | "=d" (shift), /* %2 */ \
|
---|
109 | "=a" (stipple) /* %3 */ \
|
---|
110 | : "0" (addr), /* %4 */ \
|
---|
111 | "d" (value), /* %5 */ \
|
---|
112 | "a" (width), /* %6 */ \
|
---|
113 | "1" (count-1), /* %7 */ \
|
---|
114 | "2" (shift), /* %8 */ \
|
---|
115 | "3" (stipple) /* %9 */ \
|
---|
116 | : /* ctemp */ "d0", \
|
---|
117 | /* c */ "d1", \
|
---|
118 | /* lshift */ "d2", \
|
---|
119 | /* rshift */ "d3", \
|
---|
120 | /* atemp */ "a0", \
|
---|
121 | /* case */ "a1")
|
---|