X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcrt.c;h=a9e6e8637655fb0c273ce55ef8f3538fcd29c200;hb=f0f3e6b9c3668694e22ad99ac1fe841c686cf351;hp=7b8e7ddfbad2dcc7fa18cc685e6513ce696b3bf2;hpb=8158d3e1b5d1d977bc1a91e0bb7fc6c892f9685c;p=sympathy.git diff --git a/src/crt.c b/src/crt.c index 7b8e7dd..a9e6e86 100644 --- a/src/crt.c +++ b/src/crt.c @@ -10,6 +10,21 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.9 2008/02/07 13:22:51 james + * *** empty log message *** + * + * Revision 1.8 2008/02/07 13:19:48 james + * *** empty log message *** + * + * Revision 1.7 2008/02/07 12:41:06 james + * *** empty log message *** + * + * Revision 1.6 2008/02/07 12:16:04 james + * *** empty log message *** + * + * Revision 1.5 2008/02/06 11:30:37 james + * *** empty log message *** + * * Revision 1.4 2008/02/05 01:11:46 james * *** empty log message *** * @@ -27,7 +42,7 @@ static char rcsid[] = "$Id$"; #include "project.h" void -crt_erase (CRT * c, CRT_Pos s, CRT_Pos e,int ea) +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)]; @@ -36,7 +51,10 @@ crt_erase (CRT * c, CRT_Pos s, CRT_Pos e,int ea) { ps->chr = ' '; if (ea) - ps->attr = CRT_ATTR_NORMAL; + { + ps->attr = CRT_ATTR_NORMAL; + ps->color = CRT_COLOR_NORMAL; + } ps++; } @@ -49,26 +67,23 @@ crt_cls (CRT * c) CRT_Pos e = { CRT_COLS - 1, CRT_ROWS - 1 }; int 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 - + crt_erase (c, s, e, 1); + c->sh.dir = 0; } void -crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e,int ea) +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; + + s.x = 0; + e.x = CRT_COLS - 1; + + c->sh.s = s; + c->sh.e = e; + c->sh.dir = -1; l = e.x - s.x; l++; @@ -76,6 +91,7 @@ crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e,int ea) n = e.y - s.y; + p = CRT_ADDR_POS (&s); while (n--) @@ -85,18 +101,22 @@ crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e,int ea) } s.y = e.y; - crt_erase (c, s, e,ea); + crt_erase (c, s, e, ea); } void -crt_scroll_down (CRT * c, CRT_Pos s, CRT_Pos e,int ea) +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; + s.x = 0; + e.x = CRT_COLS - 1; + + c->sh.s = s; + c->sh.e = e; + c->sh.dir = 1; l = e.x - s.x; l++; @@ -109,12 +129,12 @@ crt_scroll_down (CRT * c, CRT_Pos s, CRT_Pos e,int ea) while (n--) { - memcpy (&c->screen[p],&c->screen[p-CRT_COLS], l); + memcpy (&c->screen[p], &c->screen[p - CRT_COLS], l); p -= CRT_COLS; } e.y = s.y; - crt_erase (c, s, e,ea); + crt_erase (c, s, e, ea); } @@ -126,6 +146,7 @@ crt_reset (CRT * c) c->pos.x = 0; c->pos.y = 0; c->hide_cursor = 1; + c->sh.dir = 0; } void @@ -142,6 +163,5 @@ crt_insert (CRT * c, CRT_CA ca) c->screen[CRT_ADDR (c->pos.y, c->pos.x)] = ca; - - + c->sh.dir = 0; }