chiark / gitweb /
serialmgr: Copy from woking.cam.xci-test.com
[sympathy.git] / src / crt.c
index b9174f9cdb7f5093e01749796d671b4d3e170fe6..b5b91a807d2469b3d7a2c3f268b9a8a53df1751d 100644 (file)
--- a/src/crt.c
+++ b/src/crt.c
@@ -1,15 +1,30 @@
-/*
+/* 
  * crt.c:
  *
- * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
+ * Copyright (c) 2008 James McKenzie <sympathy@madingley.org>,
  * All rights reserved.
  *
  */
 
-static char rcsid[] = "$Id$";
+static char rcsid[] = "$Id: crt.c,v 1.18 2008/03/07 12:37:04 james Exp $";
 
-/*
- * $Log$
+/* 
+ * $Log: crt.c,v $
+ * Revision 1.18  2008/03/07 12:37:04  james
+ * *** empty log message ***
+ *
+ * Revision 1.17  2008/03/03 06:04:42  james
+ * *** empty log message ***
+ *
+ * Revision 1.16  2008/03/02 10:37:56  james
+ * *** empty log message ***
+ *
+ * Revision 1.15  2008/02/27 09:42:21  james
+ * *** empty log message ***
+ *
+ * Revision 1.14  2008/02/27 00:27:21  james
+ * *** empty log message ***
+ *
  * Revision 1.13  2008/02/26 23:56:12  james
  * *** empty log message ***
  *
@@ -59,16 +74,14 @@ crt_erase (CRT * c, CRT_Pos s, CRT_Pos e, int ea, int color)
   CRT_CA *ps = &c->screen[CRT_ADDR_POS (&s)];
   CRT_CA *pe = &c->screen[CRT_ADDR_POS (&e)];
 
-  while (ps <= pe)
-    {
-      ps->chr = ' ';
-      if (ea)
-        {
-          ps->attr = CRT_ATTR_NORMAL;
-          ps->color = color;
-        }
-      ps++;
+  while (ps <= pe) {
+    ps->chr = ' ';
+    if (ea) {
+      ps->attr = CRT_ATTR_NORMAL;
+      ps->color = color;
     }
+    ps++;
+  }
 
 }
 
@@ -110,11 +123,10 @@ crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e, int ea, int color)
 
   p = CRT_ADDR_POS (&s);
 
-  while (n--)
-    {
-      memcpy (&c->screen[p], &c->screen[p + CRT_COLS], l);
-      p += CRT_COLS;
-    }
+  while (n--) {
+    memcpy (&c->screen[p], &c->screen[p + CRT_COLS], l);
+    p += CRT_COLS;
+  }
 
   s.y = e.y;
   crt_erase (c, s, e, ea, color);
@@ -141,15 +153,14 @@ crt_scroll_down (CRT * c, CRT_Pos s, CRT_Pos e, int ea, int color)
   l *= sizeof (CRT_CA);
 
   n = e.y - s.y;
-  n++;
+  // n++;
 
   p = CRT_ADDR_POS (&e);
 
-  while (n--)
-    {
-      memcpy (&c->screen[p], &c->screen[p - CRT_COLS], l);
-      p -= CRT_COLS;
-    }
+  while (n--) {
+    p -= CRT_COLS;
+    memcpy (&c->screen[p], &c->screen[p - CRT_COLS], l);
+  }
 
   e.y = s.y;
   crt_erase (c, s, e, ea, color);
@@ -164,7 +175,8 @@ crt_reset (CRT * c)
   c->pos.x = 0;
   c->pos.y = 0;
   c->hide_cursor = 1;
-  c->width = CRT_COLS;
+  c->size.x = CRT_COLS;
+  c->size.y = CRT_ROWS;
 #if 0
   c->sh.dir = 0;
 #endif