Mail Archives: djgpp-workers/1997/01/17/17:06:24
remove previous patch and apply this patch again.
----------------------------------------
*** src/libc/pc_hw/co80/conio.c-orig Tue Jul 23 23:37:22 1996
--- src/libc/pc_hw/co80/conio.c Wed Jan 15 10:11:30 1997
***************
*** 16,21 ****
--- 16,23 ----
int directvideo = 1; /* We ignore this */
+ static void refreshvirtualscreen(int c, int r, int count);
+ static void mayrefreshline(int c, int r, int *srow, int *scol, int
*ecol);
static void setcursor(unsigned int shape);
static int getvideomode(void);
static void bell(void);
***************
*** 27,32 ****
--- 29,36 ----
#define DBGGTINFO 0
static unsigned ScreenAddress = 0xb8000UL; /* initialize just in case */
+ static unsigned short ScreenVirtualSegment = 0; /* 0: non DOS/V */
+ static unsigned short ScreenVirtualOffset = 0; /* !0: DOS/V virtual VRAM
address */
static struct text_info txinfo;
static int ungot_char;
static int char_avail = 0;
***************
*** 39,44 ****
--- 43,70 ----
static int conio_count = -1;
#define VIDADDR(r,c) (ScreenAddress + 2*(((r) * txinfo.screenwidth) +
(c)))
+ #define VOFFSET(r,c) (ScreenVirtualOffset + 2*(((r) * txinfo.screenwidth)
+ (c)))
+
+ static void
+ refreshvirtualscreen(int c, int r, int count)
+ {
+ __dpmi_regs regs;
+
+ regs.x.es = ScreenVirtualSegment;
+ regs.x.di = VOFFSET(r, c);
+ regs.h.ah = 0xff; /* Refresh Screen */
+ regs.x.cx = count; /* number of characters */
+ __dpmi_int(0x10, ®s);
+ }
+
+ static void
+ mayrefreshline(int c, int r, int *srow, int *scol, int *ecol)
+ {
+ if (*ecol != *scol)
+ refreshvirtualscreen(*scol, *srow, *ecol-*scol);
+ *srow = r;
+ *scol = *ecol = c;
+ }
int
puttext(int c, int r, int c2, int r2, void *buf)
***************
*** 50,55 ****
--- 76,83 ----
{
dosmemput(cbuf, (c2-c+1)*2, VIDADDR(r, c));
cbuf += c2-c+1;
+ if (ScreenVirtualSegment != 0)
+ refreshvirtualscreen(c, r, c2-c+1);
}
return 1;
}
***************
*** 256,261 ****
--- 284,291 ----
for (col = left; col <= right; col++)
filler[col-left] = fill;
dosmemput(filler, (right-left+1)*2, VIDADDR(row, left));
+ if (ScreenVirtualSegment != 0)
+ refreshvirtualscreen(left, row, right-left+1);
}
void
***************
*** 266,273 ****
for (col=0; col < txinfo.winright - txinfo.winleft + 1; col++)
filler[col] = ' ' | (ScreenAttrib << 8);
for (row=txinfo.wintop-1; row < txinfo.winbottom; row++)
! dosmemput(filler, (txinfo.winright - txinfo.winleft + 1)*2,
! VIDADDR(row, txinfo.winleft - 1));
gotoxy(1, 1);
}
--- 296,307 ----
for (col=0; col < txinfo.winright - txinfo.winleft + 1; col++)
filler[col] = ' ' | (ScreenAttrib << 8);
for (row=txinfo.wintop-1; row < txinfo.winbottom; row++)
! {
! dosmemput(filler, (txinfo.winright - txinfo.winleft + 1)*2,
! VIDADDR(row, txinfo.winleft - 1));
! if (ScreenVirtualSegment != 0)
! refreshvirtualscreen(txinfo.winleft - 1, row, txinfo.winright -
txinfo.winleft + 1);
! }
gotoxy(1, 1);
}
***************
*** 304,309 ****
--- 338,345 ----
bell();
else {
ScreenPutChar(c, ScreenAttrib, col, row);
+ if (ScreenVirtualSegment != 0)
+ refreshvirtualscreen(col, row, 1);
col++;
}
***************
*** 436,441 ****
--- 472,479 ----
movedata(_dos_ds, VIDADDR(bot-1, left),
_dos_ds, VIDADDR(bot, left),
nbytes);
+ if (ScreenVirtualSegment != 0)
+ refreshvirtualscreen(left, bot-1, nbytes/2);
bot--;
}
fillrow(row,left,right,fill);
***************
*** 457,462 ****
--- 495,502 ----
movedata(_dos_ds, VIDADDR(row+1, left),
_dos_ds, VIDADDR(row, left),
nbytes);
+ if (ScreenVirtualSegment != 0)
+ refreshvirtualscreen(left, row, nbytes/2);
row++;
}
fillrow(bot,left,right,fill);
***************
*** 485,492 ****
--- 525,539 ----
const unsigned char *ss = (const unsigned char *)s;
short *viaddr;
short sa = ScreenAttrib << 8;
+ int srow, scol, ecol;
ScreenGetCursor(&row, &col);
viaddr = (short *)VIDADDR(row,col);
+ /*
+ * DOS/V: simply it refreshes screen between scol and ecol when cursor
moving.
+ */
+ srow = row;
+ scol = ecol = col;
+
/*
* Instead of just calling putch; we do everything by hand here,
* This is much faster. We don't move the cursor after each character,
***************
*** 501,511 ****
--- 548,562 ----
{
row++;
viaddr += txinfo.screenwidth;
+ if (ScreenVirtualSegment != 0)
+ mayrefreshline(col, row, &srow, &scol, &ecol);
}
else if (c == '\r')
{
col = txinfo.winleft - 1;
viaddr = (short *)VIDADDR(row,col);
+ if (ScreenVirtualSegment != 0)
+ mayrefreshline(col, row, &srow, &scol, &ecol);
}
else if (c == '\b')
{
***************
*** 525,530 ****
--- 576,583 ----
col = txinfo.winright-1;
viaddr = (short *)VIDADDR(row,col);
}
+ if (ScreenVirtualSegment != 0)
+ mayrefreshline(col, row, &srow, &scol, &ecol);
}
else if (c == 0x07)
bell();
***************
*** 533,538 ****
--- 586,592 ----
dosmemput(&q, 2, (int)viaddr);
viaddr++;
col++;
+ ecol++;
}
/* now, readjust the window */
***************
*** 541,559 ****
--- 595,622 ----
col = txinfo.winleft - 1;
row++;
viaddr = (short *)VIDADDR(row,col);
+ if (ScreenVirtualSegment != 0)
+ mayrefreshline(col, row, &srow, &scol, &ecol);
}
if (row >= txinfo.winbottom) {
+ /* refresh before scroll */
+ if (ScreenVirtualSegment != 0)
+ mayrefreshline(col, row, &srow, &scol, &ecol);
if (_wscroll)
{
ScreenSetCursor(txinfo.wintop-1,0); /* goto first line in window */
delline(); /* and delete it */
}
row--;
+ srow--;
viaddr -= txinfo.screenwidth;
}
}
+ /* refresh the rest of cols */
+ if (ScreenVirtualSegment != 0)
+ mayrefreshline(col, row, &srow, &scol, &ecol);
ScreenSetCursor(row, col);
txinfo.cury = row - txinfo.wintop + 2;
txinfo.curx = col - txinfo.winleft + 2;
***************
*** 965,970 ****
--- 1028,1035 ----
void
gppconio_init(void)
{
+ __dpmi_regs regs;
+
/* Force initialization in restarted programs (emacs). */
if (conio_count != __bss_count)
{
***************
*** 984,989 ****
--- 1049,1063 ----
ScreenAddress = 0xb0000UL;
else
ScreenAddress = 0xb8000UL;
+
+ regs.x.es = regs.x.di = 0; /* Dummy for checking */
+ regs.h.ah = 0xfe; /* Get Video Buffer */
+ __dpmi_int(0x10, ®s);
+ ScreenVirtualSegment = regs.x.es;
+ ScreenVirtualOffset = regs.x.di;
+ if (ScreenVirtualSegment != 0)
+ ScreenAddress = (ScreenVirtualSegment << 4UL) + ScreenVirtualOffset;
+ ScreenPrimary = ScreenAddress;
#if 0
/* Why should gppconio_init() restore OLDATTRIB? I think it
----------------------------------------
Daisuke Aoyama
jack AT st DOT rim DOT or DOT jp
- Raw text -