Beispiel #1
0
/*
 * Update graphics 1280 * 800 * 2
 */
static
void wy700_update_1280x800 (cga_t *wy)
{
	unsigned            i, x, y;
	unsigned            val;
	unsigned            addr;
	unsigned char       *dst;
	const unsigned char *src;

	if (cga_set_buf_size (wy, 1280, 800)) {
		return;
	}

	dst = wy->buf;

	addr = 0;

	for (y = 0; y < 800; y++) {
		src = wy->mem + addr;

		if (y & 1) {
			src += 0x10000;
			addr += 160;
		}

		for (x = 0; x < (1280 / 8); x++) {
			val = src[x];

			for (i = 0; i < 8; i++) {
				if (val & 0x80) {
					dst[0] = 0xff;
					dst[1] = 0xff;
					dst[2] = 0xff;
				}
				else {
					dst[0] = 0x00;
					dst[1] = 0x00;
					dst[2] = 0x00;
				}

				val <<= 1;

				dst += 3;
			}
		}
	}
}
Beispiel #2
0
/*
 * Update graphics 620 * 400 * 2
 */
static
void m24_update_640_400 (cga_t *m24)
{
	unsigned            i, x, y, w, h;
	unsigned            val, idx;
	unsigned char       *dst;
	const unsigned char *col, *src;

	if (cga_set_buf_size (m24, 16 * m24->w, 4 * m24->h)) {
		return;
	}

	dst = m24->buf;

	w = 2 * m24->w;
	h = 4 * m24->h;

	for (y = 0; y < h; y++) {
		src = m24->mem + (y & 3) * 8192 + (y / 4) * w;

		for (x = 0; x < w; x++) {
			val = src[x];

			for (i = 0; i < 8; i++) {
				idx = (val & 0x80) ? m24->pal[0] : 0;
				col = cga_rgb[idx];

				dst[0] = col[0];
				dst[1] = col[1];
				dst[2] = col[2];

				val <<= 1;

				dst += 3;
			}
		}
	}
}