Subversion Repositories pentevo

Rev

Rev 796 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed | ?url?

  1. #include "std.h"
  2.  
  3. #include "emul.h"
  4. #include "vars.h"
  5. #include "draw.h"
  6. #include "drawnomc.h"
  7.  
  8. static void draw_alco_384()
  9. {
  10.    unsigned ofs = unsigned(comp.p7FFD & 8) << 12;
  11.    unsigned char *dst = rbuf;
  12.    for (unsigned y = 0; y < temp.scy; y++) {
  13.       for (unsigned x = 0; x < 6; x++) {
  14.  
  15.          unsigned char *data = t.alco[y][x].s+ofs, *attr = t.alco[y][x].a+ofs;
  16.          unsigned d = *(unsigned*)data, a = *(unsigned*)attr;
  17.          *(unsigned*)dst = (d & 0xFF) + colortab_s8[a & 0xFF] +
  18.                            ((d << 8) & 0xFF0000) + colortab_s24[(a >> 8) & 0xFF];
  19.          *(unsigned*)(dst+4) = ((d >> 16) & 0xFF) + colortab_s8[(a >> 16) & 0xFF] +
  20.                                ((d >> 8) & 0xFF0000) + colortab_s24[(a >> 24) & 0xFF];
  21.          d = *(unsigned*)(data + 4); a = *(unsigned*)(attr + 4);
  22.          *(unsigned*)(dst+8) = (d & 0xFF) + colortab_s8[a & 0xFF] +
  23.                                ((d << 8) & 0xFF0000) + colortab_s24[(a >> 8) & 0xFF];
  24.          *(unsigned*)(dst+12)= ((d >> 16) & 0xFF) + colortab_s8[(a >> 16) & 0xFF] +
  25.                                ((d >> 8) & 0xFF0000) + colortab_s24[(a >> 24) & 0xFF];
  26.          dst += 16;
  27.       }
  28.    }
  29. }
  30.  
  31. static void draw_alco_320()
  32. {
  33.    unsigned ofs = unsigned(comp.p7FFD & 8) << 12;
  34.    unsigned char *dst = rbuf;
  35.    unsigned base = (304-temp.scy)/2;
  36.    for (unsigned y = 0; y < temp.scy; y++) {
  37.  
  38.       unsigned char *data = t.alco[base+y][0].s+ofs+4, *attr = t.alco[base+y][0].a+ofs+4;
  39.       unsigned d = *(unsigned*)data, a = *(unsigned*)attr;
  40.       *(unsigned*)dst = (d & 0xFF) + colortab_s8[a & 0xFF] +
  41.                         ((d << 8) & 0xFF0000) + colortab_s24[(a >> 8) & 0xFF];
  42.       *(unsigned*)(dst+4) = ((d >> 16) & 0xFF) + colortab_s8[(a >> 16) & 0xFF] +
  43.                             ((d >> 8) & 0xFF0000) + colortab_s24[(a >> 24) & 0xFF];
  44.       dst += 8;
  45.  
  46.       for (unsigned x = 1; x < 5; x++) {
  47.           data = t.alco[base + y][x].s + ofs;
  48.           attr = t.alco[base + y][x].a + ofs;
  49.          d = *(unsigned*)data;
  50.          a = *(unsigned*)attr;
  51.          *(unsigned*)dst = (d & 0xFF) + colortab_s8[a & 0xFF] +
  52.                            ((d << 8) & 0xFF0000) + colortab_s24[(a >> 8) & 0xFF];
  53.          *(unsigned*)(dst+4) = ((d >> 16) & 0xFF) + colortab_s8[(a >> 16) & 0xFF] +
  54.                                ((d >> 8) & 0xFF0000) + colortab_s24[(a >> 24) & 0xFF];
  55.          d = *(unsigned*)(data + 4);
  56.          a = *(unsigned*)(attr + 4);
  57.          *(unsigned*)(dst+8) = (d & 0xFF) + colortab_s8[a & 0xFF] +
  58.                                ((d << 8) & 0xFF0000) + colortab_s24[(a >> 8) & 0xFF];
  59.          *(unsigned*)(dst+12)= ((d >> 16) & 0xFF) + colortab_s8[(a >> 16) & 0xFF] +
  60.                                ((d >> 8) & 0xFF0000) + colortab_s24[(a >> 24) & 0xFF];
  61.          dst += 16;
  62.       }
  63.  
  64.       data = t.alco[base + y][5].s + ofs;
  65.       attr = t.alco[base + y][5].a + ofs;
  66.       d = *(unsigned*)data;
  67.       a = *(unsigned*)attr;
  68.       *(unsigned*)dst = (d & 0xFF) + colortab_s8[a & 0xFF] +
  69.                         ((d << 8) & 0xFF0000) + colortab_s24[(a >> 8) & 0xFF];
  70.       *(unsigned*)(dst+4) = ((d >> 16) & 0xFF) + colortab_s8[(a >> 16) & 0xFF] +
  71.                             ((d >> 8) & 0xFF0000) + colortab_s24[(a >> 24) & 0xFF];
  72.       dst += 8;
  73.  
  74.    }
  75. }
  76.  
  77. static void draw_alco_256()
  78. {
  79.    unsigned ofs = unsigned(comp.p7FFD & 8) << 12;
  80.    unsigned char *dst = rbuf;
  81.    unsigned base = (304-temp.scy)/2;
  82.    for (unsigned y = 0; y < temp.scy; y++) {
  83.       for (unsigned x = 1; x < 5; x++) {
  84.  
  85.          unsigned char *data = t.alco[base+y][x].s+ofs, *attr = t.alco[base+y][x].a+ofs;
  86.          unsigned d = *(unsigned*)data, a = *(unsigned*)attr;
  87.          *(unsigned*)dst = (d & 0xFF) + colortab_s8[a & 0xFF] +
  88.                            ((d << 8) & 0xFF0000) + colortab_s24[(a >> 8) & 0xFF];
  89.          *(unsigned*)(dst+4) = ((d >> 16) & 0xFF) + colortab_s8[(a >> 16) & 0xFF] +
  90.                                ((d >> 8) & 0xFF0000) + colortab_s24[(a >> 24) & 0xFF];
  91.          d = *(unsigned*)(data + 4);
  92.          a = *(unsigned*)(attr + 4);
  93.          *(unsigned*)(dst+8) = (d & 0xFF) + colortab_s8[a & 0xFF] +
  94.                                ((d << 8) & 0xFF0000) + colortab_s24[(a >> 8) & 0xFF];
  95.          *(unsigned*)(dst+12)= ((d >> 16) & 0xFF) + colortab_s8[(a >> 16) & 0xFF] +
  96.                                ((d >> 8) & 0xFF0000) + colortab_s24[(a >> 24) & 0xFF];
  97.          dst += 16;
  98.       }
  99.    }
  100. }
  101.  
  102. void draw_alco()
  103. {
  104.    if (temp.scx == 384) { draw_alco_384(); return; }
  105.    if (temp.scx == 320) { draw_alco_320(); return; }
  106.    draw_alco_256();
  107. }
  108.