home *** CD-ROM | disk | FTP | other *** search
- /* ==( dos/ds.c )== */
- /* ----------------------------------------------- */
- /* Pro-C - Copyright (C) 1988, 1989 Vestronix Inc. */
- /* Modification to this source is not supported */
- /* by Vestronix Inc. */
- /* All Rights Reserved */
- /* ----------------------------------------------- */
- /* Written Geo 26-Aug-88 */
- /* Modified Geo 2-Aug-90 See comments below */
- /* ----------------------------------------------- */
- /* %W% (%H% %T%) */
-
- /*
- * Modifications
- *
- * 2-Aug-90 Geo - Bios speedup on repeated chars
- * 1-Nov-89 Geo - Clear to end of line speedup on blank lines
- * 25-Dec-89 Geo - 1.32 Merge
- * 18-Jan-90 Geo - Add mouse cursor
- *
- */
-
- # include <stdio.h>
- # include <bench.h>
-
- # include "pregs.h"
-
- /* Enable next define to eanble bios calls */
- /* # define USEBIOS */
-
- extern char rowbuf[], newbuf[];
-
- /*
- * Blast form of subpoke
- * Okay so why use a C version instead of asm ds
- * easier to maintain, asm version was hardcoded
- * for 80 cols, and fixed model size, no debug
- * now we have the switched version (bios | direct)
- */
- void subpokel(row, col, len)
- int row, col, len;
- {
- char *nptr = newbuf, *optr = rowbuf;
-
- # ifndef USEBIOS
- extern char far *videoscreen;
- short far *screen;
-
- row *= w_ncols<<1; /* 160 */
- screen = (short far *)(videoscreen + row + (col<<1));
- # endif
-
- # ifdef MOUSE
- mouse_cursor(OFF);
- # endif
-
- /* Now output differences */
- while (len--)
- {
- # ifdef USEBIOS
- int cnt = 1;
- # endif
-
- /*
- * Optimising screen refresh by minimising n+1
- * window refresh states
- * Easiest way is to compare directly
- * Char value changes faster than the attribute
- */
- /* if (*nptr != *optr || *(nptr+1) != *(optr+1)) */
- if (*(short *)nptr != *(short *)optr)
- {
- unsigned char ch = *nptr;
- unsigned char attr = *(nptr + 1);
-
- /* Convert logical boxes to physical */
- if (attr & GRAPHIC)
- {
- extern char boxes[][BOXCHCNT];
-
- /* ch = boxes[ch / BOXCHCNT][(ch - 1) % BOXCHCNT]; */
- ch = *(boxes[0] + ch - 1);
- }
-
- # ifdef USEBIOS
- { /* Start local block */
-
- extern char _page;
- RegStorage;
-
- /*
- * Take advantage of repeat parameter on
- * bios video call - really speeds up display
- */
- /* Loop looking for repeated chars */
- for ( ; cnt <= len; cnt++)
- {
- /* want a match with current target and repeated */
- if (*(short *)nptr != *(short *)(nptr+(cnt<<1)) ||
- *(short *)nptr == *(short *)(optr+(cnt<<1)))
- break;
- }
-
- /* Faster moveto(row, col); */
- Regs_bh = _page;
- Regs_dh = row;
- Regs_dl = col;
- Regs_ah = 0x02;
- Video();
-
- /* Place character */
- Regs_bl = colour[attr & 15];
- Regs_bh = _page;
- Regs_cx = cnt;
- Regs_al = ch;
- Regs_ah = 0x09;
- Video();
-
- if (cnt > 1)
- {
- /* Adjust counts */
- len -= cnt - 1;
- nptr += (cnt-1)<<1;
- optr += (cnt-1)<<1;
- }
-
- } /* End local block */
- # else
- {
- /* will need get term to calculate base address + PAGE stuff */
-
- *screen = ch + (colour[attr & 15]<<8);
- }
- # endif
- }
-
- # ifdef USEBIOS
- col += cnt;
- # else
- screen++;
- # endif
- optr += 2;
- nptr += 2;
- }
-
- # ifdef MOUSE
- mouse_cursor(ON);
- # endif
- }
-
-