# HG changeset patch # User Michael Pavone # Date 1482871417 28800 # Node ID 1913f9c280033865cc28cfcf63c95b74af6ccfab # Parent e9369d6f0101c6ca4b163fd7ba77829e80201211 Less broken Mode 4 implementation diff -r e9369d6f0101 -r 1913f9c28003 vdp.c --- a/vdp.c Tue Dec 27 11:31:17 2016 -0800 +++ b/vdp.c Tue Dec 27 12:43:37 2016 -0800 @@ -1246,9 +1246,9 @@ if (context->regs[REG_MODE_1] & BIT_SPRITE_8PX) { sprite_src += 8; } - uint8_t *bg_src = context->tmp_buf_a + (((col & 1) * 8 + (context->hscroll_a & 0x7)) & 0x15); - for (int i = 0; i < 8; i++, bg_src++, sprite_src++) + for (int i = 0; i < 8; i++, sprite_src++) { + uint8_t *bg_src = context->tmp_buf_a + ((8 + i + col * 8 - (context->hscroll_a & 0x7)) & 15); if ((*bg_src & 0x4F) > 0x40) { //background plane has priority and is opaque if (context->debug) { @@ -1895,6 +1895,8 @@ case 253: external_slot(context); scan_sprite_table_mode4(context->vcounter, context);//Just a guess + context->buf_a_off = 8; + memset(context->tmp_buf_a, 0, 8); //reverse context slot counter so it counts the number of sprite slots //filled rather than the number of available slots //context->slot_counter = MAX_SPRITES_LINE - context->slot_counter;