# HG changeset patch # User Michael Pavone # Date 1541406644 28800 # Node ID cc699c4966b1369ac0dd1b8e616936c39c05cd95 # Parent c4ba3177b72d8a169fdb3f3518b1637c64920756 Fix order bytes of a word are written into VRAM from the FIFO. Fixes ticket 36, the graphical glitch in Road Rash 3 diff -r c4ba3177b72d -r cc699c4966b1 vdp.c --- a/vdp.c Sun Nov 04 22:51:50 2018 -0800 +++ b/vdp.c Mon Nov 05 00:30:44 2018 -0800 @@ -896,17 +896,20 @@ if ((context->regs[REG_MODE_2] & (BIT_128K_VRAM|BIT_MODE_5)) == (BIT_128K_VRAM|BIT_MODE_5)) { vdp_check_update_sat(context, start->address, start->value); write_vram_word(context, start->address, start->value); + } else if (start->partial == 3) { + vdp_check_update_sat_byte(context, start->address ^ 1, start->value); + write_vram_byte(context, start->address ^ 1, start->value); } else if (start->partial) { //printf("VRAM Write: %X to %X at %d (line %d, slot %d)\n", start->value, start->address ^ 1, context->cycles, context->cycles/MCLKS_LINE, (context->cycles%MCLKS_LINE)/16); - uint8_t byte = start->partial == 2 ? start->value >> 8 : start->value; + uint8_t byte = start->value >> 8; if (start->partial > 1) { - vdp_check_update_sat_byte(context, start->address ^ 1, byte); + vdp_check_update_sat_byte(context, start->address, byte); } - write_vram_byte(context, start->address ^ 1, byte); + write_vram_byte(context, start->address, byte); } else { //printf("VRAM Write High: %X to %X at %d (line %d, slot %d)\n", start->value >> 8, start->address, context->cycles, context->cycles/MCLKS_LINE, (context->cycles%MCLKS_LINE)/16); vdp_check_update_sat(context, start->address, start->value); - write_vram_byte(context, start->address, start->value >> 8); + write_vram_byte(context, start->address ^ 1, start->value); start->partial = 1; //skip auto-increment and removal of entry from fifo return;