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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [peripheral/] [fb.c] - Diff between revs 1469 and 1484

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

Rev 1469 Rev 1484
Line 184... Line 184...
  /* Data is stored upside down */
  /* Data is stored upside down */
  for (y = sy - 1; y >= 0; y--) {
  for (y = sy - 1; y >= 0; y--) {
    int align = (4 - sx) % 4;
    int align = (4 - sx) % 4;
    int zero = CNV32(0);
    int zero = CNV32(0);
    int add;
    int add;
 
    int breakpoint;
    while (align < 0) align += 4;
    while (align < 0) align += 4;
    for (x = 0; x < sx; x++) {
    for (x = 0; x < sx; x++) {
      add = (fb->addr & ~(FB_WRAP - 1)) | ((fb->addr + y * sx + x) & (FB_WRAP - 1));
      add = (fb->addr & ~(FB_WRAP - 1)) | ((fb->addr + y * sx + x) & (FB_WRAP - 1));
      fputc (evalsim_mem8 (add), fo);
      fputc (eval_direct8 (add, &breakpoint, 0, 0), fo);
    }
    }
    if (align && !fwrite (&zero, align, 1, fo)) return 1;
    if (align && !fwrite (&zero, align, 1, fo)) return 1;
  }
  }
 
 
  if (config.sim.verbose) PRINTF ("DONE\n");
  if (config.sim.verbose) PRINTF ("DONE\n");
Line 208... Line 209...
  FILE *fo;
  FILE *fo;
 
 
  unsigned short int u16;
  unsigned short int u16;
  unsigned long int u32;
  unsigned long int u32;
 
 
 
  int breakpoint;
 
 
  if (config.sim.verbose) PRINTF ("Creating %s...", filename);
  if (config.sim.verbose) PRINTF ("Creating %s...", filename);
  fo = fopen (filename, "wb+");
  fo = fopen (filename, "wb+");
  u16 = CNV16(19778); /* BM */
  u16 = CNV16(19778); /* BM */
  if (!fwrite (&u16, 2, 1, fo)) return 1;
  if (!fwrite (&u16, 2, 1, fo)) return 1;
  u32 = CNV32(14 + 40 + sx * sy * 3); /* size */
  u32 = CNV32(14 + 40 + sx * sy * 3); /* size */
Line 249... Line 252...
  for (y = sy - 1; y >= 0; y--) {
  for (y = sy - 1; y >= 0; y--) {
    unsigned char line[FB_SIZEX][3];
    unsigned char line[FB_SIZEX][3];
    for (x = 0; x < sx; x++)
    for (x = 0; x < sx; x++)
      if (y >= fb->cameray && x >= fb->camerax && y < fb->cameray + CAM_SIZEY && x < fb->camerax + CAM_SIZEX) {
      if (y >= fb->cameray && x >= fb->camerax && y < fb->cameray + CAM_SIZEY && x < fb->camerax + CAM_SIZEX) {
        int add = (fb->cam_addr + (x - fb->camerax + (y - fb->cameray) * CAM_SIZEX) * 2) ^ 2;
        int add = (fb->cam_addr + (x - fb->camerax + (y - fb->cameray) * CAM_SIZEX) * 2) ^ 2;
        unsigned short d = evalsim_mem16 (add);
        unsigned short d = eval_direct16 (add, &breakpoint, 0, 0);
        line[x][0] = ((d >> 0) & 0x1f) << 3;  /* Blue */
        line[x][0] = ((d >> 0) & 0x1f) << 3;  /* Blue */
        line[x][1] = ((d >> 5) & 0x3f) << 2;  /* Green */
        line[x][1] = ((d >> 5) & 0x3f) << 2;  /* Green */
        line[x][2] = ((d >> 11) & 0x1f) << 3; /* Red */
        line[x][2] = ((d >> 11) & 0x1f) << 3; /* Red */
      } else {
      } else {
        int add = (fb->addr & ~(FB_WRAP - 1)) | ((fb->addr + y * sx + x) & (FB_WRAP - 1));
        int add = (fb->addr & ~(FB_WRAP - 1)) | ((fb->addr + y * sx + x) & (FB_WRAP - 1));
        unsigned short d = fb->pal[evalsim_mem8 (add)];
        unsigned short d = fb->pal[eval_direct8 (add, &breakpoint, 0, 0)];
        line[x][0] = ((d >> 0) & 0x1f) << 3;  /* Blue */
        line[x][0] = ((d >> 0) & 0x1f) << 3;  /* Blue */
        line[x][1] = ((d >> 5) & 0x3f) << 2;  /* Green */
        line[x][1] = ((d >> 5) & 0x3f) << 2;  /* Green */
        line[x][2] = ((d >> 11) & 0x1f) << 3; /* Red */
        line[x][2] = ((d >> 11) & 0x1f) << 3; /* Red */
      }
      }
    if(!fwrite (line, sizeof(line), 1, fo)) return 1;
    if(!fwrite (line, sizeof(line), 1, fo)) return 1;

powered by: WebSVN 2.1.0

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