- addr = &(pattern_ram[(sprite_table[num].num - 32) << 5]);
- int ystep = (cache_index[num].is_halfy) ? 2 : 1;
- int xstep = (cache_index[num].is_halfx) ? 2 : 1;
- int w = (cache_index[num].is_halfy) ? 8 : 16;
- int h = (cache_index[num].is_halfx) ? 8 : 16;
- uint16_t* p;
- uint16_t* m;
- uint8_t* q;
- uint16_t* dp;
- int yy = 0;
- uint8_t pixels[8];
- uint16_t masks[16];
- uint16_t tpixels[16];
- for(int y = 0; y < 16; y += ystep) {
- p = &(cache_pixel[yy << 4]);
- m = &(cache_mask[yy << 4]);
- q = &(qp[y << 4]);
- dp = &(dst_pixel[yy * stride]);
- if(cache_index[num].is_halfx) {
- for(int x = 0; x < 16; x++) {
- pixels[x] = q[x << 1];
- }
- for(int x = 0; x < 16; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 8; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 8; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 8; x++) {
- dp[x] = pixels[x] | tpixels[x];
- }
- } else {
- for(int x = 0; x < 16; x++) {
- pixels[x] = q[x];
- }
- for(int x = 0; x < 16; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 16; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 16; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 16; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 16; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 16; x++) {
- dp[x] = pixels[x] | tpixels[x];
- }
- }
- yy++;
- }
- } else {
- addr = &(pattern_ram[(sprite_table[num].num - 128) << 3]);
- int ystep = (cache_index[num].is_halfy) ? 2 : 1;
- int xstep = (cache_index[num].is_halfx) ? 2 : 1;
- int w = (cache_index[num].is_halfy) ? 8 : 16;
- int h = (cache_index[num].is_halfx) ? 8 : 16;
- int color = sprite_table[num].color;
- if(color < 256) return;
- if(color > 511) return;
- color = color - 256;
- uint16_t* p;
- uint16_t* m;
- uint16_t* q;
- uint16_t* dp;
- int yy = 0;
- uint8_t pixels[16];
- uint8_t pixels_lo[16];
- uint8_t pixels_hi[16];
- uint16_t masks[16];
- uint16_t tpixels[16];
- uint16_t t2pixels[16];
- uint16_t* color_index = (uint16_t*)(&color_index_ram[color << 5]);
- for(int y = 0; y < 16; y += ystep) {
- p = &(cache_pixel[yy << 4]);
- m = &(cache_mask[yy << 4]);
- q = (uint8_t*)qp;
- q = &q[y << 3];
- dp = &(dst_pixel[yy * stride]);
- if(cache_index[num].is_halfx) {
- for(int x = 0; x < 8; x++) {
- pixels[x] = q[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = pixels[x] & 0xf0;
- }
-
- for(int x = 0; x < 8; x++) {
- masks[x] = (pixels[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x] = color_index[pixels[x]];
- }
- for(int x = 0; x < 8; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 8; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = p[x] & ~masks[x];
- }
- for(int x = 0; x < 8; x++) {
- dp[x] = pixels[x] | tpixels[x];
- }
- } else {
- for(int x = 0; x < 8; x++) {
- pixels[x] = q[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels_hi[x] = pixels[x] & 0xf0;
- }
- for(int x = 0; x < 8; x++) {
- pixels_lo[x] = pixels[x] & 0x0f;
- }
-
- for(int x = 0; x < 8; x++) {
- masks[x << 1] = (pixels_hi[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- masks[(x << 1) + 1] = (pixels_lo[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x << 1] = color_index[pixels_hi[x]];
- p[(x << 1) + 1] = color_index[pixels_lo[x]];
- }
- for(int x = 0; x < 16; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 16; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 16; x++) {
- t2pixels[x] = p[x] & ~masks[x];
- }
- for(int x = 0; x < 16; x++) {
- dp[x] = t2pixels[x] | tpixels[x];
- }
- }
- yy++;
- }
- }
-}
-
-void TOWNS_SPRITE::render_mirror_180(int num, uint16* dst_pixel, int width, int height, int stride)
-{
- uint16_t* qp = (uint16_t*)(sprite_table[num].pixels);
- uint8_t* addr;
- uint16_t *cache_pixel = &(cache_pixels[last_put_cache_num][0]);
- uint16_t *cache_mask = &(cache_masks[last_put_cache_num][0]);
- if(sprite_table[num].is_32768) {
- addr = &(pattern_ram[(sprite_table[num].num - 32) << 5]);
- int ystep = (cache_index[num].is_halfy) ? 2 : 1;
- int xstep = (cache_index[num].is_halfx) ? 2 : 1;
- int w = (cache_index[num].is_halfy) ? 8 : 16;
- int h = (cache_index[num].is_halfx) ? 8 : 16;
- uint16_t* p;
- uint16_t* m;
- uint8_t* q;
- uint16_t* dp;
- int yy = 0;
- uint8_t pixels[8];
- uint16_t masks[16];
- uint16_t tpixels[16];
- int ybegin = (cache_index[num].is_halfy) ? 14 : 15;
- for(int y = ybegin; y >= 0; y -= ystep) {
- p = &(cache_pixel[yy << 4]);
- m = &(cache_mask[yy << 4]);
- q = &(qp[y << 4]);
- dp = &(dst_pixel[yy * stride]);
- if(cache_index[num].is_halfx) {
- for(int x = 0; x < 16; x++) {
- pixels[x] = q[x << 1];
- }
- for(int x = 0; x < 16; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 8; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 8; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 8; x++) {
- dp[x] = pixels[x] | tpixels[x];
- }
- } else {
- for(int x = 0; x < 16; x++) {
- pixels[x] = q[x];
- }
- for(int x = 0; x < 16; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 16; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 16; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 16; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 16; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 16; x++) {
- dp[x] = pixels[x] | tpixels[x];
- }
- }
- yy++;
- }
- } else {
- addr = &(pattern_ram[(sprite_table[num].num - 128) << 3]);
- int ystep = (cache_index[num].is_halfy) ? 2 : 1;
- int xstep = (cache_index[num].is_halfx) ? 2 : 1;
- int w = (cache_index[num].is_halfy) ? 8 : 16;
- int h = (cache_index[num].is_halfx) ? 8 : 16;
- int color = sprite_table[num].color;
- if(color < 256) return;
- if(color > 511) return;
- color = color - 256;
- uint16_t* p;
- uint16_t* m;
- uint16_t* q;
- uint16_t* dp;
- int yy = 0;
- uint8_t pixels[16];
- uint8_t pixels_lo[16];
- uint8_t pixels_hi[16];
- uint16_t masks[16];
- uint16_t tpixels[16];
- uint16_t t2pixels[16];
- uint16_t* color_index = (uint16_t*)(&color_index_ram[color << 5]);
- int ybegin = (cache_index[num].is_halfy) ? 14 : 15;
- for(int y = ybegin; y >= 0; y -= ystep) {
- p = &(cache_pixel[yy << 4]);
- m = &(cache_mask[yy << 4]);
- q = (uint8_t*)qp;
- q = &q[y << 3];
- dp = &(dst_pixel[yy * stride]);
- if(cache_index[num].is_halfx) {
- for(int x = 0; x < 8; x++) {
- pixels[x] = q[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = pixels[x] & 0xf0;
- }
-
- for(int x = 0; x < 8; x++) {
- masks[x] = (pixels[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x] = color_index[pixels[x]];
- }
- for(int x = 0; x < 8; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 8; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = p[x] & ~masks[x];
- }
- for(int x = 0; x < 8; x++) {
- dp[x] = pixels[x] | tpixels[x];
- }
- } else {
- for(int x = 0; x < 8; x++) {
- pixels[x] = q[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels_hi[x] = pixels[x] & 0xf0;
- }
- for(int x = 0; x < 8; x++) {
- pixels_lo[x] = pixels[x] & 0x0f;
- }
-
- for(int x = 0; x < 8; x++) {
- masks[x << 1] = (pixels_hi[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- masks[(x << 1) + 1] = (pixels_lo[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x << 1] = color_index[pixels_hi[x]];
- p[(x << 1) + 1] = color_index[pixels_lo[x]];
- }
- for(int x = 0; x < 16; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 16; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 16; x++) {
- t2pixels[x] = p[x] & ~masks[x];
- }
- for(int x = 0; x < 16; x++) {
- dp[x] = t2pixels[x] | tpixels[x];
- }
- }
- yy++;
- }
- }
-
-}
-
-void TOWNS_SPRITE::render_mirror_0(int num, uint16* dst_pixel, int width, int height, int stride)
-{
- uint16_t* qp = (uint16_t*)(sprite_table[num].pixels);
- uint8_t* addr;
- uint16_t *cache_pixel = &(cache_pixels[last_put_cache_num][0]);
- uint16_t *cache_mask = &(cache_masks[last_put_cache_num][0]);
- if(sprite_table[num].is_32768) {
- addr = &(pattern_ram[(sprite_table[num].num - 32) << 5]);
- int ystep = (cache_index[num].is_halfy) ? 2 : 1;
- int xstep = (cache_index[num].is_halfx) ? 2 : 1;
- int w = (cache_index[num].is_halfy) ? 8 : 16;
- int h = (cache_index[num].is_halfx) ? 8 : 16;
- uint16_t* p;
- uint16_t* m;
- uint8_t* q;
- uint16_t* dp;
- int yy = 0;
- uint8_t pixels[8];
- uint16_t masks[16];
- uint16_t tpixels[16];
- int ybegin = (cache_index[num].is_halfy) ? 14 : 15;
- for(int y = ybegin; y >= 0; y -= ystep) {
- p = &(cache_pixel[yy << 4]);
- m = &(cache_mask[yy << 4]);
- q = &(qp[y << 4]);
- dp = &(dst_pixel[yy * stride]);
- if(cache_index[num].is_halfx) {
- for(int x = 0; x < 16; x++) {
- pixels[x] = q[x << 1];
- }
- for(int x = 0; x < 16; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 8; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 8; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 8; x++) {
- dp[7 - x] = pixels[x] | tpixels[x];
- }
- } else {
- for(int x = 0; x < 16; x++) {
- pixels[x] = q[x];
- }
- for(int x = 0; x < 16; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 16; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 16; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 16; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 16; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 16; x++) {
- dp[15 - x] = pixels[x] | tpixels[x];
- }
- }
- yy++;
- }
- } else {
- addr = &(pattern_ram[(sprite_table[num].num - 128) << 3]);
- int ystep = (cache_index[num].is_halfy) ? 2 : 1;
- int xstep = (cache_index[num].is_halfx) ? 2 : 1;
- int w = (cache_index[num].is_halfy) ? 8 : 16;
- int h = (cache_index[num].is_halfx) ? 8 : 16;
- int color = sprite_table[num].color;
- if(color < 256) return;
- if(color > 511) return;
- color = color - 256;
- uint16_t* p;
- uint16_t* m;
- uint16_t* q;
- uint16_t* dp;
- int yy = 0;
- uint8_t pixels[16];
- uint8_t pixels_lo[16];
- uint8_t pixels_hi[16];
- uint16_t masks[16];
- uint16_t tpixels[16];
- uint16_t t2pixels[16];
- uint16_t* color_index = (uint16_t*)(&color_index_ram[color << 5]);
- int ybegin = (cache_index[num].is_halfy) ? 14 : 15;
- for(int y = ybegin; y >= 0; y -= ystep) {
- p = &(cache_pixel[yy << 4]);
- m = &(cache_mask[yy << 4]);
- q = (uint8_t*)qp;
- q = &q[y << 3];
- dp = &(dst_pixel[yy * stride]);
- if(cache_index[num].is_halfx) {
- for(int x = 0; x < 8; x++) {
- pixels[x] = q[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = pixels[x] & 0xf0;
- }
-
- for(int x = 0; x < 8; x++) {
- masks[x] = (pixels[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x] = color_index[pixels[x]];
- }
- for(int x = 0; x < 8; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 8; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = p[x] & ~masks[x];
- }
- for(int x = 0; x < 8; x++) {
- dp[7 - x] = pixels[x] | tpixels[x];
- }
- } else {
- for(int x = 0; x < 8; x++) {
- pixels[x] = q[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels_hi[x] = pixels[x] & 0xf0;
- }
- for(int x = 0; x < 8; x++) {
- pixels_lo[x] = pixels[x] & 0x0f;
- }
-
- for(int x = 0; x < 8; x++) {
- masks[x << 1] = (pixels_hi[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- masks[(x << 1) + 1] = (pixels_lo[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x << 1] = color_index[pixels_hi[x]];
- p[(x << 1) + 1] = color_index[pixels_lo[x]];
- }
- for(int x = 0; x < 16; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 16; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 16; x++) {
- t2pixels[x] = p[x] & ~masks[x];
- }
- for(int x = 0; x < 16; x++) {
- dp[15 - x] = t2pixels[x] | tpixels[x];
- }
- }
- yy++;
- }
- }
-
-}
-
-void TOWNS_SPRITE::render_rotate_180(int num, uint16* dst_pixel, int width, int height, int stride)
-{
- uint16_t* qp = (uint16_t*)(sprite_table[num].pixels);
- uint8_t* addr;
- uint16_t *cache_pixel = &(cache_pixels[last_put_cache_num][0]);
- uint16_t *cache_mask = &(cache_masks[last_put_cache_num][0]);
- if(sprite_table[num].is_32768) {
- addr = &(pattern_ram[(sprite_table[num].num - 32) << 5]);
- int ystep = (cache_index[num].is_halfy) ? 2 : 1;
- int xstep = (cache_index[num].is_halfx) ? 2 : 1;
- int w = (cache_index[num].is_halfy) ? 8 : 16;
- int h = (cache_index[num].is_halfx) ? 8 : 16;
- uint16_t* p;
- uint16_t* m;
- uint8_t* q;
- uint16_t* dp;
- int yy = 0;
- uint8_t pixels[8];
- uint16_t masks[16];
- uint16_t tpixels[16];
- int ybegin = (cache_index[num].is_halfy) ? 14 : 15;
- for(int y = ybegin; y >= 0; y -= ystep) {
- p = &(cache_pixel[yy << 4]);
- m = &(cache_mask[yy << 4]);
- q = &(qp[y << 4]);
- dp = &(dst_pixel[yy * stride]);
- if(cache_index[num].is_halfx) {
- for(int x = 0; x < 16; x++) {
- pixels[x] = q[x << 1];
- }
- for(int x = 0; x < 16; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 8; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 8; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 8; x++) {
- dp[7 - x] = pixels[x] | tpixels[x];
- }
- } else {
- for(int x = 0; x < 16; x++) {
- pixels[x] = q[x];
- }
- for(int x = 0; x < 16; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 16; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 16; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 16; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 16; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 16; x++) {
- dp[15 - x] = pixels[x] | tpixels[x];
- }
- }
- yy++;
- }
- } else {
- addr = &(pattern_ram[(sprite_table[num].num - 128) << 3]);
- int ystep = (cache_index[num].is_halfy) ? 2 : 1;
- int xstep = (cache_index[num].is_halfx) ? 2 : 1;
- int w = (cache_index[num].is_halfy) ? 8 : 16;
- int h = (cache_index[num].is_halfx) ? 8 : 16;
- int color = sprite_table[num].color;
- if(color < 256) return;
- if(color > 511) return;
- color = color - 256;
- uint16_t* p;
- uint16_t* m;
- uint16_t* q;
- uint16_t* dp;
- int yy = 0;
- uint8_t pixels[16];
- uint8_t pixels_lo[16];
- uint8_t pixels_hi[16];
- uint16_t masks[16];
- uint16_t tpixels[16];
- uint16_t t2pixels[16];
- uint16_t* color_index = (uint16_t*)(&color_index_ram[color << 5]);
- int ybegin = (cache_index[num].is_halfy) ? 14 : 15;
- for(int y = ybegin; y >= 0; y -= ystep) {
- p = &(cache_pixel[yy << 4]);
- m = &(cache_mask[yy << 4]);
- q = (uint8_t*)qp;
- q = &q[y << 3];
- dp = &(dst_pixel[yy * stride]);
- if(cache_index[num].is_halfx) {
- for(int x = 0; x < 8; x++) {
- pixels[x] = q[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = pixels[x] & 0xf0;
- }
-
- for(int x = 0; x < 8; x++) {
- masks[x] = (pixels[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x] = color_index[pixels[x]];
- }
- for(int x = 0; x < 8; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 8; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = p[x] & ~masks[x];
- }
- for(int x = 0; x < 8; x++) {
- dp[7 - x] = pixels[x] | tpixels[x];
- }
- } else {
- for(int x = 0; x < 8; x++) {
- pixels[x] = q[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels_hi[x] = pixels[x] & 0xf0;
- }
- for(int x = 0; x < 8; x++) {
- pixels_lo[x] = pixels[x] & 0x0f;
- }
-
- for(int x = 0; x < 8; x++) {
- masks[x << 1] = (pixels_hi[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- masks[(x << 1) + 1] = (pixels_lo[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x << 1] = color_index[pixels_hi[x]];
- p[(x << 1) + 1] = color_index[pixels_lo[x]];
- }
- for(int x = 0; x < 16; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 16; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 16; x++) {
- t2pixels[x] = p[x] & ~masks[x];
- }
- for(int x = 0; x < 16; x++) {
- dp[15 - x] = t2pixels[x] | tpixels[x];
- }
- }
- yy++;
- }
- }
-
-}
-
-void TOWNS_SPRITE::render_mirror_270(int num, uint16* dst_pixel, int width, int height, int stride)
-{
- uint16_t* qp = (uint16_t*)(sprite_table[num].pixels);
- uint8_t* addr;
- uint16_t *cache_pixel = &(cache_pixels[last_put_cache_num][0]);
- uint16_t *cache_mask = &(cache_masks[last_put_cache_num][0]);
- if(sprite_table[num].is_32768) {
- addr = &(pattern_ram[(sprite_table[num].num - 32) << 5]);
- int ystep = (cache_index[num].is_halfy) ? 2 : 1;
- int xstep = (cache_index[num].is_halfx) ? 2 : 1;
- int w = (cache_index[num].is_halfy) ? 8 : 16;
- int h = (cache_index[num].is_halfx) ? 8 : 16;
- uint16_t* p;
- uint16_t* m;
- uint16_t* dp;
- int yy = 0;
- uint8_t pixels[8];
- uint16_t masks[16];
- uint16_t tpixels[16];
- uint16_t pcache[16];
- int ybegin = (cache_index[num].is_halfy) ? 14 : 15;
- for(int y = ybegin; y >= 0; y -= ystep) {
- p = &(cache_pixel[yy << 4]);
- m = &(cache_mask[yy << 4]);
- for(int x = 0; x < 16; x++) {
- pcache[x] = qp[(x << 4) + y];
- }
- dp = &(dst_pixel[yy * stride]);
- if(cache_index[num].is_halfx) {
- for(int x = 0; x < 8; x++) {
- pixels[x] = pcache[x << 1];
- }
- for(int x = 0; x < 8; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 8; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 8; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 8; x++) {
- dp[7 - x] = pixels[x] | tpixels[x];
- }
- } else {
- for(int x = 0; x < 16; x++) {
- pixels[x] = pcache[x];
- }
- for(int x = 0; x < 16; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 16; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 16; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 16; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 16; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 16; x++) {
- dp[15 - x] = pixels[x] | tpixels[x];
- }
- }
- yy++;
- }
- } else {
- addr = &(pattern_ram[(sprite_table[num].num - 128) << 3]);
- int ystep = (cache_index[num].is_halfy) ? 2 : 1;
- int xstep = (cache_index[num].is_halfx) ? 2 : 1;
- int w = (cache_index[num].is_halfy) ? 8 : 16;
- int h = (cache_index[num].is_halfx) ? 8 : 16;
- int color = sprite_table[num].color;
- if(color < 256) return;
- if(color > 511) return;
- color = color - 256;
- uint16_t* p;
- uint16_t* m;
- uint16_t* dp;
- int yy = 0;
- uint8_t pixels[16];
- uint8_t pixels_lo[16];
- uint8_t pixels_hi[16];
- uint16_t masks[16];
- uint16_t tpixels[16];
- uint16_t t2pixels[16];
- uint8_t pcache[16];
- uint16_t* color_index = (uint16_t*)(&color_index_ram[color << 5]);
- int ybegin = (cache_index[num].is_halfy) ? 14 : 15;
- for(int y = ybegin; y >= 0; y -= ystep) {
- p = &(cache_pixel[yy << 4]);
- m = &(cache_mask[yy << 4]);
- for(int x = 0; x < 8; x++) {
- pcache[x << 1] = qp[(x << 4) + y] & 0xf0;
- pcache[(x << 1) + 1] = qp[(x << 4) + y] & 0x0f;
- }
- dp = &(dst_pixel[yy * stride]);
- if(cache_index[num].is_halfx) {
- for(int x = 0; x < 8; x++) {
- pixels[x] = pcache[x << 1];
- }
- for(int x = 0; x < 8; x++) {
- masks[x] = (pixels[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x] = color_index[pixels[x]];
- }
- for(int x = 0; x < 8; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 8; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = p[x] & ~masks[x];
- }
- for(int x = 0; x < 8; x++) {
- dp[7 - x] = pixels[x] | tpixels[x];
- }
- } else {
- for(int x = 0; x < 16; x++) {
- pixels[x] = pcache[x];
- }
- for(int x = 0; x < 16; x++) {
- masks[x] = (pixels[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 16; x++) {
- p[x] = color_index[pixels[x]];
- }
- for(int x = 0; x < 16; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 16; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 16; x++) {
- t2pixels[x] = p[x] & ~masks[x];
- }
- for(int x = 0; x < 16; x++) {
- dp[15 - x] = t2pixels[x] | tpixels[x];
- }
- }
- yy++;
- }
- }
-
-}
-
-
-void TOWNS_SPRITE::render_rotate_90(int num, uint16* dst_pixel, int width, int height, int stride)
-{
- uint16_t* qp = (uint16_t*)(sprite_table[num].pixels);
- uint8_t* addr;
- uint16_t *cache_pixel = &(cache_pixels[last_put_cache_num][0]);
- uint16_t *cache_mask = &(cache_masks[last_put_cache_num][0]);
- if(sprite_table[num].is_32768) {
- addr = &(pattern_ram[(sprite_table[num].num - 32) << 5]);
- int ystep = (cache_index[num].is_halfy) ? 2 : 1;
- int xstep = (cache_index[num].is_halfx) ? 2 : 1;
- int w = (cache_index[num].is_halfy) ? 8 : 16;
- int h = (cache_index[num].is_halfx) ? 8 : 16;
- uint16_t* p;
- uint16_t* m;
- uint16_t* dp;
- int yy = 0;
- uint8_t pixels[8];
- uint16_t masks[16];
- uint16_t tpixels[16];
- uint16_t pcache[16];
- int ybegin = (cache_index[num].is_halfy) ? 14 : 15;
- for(int y = ybegin; y >= 0; y -= ystep) {
- p = &(cache_pixel[yy << 4]);
- m = &(cache_mask[yy << 4]);
- for(int x = 0; x < 16; x++) {
- pcache[x] = qp[(x << 4) + (15 - y)];
- }
- dp = &(dst_pixel[yy * stride]);
- if(cache_index[num].is_halfx) {
- for(int x = 0; x < 8; x++) {
- pixels[x] = pcache[x << 1];
- }
- for(int x = 0; x < 8; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 8; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 8; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 8; x++) {
- dp[7 - x] = pixels[x] | tpixels[x];
- }
- } else {
- for(int x = 0; x < 16; x++) {
- pixels[x] = pcache[x];
- }
- for(int x = 0; x < 16; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 16; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 16; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 16; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 16; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 16; x++) {
- dp[15 - x] = pixels[x] | tpixels[x];
- }
- }
- yy++;
- }
- } else {
- addr = &(pattern_ram[(sprite_table[num].num - 128) << 3]);
- int ystep = (cache_index[num].is_halfy) ? 2 : 1;
- int xstep = (cache_index[num].is_halfx) ? 2 : 1;
- int w = (cache_index[num].is_halfy) ? 8 : 16;
- int h = (cache_index[num].is_halfx) ? 8 : 16;
- int color = sprite_table[num].color;
- if(color < 256) return;
- if(color > 511) return;
- color = color - 256;
- uint16_t* p;
- uint16_t* m;
- uint16_t* dp;
- int yy = 0;
- uint8_t pixels[16];
- uint8_t pixels_lo[16];
- uint8_t pixels_hi[16];
- uint16_t masks[16];
- uint16_t tpixels[16];
- uint16_t t2pixels[16];
- uint8_t pcache[16];
- uint16_t* color_index = (uint16_t*)(&color_index_ram[color << 5]);
- int ybegin = (cache_index[num].is_halfy) ? 14 : 15;
- for(int y = ybegin; y >= 0; y -= ystep) {
- p = &(cache_pixel[yy << 4]);
- m = &(cache_mask[yy << 4]);
- for(int x = 0; x < 8; x++) {
- pcache[x << 1] = qp[(x << 4) + (15 - y)] & 0xf0;
- pcache[(x << 1) + 1] = qp[(x << 4) + (15 - y)] & 0x0f;
- }
- dp = &(dst_pixel[yy * stride]);
- if(cache_index[num].is_halfx) {
- for(int x = 0; x < 8; x++) {
- pixels[x] = pcache[x << 1];
- }
- for(int x = 0; x < 8; x++) {
- masks[x] = (pixels[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x] = color_index[pixels[x]];
- }
- for(int x = 0; x < 8; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 8; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = p[x] & ~masks[x];
- }
- for(int x = 0; x < 8; x++) {
- dp[7 - x] = pixels[x] | tpixels[x];
- }
- } else {
- for(int x = 0; x < 16; x++) {
- pixels[x] = pcache[x];
- }
- for(int x = 0; x < 16; x++) {
- masks[x] = (pixels[x] == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 16; x++) {
- p[x] = color_index[pixels[x]];
- }
- for(int x = 0; x < 16; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 16; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 16; x++) {
- t2pixels[x] = p[x] & ~masks[x];
- }
- for(int x = 0; x < 16; x++) {
- dp[15 - x] = t2pixels[x] | tpixels[x];
- }
- }
- yy++;
- }
- }
-
-}
-
-void TOWNS_SPRITE::render_rotate_270(int num, uint16* dst_pixel, int width, int height, int stride)
-{
- uint16_t* qp = (uint16_t*)(sprite_table[num].pixels);
- uint8_t* addr;
- uint16_t *cache_pixel = &(cache_pixels[last_put_cache_num][0]);
- uint16_t *cache_mask = &(cache_masks[last_put_cache_num][0]);
- if(sprite_table[num].is_32768) {
- addr = &(pattern_ram[(sprite_table[num].num - 32) << 5]);
- int ystep = (cache_index[num].is_halfy) ? 2 : 1;
- int xstep = (cache_index[num].is_halfx) ? 2 : 1;
- int w = (cache_index[num].is_halfy) ? 8 : 16;
- int h = (cache_index[num].is_halfx) ? 8 : 16;
- uint16_t* p;
- uint16_t* m;
- uint16_t* dp;
- int yy = 0;
- uint8_t pixels[8];
- uint16_t masks[16];
- uint16_t tpixels[16];
- uint16_t pcache[16];
- int ybegin = (cache_index[num].is_halfy) ? 14 : 15;
- for(int y = ybegin; y >= 0; y -= ystep) {
- p = &(cache_pixel[yy << 4]);
- m = &(cache_mask[yy << 4]);
- for(int x = 0; x < 16; x++) {
- pcache[x] = qp[((15 - x) << 4) + y];
- }
- dp = &(dst_pixel[yy * stride]);
- if(cache_index[num].is_halfx) {
- for(int x = 0; x < 8; x++) {
- pixels[x] = pcache[x << 1];
- }
- for(int x = 0; x < 8; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 8; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 8; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 8; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 8; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 8; x++) {
- dp[7 - x] = pixels[x] | tpixels[x];
- }
- } else {
- for(int x = 0; x < 16; x++) {
- pixels[x] = pcache[x];
- }
- for(int x = 0; x < 16; x++) {
- masks[x] = ((pixels[x] & 0x8000) == 0) ? 0xffff : 0x0000;
- }
- for(int x = 0; x < 16; x++) {
- p[x] = pixels[x];
- }
- for(int x = 0; x < 16; x++) {
- m[x] = masks[x];
- }
- // Draw to buffer
- for(int x = 0; x < 16; x++) {
- tpixels[x] = dp[x] & masks[x];
- }
- for(int x = 0; x < 16; x++) {
- pixels[x] = pixels[x] & ~masks[x];
- }
- for(int x = 0; x < 16; x++) {
- dp[15 - x] = pixels[x] | tpixels[x];
- }
- }
- yy++;
- }