X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcrt.c;h=b5b91a807d2469b3d7a2c3f268b9a8a53df1751d;hb=refs%2Fheads%2Fmaster;hp=67d883555a8bc3741abfcc5dedb14fdf4dfd7972;hpb=9e84f0195255337d98bf9615e6b589448cd9b907;p=sympathy.git diff --git a/src/crt.c b/src/crt.c index 67d8835..b5b91a8 100644 --- a/src/crt.c +++ b/src/crt.c @@ -1,15 +1,45 @@ -/* +/* * crt.c: * - * Copyright (c) 2008 James McKenzie , + * Copyright (c) 2008 James McKenzie , * 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 *** + * + * Revision 1.12 2008/02/26 23:23:17 james + * *** empty log message *** + * + * Revision 1.11 2008/02/23 11:48:37 james + * *** empty log message *** + * + * Revision 1.10 2008/02/22 17:07:00 james + * *** empty log message *** + * + * 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 *** * @@ -39,20 +69,19 @@ 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, 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 = CRT_COLOR_NORMAL; - } - ps++; + while (ps <= pe) { + ps->chr = ' '; + if (ea) { + ps->attr = CRT_ATTR_NORMAL; + ps->color = color; } + ps++; + } } @@ -63,12 +92,14 @@ crt_cls (CRT * c) CRT_Pos e = { CRT_COLS - 1, CRT_ROWS - 1 }; int i; - crt_erase (c, s, e, 1); - c->sh.dir=0; + crt_erase (c, s, e, 1, CRT_COLOR_NORMAL); +#if 0 + c->sh.dir = 0; +#endif } 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 color) { int l, n; int p; @@ -77,9 +108,11 @@ crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e, int ea) s.x = 0; e.x = CRT_COLS - 1; - c->sh.s=s; - c->sh.e=e; - c->sh.dir=-1; +#if 0 + c->sh.s = s; + c->sh.e = e; + c->sh.dir = -1; +#endif l = e.x - s.x; l++; @@ -90,19 +123,18 @@ crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e, int ea) 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); + crt_erase (c, s, e, ea, color); } 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 color) { int l, n; int p; @@ -110,27 +142,28 @@ crt_scroll_down (CRT * c, CRT_Pos s, CRT_Pos e, int ea) s.x = 0; e.x = CRT_COLS - 1; - c->sh.s=s; - c->sh.e=e; - c->sh.dir=1; +#if 0 + c->sh.s = s; + c->sh.e = e; + c->sh.dir = 1; +#endif l = e.x - s.x; l++; 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); + crt_erase (c, s, e, ea, color); } @@ -142,7 +175,11 @@ crt_reset (CRT * c) c->pos.x = 0; c->pos.y = 0; c->hide_cursor = 1; - c->sh.dir=0; + c->size.x = CRT_COLS; + c->size.y = CRT_ROWS; +#if 0 + c->sh.dir = 0; +#endif } void @@ -159,5 +196,7 @@ crt_insert (CRT * c, CRT_CA ca) c->screen[CRT_ADDR (c->pos.y, c->pos.x)] = ca; - c->sh.dir=0; +#if 0 + c->sh.dir = 0; +#endif }