home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / ddx / cfb / stip68kgnu.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-23  |  4.0 KB  |  126 lines

  1. /*
  2.  * $XConsortium: stip68kgnu.h,v 1.1 91/02/23 12:43:35 rws Exp $
  3.  *
  4.  * Copyright 1990 Massachusetts Institute of Technology
  5.  *
  6.  * Permission to use, copy, modify, distribute, and sell this software and its
  7.  * documentation for any purpose is hereby granted without fee, provided that
  8.  * the above copyright notice appear in all copies and that both that
  9.  * copyright notice and this permission notice appear in supporting
  10.  * documentation, and that the name of M.I.T. not be used in advertising or
  11.  * publicity pertaining to distribution of the software without specific,
  12.  * written prior permission.  M.I.T. makes no representations about the
  13.  * suitability of this software for any purpose.  It is provided "as is"
  14.  * without express or implied warranty.
  15.  *
  16.  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  17.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
  18.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  19.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  20.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
  21.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  22.  *
  23.  * Author:  Keith Packard, MIT X Consortium
  24.  */
  25.  
  26. /*
  27.  * Stipple stack macro for 68k GCC
  28.  *
  29.  * Note - this macro can nott describe the full extent of the
  30.  * modifications made to the arguments (GCC does not allow enough
  31.  * arguments to __asm statements).  Therefore, it is possible
  32.  * (though unlikely) that future magic versions of GCC may
  33.  * miscompile this somehow.  In particular, (stipple) is modified
  34.  * by the macro, yet not listed as an output value.
  35.  */
  36.  
  37. #define STIPPLE(addr,stipple,value,width,count,shift) \
  38.     __asm volatile ( \
  39.        "subqw   #1,%1\n\
  40.     lea    0f,a1\n\
  41.     movew    #28,d2\n\
  42.     addl    %7,d2\n\
  43.     movew    #28,d3\n\
  44.     subql    #4,%7\n\
  45.     negl    %7\n\
  46. 1:\n\
  47.     movel    %0,a0\n\
  48.     addl    %5,%0\n\
  49.     movel    %3@+,d1\n\
  50.     beq    3f\n\
  51.     movel    d1,d0\n\
  52.     lsrl    d2,d0\n\
  53.     lsll    #5,d0\n\
  54.     lsll    %7,d1\n\
  55.     jmp    a1@(d0:l)\n\
  56. 2:\n\
  57.     addl    #4,a0\n\
  58.     movel    d1,d0\n\
  59.     lsrl    d3,d0\n\
  60.     lsll    #5,d0\n\
  61.     lsll    #4,d1\n\
  62.     jmp    a1@(d0:l)\n\
  63. 0:\n\
  64.     bne 2b ; dbra %1,1b ; bra 4f\n\
  65.     . = 0b + 0x20\n\
  66.     moveb    %4,a0@(3)\n\
  67.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f\n\
  68.     . = 0b + 0x40\n\
  69.     moveb    %4,a0@(2)\n\
  70.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f\n\
  71.     . = 0b + 0x60\n\
  72.     movew    %4,a0@(2)\n\
  73.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f\n\
  74.     . = 0b + 0x80\n\
  75.     moveb    %4,a0@(1)\n\
  76.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
  77.     . = 0b + 0xa0\n\
  78.     moveb    %4,a0@(3) ; moveb    %4,a0@(1)\n\
  79.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
  80.     . = 0b + 0xc0\n\
  81.     movew    %4,a0@(1)\n\
  82.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
  83.     . = 0b + 0xe0\n\
  84.     movew    %4,a0@(2) ; moveb    %4,a0@(1)\n\
  85.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
  86.     . = 0b + 0x100\n\
  87.     moveb    %4,a0@(0)\n\
  88.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
  89.     . = 0b + 0x120\n\
  90.     moveb    %4,a0@(3) ; moveb    %4,a0@(0)\n\
  91.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
  92.     . = 0b + 0x140\n\
  93.     moveb    %4,a0@(2) ; moveb    %4,a0@(0)\n\
  94.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
  95.     . = 0b + 0x160\n\
  96.     movew    %4,a0@(2) ; moveb    %4,a0@(0)\n\
  97.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
  98.     . = 0b + 0x180\n\
  99.     movew    %4,a0@(0)\n\
  100.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
  101.     . = 0b + 0x1a0\n\
  102.     moveb    %4,a0@(3) ; movew    %4,a0@(0)\n\
  103.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
  104.     . = 0b + 0x1c0\n\
  105.     moveb    %4,a0@(2) ; movew    %4,a0@(0)\n\
  106.     andl    d1,d1 ; bne 2b ; dbra %1,1b ; bra 4f ;\n\
  107.     . = 0b + 0x1e0\n\
  108.     movel    %4,a0@(0)\n\
  109.     andl    d1,d1 ; bne 2b ; \n\
  110. 3:     dbra %1,1b ; \n\
  111. 4:\n"\
  112.         : "=a" (addr),        /* %0 */ \
  113.           "=d" (count)        /* %1 */ \
  114.         : "0" (addr),        /* %2 */ \
  115.           "a" (stipple),        /* %3 */ \
  116.           "d" (value),        /* %4 */ \
  117.           "a" (width),        /* %5 */ \
  118.           "1" (count),        /* %6 */ \
  119.           "d" (shift)        /* %7 */ \
  120.         : /* ctemp */        "d0", \
  121.            /* c */            "d1", \
  122.           /* lshift */        "d2", \
  123.           /* rshift */        "d3", \
  124.            /* atemp */        "a0", \
  125.            /* case */        "a1")
  126.