OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [common/] [screen.c] - Diff between revs 175 and 406

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 175 Rev 406
Line 9... Line 9...
int cy = 0;
int cy = 0;
 
 
extern unsigned char font[256][12];
extern unsigned char font[256][12];
static char screen[CHARSY][CHARSX];
static char screen[CHARSY][CHARSX];
 
 
void put_char_xy (int x, int y, char c) {
void put_char_xy(int x, int y, char c)
 
{
  int i, j;
  int i, j;
  screen[y][x] = c;
  screen[y][x] = c;
  x *= CHAR_WIDTH;
  x *= CHAR_WIDTH;
  y *= CHAR_HEIGHT;
  y *= CHAR_HEIGHT;
  for (i = 0; i < CHAR_HEIGHT; i++) {
  for (i = 0; i < CHAR_HEIGHT; i++) {
Line 23... Line 24...
      t >>= 1;
      t >>= 1;
    }
    }
  }
  }
}
}
 
 
static void scroll (void) {
static void scroll(void)
 
{
  int x,y;
  int x,y;
#if 1
#if 1
  for (y = 1; y < CHARSY; y++)
  for (y = 1; y < CHARSY; y++)
    for (x = 0; x < CHARSX; x++)
    for (x = 0; x < CHARSX; x++)
      put_char_xy (x, y-1, screen[y][x]);
      put_char_xy (x, y-1, screen[y][x]);
#else
#else
  memcpy ( (unsigned char *)FB_BASE_ADDR, ((unsigned char *)FB_BASE_ADDR) + RESX * CHAR_HEIGHT,  (RESY - CHAR_HEIGHT) * RESX);
        memcpy((unsigned char *)FB_BASE_ADDR,
 
               ((unsigned char *)FB_BASE_ADDR) + RESX * CHAR_HEIGHT,
 
               (RESY - CHAR_HEIGHT) * RESX);
  memcpy (&screen[0][0], &screen[1][0], (CHARSY - 1) * CHARSX);
  memcpy (&screen[0][0], &screen[1][0], (CHARSY - 1) * CHARSX);
#endif
#endif
  for (x = 0; x < CHARSX; x++)
  for (x = 0; x < CHARSX; x++)
    put_char_xy (x, CHARSY-1, ' ');
    put_char_xy (x, CHARSY-1, ' ');
  cy--;
  cy--;
}
}
 
 
void screen_putc (char c) {
void screen_putc(char c)
 
{
  int t;
  int t;
  switch (c) {
  switch (c) {
  case '\n':
  case '\n':
    cy++;
    cy++;
    cx = 0;
    cx = 0;
Line 55... Line 60...
  case '\t':
  case '\t':
    for (t = 0; t < 8 - (cx & 7); t++)
    for (t = 0; t < 8 - (cx & 7); t++)
      screen_putc (' ');
      screen_putc (' ');
    break;
    break;
  case '\b':
  case '\b':
    if (cx > 0) cx--;
                if (cx > 0)
 
                        cx--;
    put_char_xy(cx, cy, ' ');
    put_char_xy(cx, cy, ' ');
    break;
    break;
  default:
  default:
    put_char_xy(cx, cy, c);
    put_char_xy(cx, cy, c);
    cx++;
    cx++;
    if(cx >= CHARSX) screen_putc ('\n');
                if (cx >= CHARSX)
 
                        screen_putc('\n');
    break;
    break;
  }
  }
}
}
 
 
void screen_clear () {
void screen_clear()
 
{
  memset ((unsigned char *)FB_BASE_ADDR, bg_color, RESX * RESY);
  memset ((unsigned char *)FB_BASE_ADDR, bg_color, RESX * RESY);
  memset (&screen[0][0], ' ', CHARSX * CHARSY);
  memset (&screen[0][0], ' ', CHARSX * CHARSY);
  cx = cy = 0;
  cx = cy = 0;
}
}
 
 
void screen_puts (char *s) {
void screen_puts(char *s)
 
{
  while (*s) {
  while (*s) {
    screen_putc (*s);
    screen_putc (*s);
    s++;
    s++;
  }
  }
}
}
 
 
void screen_init () {
void screen_init()
 
{
  screen_clear ();
  screen_clear ();
  SET_PALLETE(COLOR_BLACK, 0, 0, 0);
  SET_PALLETE(COLOR_BLACK, 0, 0, 0);
  SET_PALLETE(COLOR_WHITE, 127, 127, 127);
  SET_PALLETE(COLOR_WHITE, 127, 127, 127);
 
 
  /* Set screen offset */
  /* Set screen offset */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.