diff --git a/src/video.c b/src/video.c index 3252211..47afda4 100644 --- a/src/video.c +++ b/src/video.c @@ -6,6 +6,7 @@ #define LOWCOLOR 96 extern float displayScale; +extern uint8_t randomize; /* Public Variables */ int8_t videoModified; @@ -50,8 +51,9 @@ void initVideo(){ videoMode = 0x01; updatePalette(); - /* Fill VRAM with random values, just for fun */ - for (int i = 0; i < 0x8000; i++) videoMemory[i] = rand(); + if (randomize) { + for (int i = 0; i < 0x8000; i++) videoMemory[i] = rand(); + } } void writeVideo(){ @@ -86,26 +88,16 @@ void setPixels(uint8_t x, uint8_t y){ videoColorValue = videoMemory[(y * 128) + (x | 0x40)]; } - // Snipping out the upper 8 colors - // videoColorValue &= 0x77; - for (uint8_t i = 0; i < 8; i++){ - if (displayScale == 1){ - renderMemory[(y * SDL_X_SIZE) + ((x * 8) + i)] = (videoValue & (128 >> i)) ? videoColorIndex[((videoColorValue & 0xF0) >> 4)] : videoColorIndex[(videoColorValue & 0x0F)]; - } else { - for (uint8_t _x = 0; _x < displayScale; _x++){ - for (uint8_t _y = 0; _y < displayScale; _y++){ - renderMemory[(((y * (int)displayScale) + _y) * SDL_X_SIZE) + ((((x * (int)displayScale) * 8) + (i * (int)displayScale)) + _x)] = (videoValue & (128 >> i)) ? videoColorIndex[((videoColorValue & 0xF0) >> 4)] : videoColorIndex[(videoColorValue & 0x0F)]; - } - } - } + renderMemory[(y * SDL_X_SIZE) + ((x * 8) + i)] = + (videoValue & (128 >> i)) ? + videoColorIndex[((videoColorValue & 0xF0) >> 4)] : + videoColorIndex[(videoColorValue & 0x0F)]; } } void updateVideo(){ - if (videoModified){ - //sfVertexArray_clear(renderArray); - + if (videoModified){ for (uint16_t y = 0; y < 256; y++){ for (uint8_t x = 0; x < 48; x++){ setPixels(x, (uint8_t)y);