aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-18 21:54:57 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-18 21:54:57 +0000
commit7ac56ff043e82e540a5aa108bba2b44b407dd60b (patch)
treed9e8e4a98a91efa7e365c22b6e27137aa91e8853
parent8281db4db9f8a57e30eb4becf955bb0d4d6c5281 (diff)
downloadqemu-7ac56ff043e82e540a5aa108bba2b44b407dd60b.zip
qemu-7ac56ff043e82e540a5aa108bba2b44b407dd60b.tar.gz
qemu-7ac56ff043e82e540a5aa108bba2b44b407dd60b.tar.bz2
SSD0323 vertical incrememnt mode.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3696 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--hw/ssd0323.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/hw/ssd0323.c b/hw/ssd0323.c
index 8c5ab42..c31e49a 100644
--- a/hw/ssd0323.c
+++ b/hw/ssd0323.c
@@ -30,6 +30,12 @@ do { fprintf(stderr, "ssd0323: error: " fmt , ##args);} while (0)
/* Scaling factor for pixels. */
#define MAGNIFY 4
+#define REMAP_SWAP_COLUMN 0x01
+#define REMAP_SWAP_NYBBLE 0x02
+#define REMAP_VERTICAL 0x04
+#define REMAP_SWAP_COM 0x10
+#define REMAP_SPLIT_COM 0x40
+
enum ssd0323_mode
{
SSD0323_CMD,
@@ -49,6 +55,7 @@ typedef struct {
int col_start;
int col_end;
int redraw;
+ int remap;
enum ssd0323_mode mode;
uint8_t framebuffer[128 * 80 / 2];
} ssd0323_state;
@@ -60,13 +67,24 @@ int ssd0323_xfer_ssi(void *opaque, int data)
case SSD0323_DATA:
DPRINTF("data 0x%02x\n", data);
s->framebuffer[s->col + s->row * 64] = data;
- s->col++;
- if (s->col > s->col_end) {
+ if (s->remap & REMAP_VERTICAL) {
s->row++;
- s->col = s->col_start;
- }
- if (s->row > s->row_end) {
- s->row = s->row_start;
+ if (s->row > s->row_end) {
+ s->row = s->row_start;
+ s->col++;
+ }
+ if (s->col > s->col_end) {
+ s->col = s->col_start;
+ }
+ } else {
+ s->col++;
+ if (s->col > s->col_end) {
+ s->row++;
+ s->col = s->col_start;
+ }
+ if (s->row > s->row_end) {
+ s->row = s->row_start;
+ }
}
s->redraw = 1;
break;
@@ -82,12 +100,12 @@ int ssd0323_xfer_ssi(void *opaque, int data)
#define DATA(x) if (s->cmd_len <= (x)) return 0
case 0x15: /* Set column. */
DATA(2);
- s->col_start = s->cmd_data[0] % 64;
+ s->col = s->col_start = s->cmd_data[0] % 64;
s->col_end = s->cmd_data[1] % 64;
break;
case 0x75: /* Set row. */
DATA(2);
- s->row_start = s->cmd_data[0] % 80;
+ s->row = s->row_start = s->cmd_data[0] % 80;
s->row_end = s->cmd_data[1] % 80;
break;
case 0x81: /* Set contrast */
@@ -99,6 +117,7 @@ int ssd0323_xfer_ssi(void *opaque, int data)
case 0xa0: /* Set remapping. */
/* FIXME: Implement this. */
DATA(1);
+ s->remap = s->cmd_data[0];
break;
case 0xa1: /* Set display start line. */
case 0xa2: /* Set display offset. */
@@ -207,6 +226,7 @@ static void ssd0323_update_display(void *opaque)
}
p += dest_width;
}
+ /* TODO: Implement row/column remapping. */
dest = s->ds->data;
for (y = 0; y < 64; y++) {
line = y;