static void out_linetoscr (DEPTH_T bpp, HMODE_T hmode, int aga) { if (aga) outln ("#ifdef AGA"); out_linetoscr_decl (bpp, hmode, aga); outln ( "{"); outlnf ( " %s *buf = (%s *) xlinebuffer;", get_depth_type_str (bpp), get_depth_type_str (bpp)); if (aga) outln ( " uae_u8 xor_val = (uae_u8)(dp_for_drawing->bplcon4 >> 8);"); outln ( ""); outln ( " if (dp_for_drawing->ham_seen) {"); out_linetoscr_mode (bpp, hmode, aga, CMODE_HAM); outln ( " } else if (bpldualpf) {"); out_linetoscr_mode (bpp, hmode, aga, CMODE_DUALPF); outln ( " } else if (bplehb) {"); out_linetoscr_mode (bpp, hmode, aga, CMODE_EXTRAHB); outln ( " } else {"); out_linetoscr_mode (bpp, hmode, aga, CMODE_NORMAL); outln ( " }\n"); outln ( " return spix;"); outln ( "}"); if (aga) outln ( "#endif"); outln ( ""); }
static void out_linetoscr_do_incspix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode, int spr) { if (hmode == HMODE_HALVE1F) { outln ( " {"); outln ( " uae_u32 tmp_val;"); outln ( " spix++;"); outln ( " tmp_val = dpix_val;"); out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr); out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr); outlnf ( " dpix_val = merge_2pixel%d (dpix_val, tmp_val);", bpp == 0 ? 8 : bpp == 1 ? 16 : 32); outln ( " spix++;"); outln ( " }"); } else if (hmode == HMODE_HALVE2F) { outln ( " {"); outln ( " uae_u32 tmp_val, tmp_val2, tmp_val3;"); outln ( " spix++;"); outln ( " tmp_val = dpix_val;"); out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr); out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr); outln ( " spix++;"); outln ( " tmp_val2 = dpix_val;"); out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr); out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr); outln ( " spix++;"); outln ( " tmp_val3 = dpix_val;"); out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr); out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr); outlnf ( " tmp_val = merge_2pixel%d (tmp_val, tmp_val2);", bpp == 0 ? 8 : bpp == 1 ? 16 : 32); outlnf ( " tmp_val2 = merge_2pixel%d (tmp_val3, dpix_val);", bpp == 0 ? 8 : bpp == 1 ? 16 : 32); outlnf ( " dpix_val = merge_2pixel%d (tmp_val, tmp_val2);", bpp == 0 ? 8 : bpp == 1 ? 16 : 32); outln ( " spix++;"); outln ( " }"); } else if (hmode == HMODE_HALVE1) { outln ( " spix += 2;"); } else if (hmode == HMODE_HALVE2) { outln ( " spix += 4;"); } else { outln ( " spix++;"); } }
static void out_linetoscr_do_dstpix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode, int spr) { if (aga && cmode == CMODE_HAM) { outln ( " dpix_val = CONVERT_RGB (ham_linebuf[spix]);"); if (spr) outln ( " sprpix_val = dpix_val;"); } else if (cmode == CMODE_HAM) { outln ( " dpix_val = xcolors[ham_linebuf[spix]];"); if (spr) outln ( " sprpix_val = dpix_val;"); } else if (aga && cmode == CMODE_DUALPF) { if (spr) { outlnf ( " sprcol = render_sprites (dpix, 1, sprpix_val, %d);", aga); outln ( " if (sprcol) {"); outln ( " dpix_val = colors_for_drawing.acolors[sprcol];"); outln ( " } else {"); } else { outln ( " if (1) {"); } outln ( " unsigned int val = lookup[spix_val];"); outln ( " if (lookup_no[spix_val] == 2)"); outln ( " val += dblpfofs[bpldualpf2of];"); outln ( " val ^= xor_val;"); outln ( " dpix_val = colors_for_drawing.acolors[val];"); outln ( " }"); } else if (cmode == CMODE_DUALPF) { outln ( " dpix_val = colors_for_drawing.acolors[lookup[spix_val]];"); } else if (aga && cmode == CMODE_EXTRAHB) { outln ( " if (spix_val >= 32 && spix_val < 64) {"); outln ( " unsigned int c = (colors_for_drawing.color_regs_aga[spix_val - 32] >> 1) & 0x7F7F7F;"); outln ( " dpix_val = CONVERT_RGB (c);"); outln ( " } else"); outln ( " dpix_val = colors_for_drawing.acolors[spix_val];"); } else if (cmode == CMODE_EXTRAHB) { outln ( " if (spix_val <= 31)"); outln ( " dpix_val = colors_for_drawing.acolors[spix_val];"); outln ( " else"); outln ( " dpix_val = xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777];"); } else outln ( " dpix_val = colors_for_drawing.acolors[spix_val];"); }
static void out_linetoscr_decl (DEPTH_T bpp, HMODE_T hmode, int aga) { outlnf ("static int NOINLINE linetoscr_%s%s%s (int spix, int dpix, int stoppos)", get_depth_str (bpp), get_hmode_str (hmode), aga ? "_aga" : ""); }
static void out_sprite (DEPTH_T bpp, HMODE_T hmode, CMODE_T cmode, int aga, int cnt) { if (aga) { if (cnt == 1) { outlnf ( " if (spritepixels[dpix].data) {"); outlnf ( " sprcol = render_sprites (dpix + 0, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga); outlnf ( " if (sprcol)"); outlnf ( " out_val = colors_for_drawing.acolors[sprcol];"); outlnf ( " }"); outlnf ( " buf[dpix++] = out_val;"); } else if (cnt == 2) { outlnf ( " {"); outlnf ( " uae_u32 out_val1 = out_val;"); outlnf ( " uae_u32 out_val2 = out_val;"); outlnf ( " if (spritepixels[dpix + 0].data) {"); outlnf ( " sprcol = render_sprites (dpix + 0, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga); outlnf ( " if (sprcol)"); outlnf ( " out_val1 = colors_for_drawing.acolors[sprcol];"); outlnf ( " }"); outlnf ( " if (spritepixels[dpix + 1].data) {"); outlnf ( " sprcol = render_sprites (dpix + 1, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga); outlnf ( " if (sprcol)"); outlnf ( " out_val2 = colors_for_drawing.acolors[sprcol];"); outlnf ( " }"); outlnf ( " buf[dpix++] = out_val1;"); outlnf ( " buf[dpix++] = out_val2;"); outlnf ( " }"); } else if (cnt == 4) { outlnf ( " {"); outlnf ( " uae_u32 out_val1 = out_val;"); outlnf ( " uae_u32 out_val2 = out_val;"); outlnf ( " uae_u32 out_val3 = out_val;"); outlnf ( " uae_u32 out_val4 = out_val;"); outlnf ( " if (spritepixels[dpix + 0].data) {"); outlnf ( " sprcol = render_sprites (dpix + 0, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga); outlnf ( " if (sprcol)"); outlnf ( " out_val1 = colors_for_drawing.acolors[sprcol];"); outlnf ( " }"); outlnf ( " if (spritepixels[dpix + 1].data) {"); outlnf ( " sprcol = render_sprites (dpix + 1, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga); outlnf ( " if (sprcol)"); outlnf ( " out_val2 = colors_for_drawing.acolors[sprcol];"); outlnf ( " }"); outlnf ( " if (spritepixels[dpix + 2].data) {"); outlnf ( " sprcol = render_sprites (dpix + 2, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga); outlnf ( " if (sprcol)"); outlnf ( " out_val3 = colors_for_drawing.acolors[sprcol];"); outlnf ( " }"); outlnf ( " if (spritepixels[dpix + 3].data) {"); outlnf ( " sprcol = render_sprites (dpix + 3, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga); outlnf ( " if (sprcol)"); outlnf ( " out_val4 = colors_for_drawing.acolors[sprcol];"); outlnf ( " }"); outlnf ( " buf[dpix++] = out_val1;"); outlnf ( " buf[dpix++] = out_val2;"); outlnf ( " buf[dpix++] = out_val3;"); outlnf ( " buf[dpix++] = out_val4;"); outlnf ( " }"); } } else { outlnf ( " if (spritepixels[dpix].data) {"); outlnf ( " sprcol = render_sprites (dpix, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga); outlnf ( " if (sprcol) {"); outlnf ( " uae_u32 spcol = colors_for_drawing.acolors[sprcol];"); outlnf ( " out_val = spcol;"); outlnf ( " }"); outlnf ( " }"); while (cnt-- > 0) outlnf ( " buf[dpix++] = out_val;"); } }