home *** CD-ROM | disk | FTP | other *** search
- /**
- ** PSCHAR.C
- **
- ** Copyright (C) 1992, Csaba Biegl
- ** 820 Stirrup Dr, Nashville, TN, 37221
- ** csaba@vuse.vanderbilt.edu
- **
- ** This file is distributed under the terms listed in the document
- ** "copying.cb", available from the author at the address above.
- ** A copy of "copying.cb" should accompany this file; if not, a copy
- ** should be available from where this file was obtained. This file
- ** may not be distributed without a verbatim copy of "copying.cb".
- ** You should also have received a copy of the GNU General Public
- ** License along with this program (it is in the file "copying");
- ** if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
- ** Cambridge, MA 02139, USA.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **/
-
- #include "p8514a.h"
-
- static int bg_mixtable[] = {
- BSS_BKGDCOL | MIX_SRC, /* C_SET */
- BSS_BKGDCOL | MIX_XOR, /* C_XOR */
- BSS_BKGDCOL | MIX_OR, /* C_OR */
- BSS_BKGDCOL | MIX_AND /* C_AND */
- };
-
- void _GrPSDrawChar(long a,int w,int h,char far *bpt,int fg,int bg)
- {
- if((w <= 0) || (h <= 0)) return;
- if(CURC->gc_onscreen) {
- int fgop = C_OPER(fg);
- int bgop = C_OPER(bg);
- int xpos = COORD_X(a);
- int ypos = COORD_Y(a);
- int words = (w + 15) >> 4;
- int fontw = (w + 7) >> 3;
-
- if(((_GrPIDrawTable[fgop] ^ (fg &= C_SIGNIF)) |
- (_GrPIDrawTable[bgop] ^ (bg &= C_SIGNIF))) == 0) return;
- WaitQueue(5);
- outpw(MAJ_AXIS_PCNT,(w - 1));
- outpw(MULTIFUNC_CNTL,(MIN_AXIS_PCNT | (h - 1)));
- outpw(MULTIFUNC_CNTL,(PIX_CNTL | MIXSEL_EXPPC));
- outpw(FRGD_MIX,_GrPIMixTable[fgop]);
- outpw(BKGD_MIX,bg_mixtable[bgop]);
- WaitQueue(5);
- outpw(FRGD_COLOR,fg);
- outpw(BKGD_COLOR,bg);
- outpw(CUR_X,xpos);
- outpw(CUR_Y,ypos);
- outpw(CMD,(CMD_RECT | INC_X | INC_Y | PCDATA | _16BIT | BYTSEQ | DRAW | PLANAR | WRTDATA));
- WaitQueue(8);
- #ifdef __TURBOC__
- #define _HAVE_INLINE_
- asm .286
- asm cld;
- asm push ds;
- asm lds si,DWORD PTR bpt;
- asm mov dx,PIX_TRANS;
- VertLoop:
- asm push si;
- asm mov cx,WORD PTR words;
- asm rep outsw;
- asm pop si;
- asm add si,WORD PTR fontw;
- asm dec WORD PTR h;
- asm jne VertLoop;
- asm pop ds;
- #endif
- #ifdef __GNUC__
- #define _HAVE_INLINE_
- asm volatile(" \n\
- cld \n\
- movl %0,%%edi /* address */ \n\
- movl %1,%%edx /* PIXEL TRANSFER reg */ \n\
- movl %3,%%ebx /* font pattern wdt (bytes) */ \n\
- movl %4,%%eax /* height */ \n\
- L_VertLoop: \n\
- movl %2,%%ecx /* words to transfer */ \n\
- movl %%edi,%%esi \n\
- addl %%ebx,%%edi \n\
- rep \n\
- outsw \n\
- decl %%eax \n\
- jne L_VertLoop "
- : /* nothong */
- : "g" (bpt), "g" (PIX_TRANS),
- "g" (words), "g" (fontw), "g" (h)
- : "di", "si", "dx", "cx", "bx", "ax"
- );
- #endif
- #ifndef _HAVE_INLINE_
- while(--h >= 0) {
- unsigned short far *fbits;
- int count;
- fbits = (unsigned short far *)bpt;
- count = bytes;
- while(--count >= 0) outpw(PIX_TRANS,*fbits++);
- bpt += fontw;
- }
- #endif
- WaitQueue(1);
- outpw(MULTIFUNC_CNTL,(PIX_CNTL | 0));
- return;
- }
- _GrP8DrawChar(a,w,h,bpt,fg,bg);
- }
-