Revision 7ac56ff0 hw/ssd0323.c

b/hw/ssd0323.c
30 30
/* Scaling factor for pixels.  */
31 31
#define MAGNIFY 4
32 32

  
33
#define REMAP_SWAP_COLUMN 0x01
34
#define REMAP_SWAP_NYBBLE 0x02
35
#define REMAP_VERTICAL    0x04
36
#define REMAP_SWAP_COM    0x10
37
#define REMAP_SPLIT_COM   0x40
38

  
33 39
enum ssd0323_mode
34 40
{
35 41
    SSD0323_CMD,
......
49 55
    int col_start;
50 56
    int col_end;
51 57
    int redraw;
58
    int remap;
52 59
    enum ssd0323_mode mode;
53 60
    uint8_t framebuffer[128 * 80 / 2];
54 61
} ssd0323_state;
......
60 67
    case SSD0323_DATA:
61 68
        DPRINTF("data 0x%02x\n", data);
62 69
        s->framebuffer[s->col + s->row * 64] = data;
63
        s->col++;
64
        if (s->col > s->col_end) {
70
        if (s->remap & REMAP_VERTICAL) {
65 71
            s->row++;
66
            s->col = s->col_start;
67
        }
68
        if (s->row > s->row_end) {
69
            s->row = s->row_start;
72
            if (s->row > s->row_end) {
73
                s->row = s->row_start;
74
                s->col++;
75
            }
76
            if (s->col > s->col_end) {
77
                s->col = s->col_start;
78
            }
79
        } else {
80
            s->col++;
81
            if (s->col > s->col_end) {
82
                s->row++;
83
                s->col = s->col_start;
84
            }
85
            if (s->row > s->row_end) {
86
                s->row = s->row_start;
87
            }
70 88
        }
71 89
        s->redraw = 1;
72 90
        break;
......
82 100
#define DATA(x) if (s->cmd_len <= (x)) return 0
83 101
        case 0x15: /* Set column.  */
84 102
            DATA(2);
85
            s->col_start = s->cmd_data[0] % 64;
103
            s->col = s->col_start = s->cmd_data[0] % 64;
86 104
            s->col_end = s->cmd_data[1] % 64;
87 105
            break;
88 106
        case 0x75: /* Set row.  */
89 107
            DATA(2);
90
            s->row_start = s->cmd_data[0] % 80;
108
            s->row = s->row_start = s->cmd_data[0] % 80;
91 109
            s->row_end = s->cmd_data[1] % 80;
92 110
            break;
93 111
        case 0x81: /* Set contrast */
......
99 117
        case 0xa0: /* Set remapping.  */
100 118
            /* FIXME: Implement this.  */
101 119
            DATA(1);
120
            s->remap = s->cmd_data[0];
102 121
            break;
103 122
        case 0xa1: /* Set display start line.  */
104 123
        case 0xa2: /* Set display offset.  */
......
207 226
            }
208 227
            p += dest_width;
209 228
        }
229
        /* TODO: Implement row/column remapping.  */
210 230
        dest = s->ds->data;
211 231
        for (y = 0; y < 64; y++) {
212 232
            line = y;

Also available in: Unified diff