diff --git a/emulator_shell.c b/emulator_shell.c index 13340f0..c2396f5 100644 --- a/emulator_shell.c +++ b/emulator_shell.c @@ -998,11 +998,41 @@ typedef struct cpu_data { static void draw_callback(GtkWidget *widget, cairo_t *cr, gpointer user_data) { int x, y; - int upscaleFactor = 4; + int upscaleFactor = 3; + uint8_t *video = malloc(sizeof(uint8_t) * 224 * 256 * 4); + + //ROTATION ALGORITHM + for (int i=0; i< 224; i++) + { + for (int j = 0; j < 256; j+= 8) + { + int p; + //Read the first 1-bit pixel + // divide by 8 because there are 8 pixels + // in a byte + unsigned char pix = bitmap[(i*(256/8)) + j/8]; + + //That makes 8 output vertical pixels + // we need to do a vertical flip + // so j needs to start at the last line + // and advance backward through the buffer + int offset = (255-j)*(224*4) + (i*4); + unsigned int *p1 = (unsigned int*)(&video[offset]); + for (p=0; p<8; p++) + { + if ( 0!= (pix & (1<