aboutsummaryrefslogtreecommitdiffstats
path: root/src/crt.c
blob: 8b7f9d58ee961c812dd7e0c234fe1b6000b4a075 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * crt.c:
 *
 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
 * All rights reserved.
 *
 */

static char rcsid[] = "$Id$";

/*
 * $Log$
 * Revision 1.2  2008/02/04 02:05:06  james
 * *** empty log message ***
 *
 * Revision 1.1  2008/02/03 23:31:25  james
 * *** empty log message ***
 *
 */

#include "project.h"

void
crt_cls (CRT * c)
{
  int i;

  for (i = 0; i < CRT_CELS; ++i)
    {
      c->screen[i].chr = ' ';
      c->screen[i].chr = CRT_ATTR_NORMAL;
    }
}

void
crt_reset (CRT * c)
{
  crt_cls (c);

  c->pos.x = 0;
  c->pos.y = 0;
  c->hide_cursor = 1;
}

void
crt_insert (CRT * c, CRT_CA ca)
{
  if (c->pos.x < 0)
    c->pos.x = 0;
  if (c->pos.x >= CRT_COLS)
    c->pos.x = CRT_COLS - 1;
  if (c->pos.y < 0)
    c->pos.y = 0;
  if (c->pos.y >= CRT_ROWS)
    c->pos.y = CRT_ROWS - 1;

  c->screen[CRT_ADDR (c->pos.y, c->pos.x)] = ca;



}