This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.1'.
[unix-history] / sys / i386 / isa / pccons.c
index 1eb1821..6fbf1f8 100644 (file)
@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)pccons.c      5.11 (Berkeley) 5/21/91
  * SUCH DAMAGE.
  *
  *     from: @(#)pccons.c      5.11 (Berkeley) 5/21/91
- *     $Id: pccons.c,v 1.8 1993/11/17 23:25:17 wollman Exp $
+ *     $Id: pccons.c,v 1.13 1994/02/10 10:17:58 ache Exp $
  */
 
 /*
  */
 
 /*
@@ -116,7 +116,7 @@ struct      isa_driver pcdriver = {
 
 static unsigned int addr_6845 = MONO_BASE;
 u_short *Crtat = (u_short *)MONO_BUF;
 
 static unsigned int addr_6845 = MONO_BASE;
 u_short *Crtat = (u_short *)MONO_BUF;
-static openf;
+static int openf;
 
 char *sgetc(int);
 static char    *more_chars;
 
 char *sgetc(int);
 static char    *more_chars;
@@ -645,6 +645,21 @@ static char bgansitopc[] =
 {      BG_BLACK, BG_RED, BG_GREEN, BG_BROWN, BG_BLUE,
        BG_MAGENTA, BG_CYAN, BG_LIGHTGREY};
 
 {      BG_BLACK, BG_RED, BG_GREEN, BG_BROWN, BG_BLUE,
        BG_MAGENTA, BG_CYAN, BG_LIGHTGREY};
 
+static void move_up(u_short *s, u_short *d, u_int len)
+{
+       s += len;
+       d += len;
+       while (len-- > 0)
+               *--d = *--s;
+}
+
+
+static void move_down(u_short *s, u_short *d, u_int len)
+{
+       while (len-- > 0)
+               *d++ = *s++;
+}
+
 /*
  *   sput has support for emulation of the 'pc3' termcap entry.
  *   if ka, use kernel attributes.
 /*
  *   sput has support for emulation of the 'pc3' termcap entry.
  *   if ka, use kernel attributes.
@@ -707,7 +722,8 @@ sput(c,  ka)
                }
                vs.kern_bg_at = BG_BLACK;
 
                }
                vs.kern_bg_at = BG_BLACK;
 
-               fillw(((vs.bg_at|vs.fg_at)<<8)|' ', crtat, COL*ROW-cursorat);
+               fillw(((vs.bg_at|vs.fg_at)<<8)|' ', crtat,
+                     COL*ROW-cursorat);
        }
 
        /* which attributes do we use? */
        }
 
        /* which attributes do we use? */
