/*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "maskbits.h" /* these tables are used by several macros in the mfb code. the vax numbers everything left to right, so bit indices on the screen match bit indices in longwords. the pc-rt and Sun number bits on the screen the way they would be written on paper, (i.e. msb to the left), and so a bit index n on the screen is bit index 32-n in a longword see also maskbits.h */ /* NOTE: the first element in starttab could be 0xffffffff. making it 0 lets us deal with a full first word in the middle loop, rather than having to do the multiple reads and masks that we'd have to do if we thought it was partial. */ int starttab[16] = { 0x0000, 0x7FFF, 0x3FFF, 0x1FFF, 0x0FFF, 0x07FF, 0x03FF, 0x01FF, 0x00FF, 0x007F, 0x003F, 0x001F, 0x000F, 0x0007, 0x0003, 0x0001 }; int endtab[16] = { 0x0000, 0x8000, 0xC000, 0xE000, 0xF000, 0xF800, 0xFC00, 0xFE00, 0xFF00, 0xFF80, 0xFFC0, 0xFFE0, 0xFFF0, 0xFFF8, 0xFFFC, 0xFFFE }; /* a hack, for now, since the entries for 0 need to be all 1 bits, not all zeros. this means the code DOES NOT WORK for segments of length 0 (which is only a problem in the horizontal line code.) */ int startpartial[16] = { 0xFFFF, 0x7FFF, 0x3FFF, 0x1FFF, 0x0FFF, 0x07FF, 0x03FF, 0x01FF, 0x00FF, 0x007F, 0x003F, 0x001F, 0x000F, 0x0007, 0x0003, 0x0001 }; int endpartial[16] = { 0xFFFF, 0x8000, 0xC000, 0xE000, 0xF000, 0xF800, 0xFC00, 0xFE00, 0xFF00, 0xFF80, 0xFFC0, 0xFFE0, 0xFFF0, 0xFFF8, 0xFFFC, 0xFFFE }; /* used for masking bits in bresenham lines mask[n] is used to mask out all but bit n in a longword (n is a screen position). rmask[n] is used to mask out the single bit at position n (n is a screen posiotion.) */ int mask[] = { 1<<15, 1<<14, 1<<13, 1<<12, 1<<11, 1<<10, 1<<9, 1<<8, 1<<7, 1<<6, 1<<5, 1<<4, 1<<3, 1<<2, 1<<1, 1<<0 }; int rmask[] = { 0xffff ^ (1<<15), 0xffff ^ (1<<14), 0xffff ^ (1<<13), 0xffff ^ (1<<12), 0xffff ^ (1<<11), 0xffff ^ (1<<10), 0xffff ^ (1<<9), 0xffff ^ (1<<8), 0xffff ^ (1<<7), 0xffff ^ (1<<6), 0xffff ^ (1<<5), 0xffff ^ (1<<4), 0xffff ^ (1<<3), 0xffff ^ (1<<2), 0xffff ^ (1<<1), 0xffff ^ (1<<0) };