summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2018-11-05 00:30:44 -0800
committerMichael Pavone <pavone@retrodev.com>2018-11-05 00:30:44 -0800
commitb1eb3e1670db1ba1125d5b55bae818f9e29ab5dd (patch)
tree00269911ab5eed2fc14974392e93f90d9d1a5b27
parent85dbe449fe94f8cb4d4b88eaa4acbbba2d52b153 (diff)
Fix order bytes of a word are written into VRAM from the FIFO. Fixes ticket 36, the graphical glitch in Road Rash 3
-rw-r--r--vdp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/vdp.c b/vdp.c
index 1283b99..115f26c 100644
--- a/vdp.c
+++ b/vdp.c
@@ -896,17 +896,20 @@ static void external_slot(vdp_context * context)
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;