@@ -753,7 +769,9 @@ sput(c,  ka)
                if (vs.esc) {
                        if (vs.ebrac) {
                                switch(c) {
                if (vs.esc) {
                        if (vs.ebrac) {
                                switch(c) {
-                                       int pos;
+                                       int pos, posy, count;
+                                       u_short *src, *dst;
+
                                case 'm':
                                        if (!vs.cx) vs.so = 0;
                                        else vs.so = 1;
                                case 'm':
                                        if (!vs.cx) vs.so = 0;
                                        else vs.so = 1;
@@ -851,18 +869,51 @@ sput(c,  ka)
                                        break;
                                case 'S':  /* scroll up cx lines */
                                        if (vs.cx <= 0) vs.cx = 1;
                                        break;
                                case 'S':  /* scroll up cx lines */
                                        if (vs.cx <= 0) vs.cx = 1;
+                                       posy = (crtat - Crtat) / vs.ncol;
+                                       if (vs.cx > posy)
+                                               vs.cx = posy;
                                        bcopy(Crtat+vs.ncol*vs.cx, Crtat, vs.ncol*(vs.nrow-vs.cx)*CHR);
                                        bcopy(Crtat+vs.ncol*vs.cx, Crtat, vs.ncol*(vs.nrow-vs.cx)*CHR);
-                                       fillw((at <<8)+' ', Crtat+vs.ncol*(vs.nrow-vs.cx), vs.ncol*vs.cx);
+                                       fillw((at <<8)+' ',
+                                               (Crtat + vs.ncol * (vs.nrow - vs.cx)),
+                                               vs.ncol * vs.cx);
                                        /* crtat -= vs.ncol*vs.cx;*/ /* XXX */
                                        vs.esc = 0; vs.ebrac = 0; vs.eparm = 0;
                                        break;
                                case 'T':  /* scroll down cx lines */
                                        if (vs.cx <= 0) vs.cx = 1;
                                        /* crtat -= vs.ncol*vs.cx;*/ /* XXX */
                                        vs.esc = 0; vs.ebrac = 0; vs.eparm = 0;
                                        break;
                                case 'T':  /* scroll down cx lines */
                                        if (vs.cx <= 0) vs.cx = 1;
+                                       posy = (crtat - Crtat) / vs.ncol;
+                                       if (vs.cx > vs.nrow - posy)
+                                               vs.cx = vs.nrow - posy;
                                        bcopy(Crtat, Crtat+vs.ncol*vs.cx, vs.ncol*(vs.nrow-vs.cx)*CHR);
                                        fillw((at <<8)+' ', Crtat, vs.ncol*vs.cx);
                                        /* crtat += vs.ncol*vs.cx;*/ /* XXX */
                                        vs.esc = 0; vs.ebrac = 0; vs.eparm = 0;
                                        break;
                                        bcopy(Crtat, Crtat+vs.ncol*vs.cx, vs.ncol*(vs.nrow-vs.cx)*CHR);
                                        fillw((at <<8)+' ', Crtat, vs.ncol*vs.cx);
                                        /* crtat += vs.ncol*vs.cx;*/ /* XXX */
                                        vs.esc = 0; vs.ebrac = 0; vs.eparm = 0;
                                        break;
+                               case 'L':       /* Insert cx lines */
+                                       if (vs.cx <= 0) vs.cx = 1;
+                                       posy = (crtat - Crtat) / vs.ncol;
+                                       if (vs.cx > vs.nrow - posy)
+                                               vs.cx = vs.nrow - posy;
+                                       src = Crtat + posy * vs.ncol;
+                                       dst = src + vs.cx * vs.ncol;
+                                       count = vs.nrow - (posy + vs.cx);
+                                       move_up(src, dst, count * vs.ncol);
+                                       fillw((at <<8)+' ', src, vs.cx * vs.ncol);
+                                       vs.esc = 0; vs.ebrac = 0; vs.eparm = 0;
+                                       break;
+                               case 'M':       /* Delete cx lines */
+                                       if (vs.cx <= 0) vs.cx = 1;
+                                       posy = (crtat - Crtat) / vs.ncol;
+                                       if (vs.cx > vs.nrow - posy)
+                                               vs.cx = vs.nrow - posy;
+                                       dst = Crtat + posy * vs.ncol;
+                                       src = dst + vs.cx * vs.ncol;
+                                       count = vs.nrow - (posy + vs.cx);
+                                       move_down(src, dst, count * vs.ncol);
+                                       src = dst + count * vs.ncol;
+                                       fillw((at <<8)+' ', src, vs.cx * vs.ncol);
+                                       vs.esc = 0; vs.ebrac = 0; vs.eparm = 0;
+                                       break;
                                case ';': /* Switch params in cursor def */
                                        vs.eparm = 1;
                                        break;
                                case ';': /* Switch params in cursor def */
                                        vs.eparm = 1;
                                        break;
@@ -1512,7 +1563,7 @@ loop:
         *   Check for cntl-alt-esc
         */
        if ((dt == 1) && ctrl_down && alt_down) {
         *   Check for cntl-alt-esc
         */
        if ((dt == 1) && ctrl_down && alt_down) {
-               Debugger();
+               Debugger("manual escape to debugger");
                dt |= 0x80;     /* discard esc (ddb discarded ctrl-alt) */
        }
 #endif
                dt |= 0x80;     /* discard esc (ddb discarded ctrl-alt) */
        }
 #endif
@@ -1758,20 +1809,20 @@ int pcmmap(dev_t dev, int offset, int nprot)
 static void
 pc_xmode_on (void)
 {
 static void
 pc_xmode_on (void)
 {
-       struct syscframe *fp;
+       struct trapframe *fp;
 
        if (pc_xmode)
                return;
        pc_xmode = 1;
 
 
        if (pc_xmode)
                return;
        pc_xmode = 1;
 
-       fp = (struct syscframe *)curproc->p_regs;
-       fp->sf_eflags |= PSL_IOPL;
+       fp = (struct trapframe *)curproc->p_regs;
+       fp->tf_eflags |= PSL_IOPL;
 }
 
 static void
 pc_xmode_off ()
 {
 }
 
 static void
 pc_xmode_off ()
 {
-       struct syscframe *fp;
+       struct trapframe *fp;
 
        if (pc_xmode == 0)
                return;
 
        if (pc_xmode == 0)
                return;
@@ -1779,8 +1830,8 @@ pc_xmode_off ()
 
        cursor(0, 0);
 
 
        cursor(0, 0);
 
-       fp = (struct syscframe *)curproc->p_regs;
-       fp->sf_eflags &= ~PSL_IOPL;
+       fp = (struct trapframe *)curproc->p_regs;
+       fp->tf_eflags &= ~PSL_IOPL;
 }
 #endif /* XSERVER*/
 
 }
 #endif /* XSERVER*/