aboutsummaryrefslogtreecommitdiffstats
path: root/src/crt.c
diff options
context:
space:
mode:
authorjames <>2008-02-04 20:23:55 +0000
committerjames <>2008-02-04 20:23:55 +0000
commit28a52b2df7761bd97d74938d582b1f678d23c756 (patch)
tree731cb3fc7bfe081dd49264142def881b0adf2776 /src/crt.c
parenta1b65048ff1a96b50d30d327c969e10b77856499 (diff)
downloadsympathy-28a52b2df7761bd97d74938d582b1f678d23c756.tar.gz
sympathy-28a52b2df7761bd97d74938d582b1f678d23c756.tar.bz2
sympathy-28a52b2df7761bd97d74938d582b1f678d23c756.zip
*** empty log message ***
Diffstat (limited to 'src/crt.c')
-rw-r--r--src/crt.c88
1 files changed, 85 insertions, 3 deletions
diff --git a/src/crt.c b/src/crt.c
index 8b7f9d5..36011a9 100644
--- a/src/crt.c
+++ b/src/crt.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.3 2008/02/04 20:23:55 james
+ * *** empty log message ***
+ *
* Revision 1.2 2008/02/04 02:05:06 james
* *** empty log message ***
*
@@ -21,15 +24,94 @@ static char rcsid[] = "$Id$";
#include "project.h"
void
+crt_erase (CRT * c, CRT_Pos s, CRT_Pos e,int ea)
+{
+ 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++;
+ }
+
+}
+
+void
crt_cls (CRT * c)
{
+ CRT_Pos s = { 0, 0 };
+ CRT_Pos e = { CRT_COLS - 1, CRT_ROWS - 1 };
int i;
- for (i = 0; i < CRT_CELS; ++i)
+ crt_erase (c, s, e,1);
+
+#if 0
+ for (i = 0; i < CRT_ROWS; ++i)
+ {
+ c->screen[CRT_ADDR (i, i)].chr = '@' + i;
+ c->screen[CRT_ADDR (i, i)].attr = CRT_ATTR_NORMAL;
+ }
+#endif
+
+}
+
+void
+crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e,int ea)
+{
+ int l, n;
+ int p;
+
+ s.x=0;
+ e.x=CRT_COLS-1;
+
+ l = e.x - s.x;
+ l++;
+ l *= sizeof (CRT_CA);
+
+ n = e.y - s.y;
+
+ p = CRT_ADDR_POS (&s);
+
+ while (n--)
{
- c->screen[i].chr = ' ';
- c->screen[i].chr = CRT_ATTR_NORMAL;
+ memcpy (&c->screen[p], &c->screen[p + CRT_COLS], l);
+ p += CRT_COLS;
}
+
+ s.y = e.y;
+ crt_erase (c, s, e,ea);
+
+}
+
+void
+crt_scroll_down (CRT * c, CRT_Pos s, CRT_Pos e,int ea)
+{
+ int l, n;
+ int p;
+
+ s.x=0;
+ e.x=CRT_COLS-1;
+
+ l = e.x - s.x;
+ l++;
+ l *= sizeof (CRT_CA);
+
+ n = e.y - s.y;
+
+ p = CRT_ADDR_POS (&e);
+
+ while (n--)
+ {
+ memcpy (&c->screen[p], &c->screen[p + CRT_COLS], l);
+ p -= CRT_COLS;
+ }
+
+ e.y = s.y;
+ crt_erase (c, s, e,ea);
+
}
void