Changeset 49 in Thomson for tools/gfx2mo5/libraw2mo5.c


Ignore:
Timestamp:
17/03/2014 10:51:11 (6 years ago)
Author:
pulkomandy
Message:

gfx2mo5: make TO mode a run-time option

  • Use getopt for parsing option.
  • The "MO5 gate array fixup" is now option -f
  • The "TO modeis now option -t
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gfx2mo5/libraw2mo5.c

    r41 r49  
    77
    88#include <stdbool.h>
     9#include <stdint.h>
    910#include <stdio.h>
    1011#include <stdlib.h>
    1112#include <string.h>
    1213
    13 unsigned char *raw2mo5(unsigned char *input, int height, int fixup)
     14unsigned char *raw2mo5(unsigned char *input, int height, int fixup, bool to)
    1415{
    1516  unsigned char *tmpBuffer;
    1617  int x,y;
    1718  int previous = 0;
     19  bool lfo = false;
     20  uint8_t val;
    1821
    1922  tmpBuffer = (unsigned char*)calloc(0x4000,1);
     
    2528        #define width 320
    2629
    27   bool lfo = false;
    2830  for (y = 0; y < height; y++)
    2931        for (x = 0; x < 320; x+=8) {
     
    7173                // are both FORME or both FOND, else we get an ugly glitch on the
    7274                // EFGJ033 Gate Array MO5!
    73                 if(fixup > 0 && oldlfo == !(tmpBuffer[(y*320+x)/8] & 0x80))
     75                val = tmpBuffer[(y*320+x)/8];
     76                if(fixup > 0 && ((oldlfo == !(val & 0x80) && val != 0) || val == 0xFF))
    7477                {
    75                         previous = (previous >> 4) | (previous << 4);
     78                        previous = 7 | (previous << 4);
    7679                        tmpBuffer[(y*320+x)/8] ^= 0xFF;
    7780
    7881                        lfo = !lfo;
     82                }
     83
     84                // TO8 mode
     85                if(to)
     86                {
     87                        previous = (previous & 0x7) | ((previous & 0xF0) >> 1) | ((previous & 0x8) << 4);
     88                        previous ^= 0xC0;
    7989                }
    8090
Note: See TracChangeset for help on using the changeset viewer.