4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.5 2008/02/06 11:30:37 james
14 * *** empty log message ***
16 * Revision 1.4 2008/02/05 01:11:46 james
17 * *** empty log message ***
19 * Revision 1.3 2008/02/04 20:23:55 james
20 * *** empty log message ***
22 * Revision 1.2 2008/02/04 02:05:06 james
23 * *** empty log message ***
25 * Revision 1.1 2008/02/03 23:31:25 james
26 * *** empty log message ***
33 crt_erase (CRT * c, CRT_Pos s, CRT_Pos e, int ea)
35 CRT_CA *ps = &c->screen[CRT_ADDR_POS (&s)];
36 CRT_CA *pe = &c->screen[CRT_ADDR_POS (&e)];
42 ps->attr = CRT_ATTR_NORMAL;
52 CRT_Pos e = { CRT_COLS - 1, CRT_ROWS - 1 };
55 crt_erase (c, s, e, 1);
58 for (i = 0; i < CRT_ROWS; ++i)
60 c->screen[CRT_ADDR (i, i)].chr = '@' + i;
61 c->screen[CRT_ADDR (i, i)].attr = CRT_ATTR_NORMAL;
68 crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e, int ea)
82 p = CRT_ADDR_POS (&s);
86 memcpy (&c->screen[p], &c->screen[p + CRT_COLS], l);
91 crt_erase (c, s, e, ea);
96 crt_scroll_down (CRT * c, CRT_Pos s, CRT_Pos e, int ea)
106 l *= sizeof (CRT_CA);
111 p = CRT_ADDR_POS (&e);
115 memcpy (&c->screen[p], &c->screen[p - CRT_COLS], l);
120 crt_erase (c, s, e, ea);
135 crt_insert (CRT * c, CRT_CA ca)
139 if (c->pos.x >= CRT_COLS)
140 c->pos.x = CRT_COLS - 1;
143 if (c->pos.y >= CRT_ROWS)
144 c->pos.y = CRT_ROWS - 1;
146 c->screen[CRT_ADDR (c->pos.y, c->pos.x)] = ca;