Mercurial > repos > blastem
comparison segacd.c @ 2056:27bbfcb7850a segacd
Fix byte write behavior on a few gate array regs to pass the VAR test in mcd-verificator
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 19 Jan 2022 00:08:01 -0800 |
parents | c4d066d798c4 |
children | 88deea42caf0 |
comparison
equal
deleted
inserted
replaced
2055:c4d066d798c4 | 2056:27bbfcb7850a |
---|---|
375 { | 375 { |
376 m68k_context *m68k = vcontext; | 376 m68k_context *m68k = vcontext; |
377 segacd_context *cd = m68k->system; | 377 segacd_context *cd = m68k->system; |
378 uint32_t reg = (address & 0x1FF) >> 1; | 378 uint32_t reg = (address & 0x1FF) >> 1; |
379 uint16_t value16; | 379 uint16_t value16; |
380 if (address & 1) { | 380 switch (address >> 1) |
381 value16 = cd->gate_array[reg] & 0xFF00 | value; | 381 { |
382 } else { | 382 case GA_CDC_HOST_DATA: |
383 value16 = cd->gate_array[reg] & 0xFF | (value << 8); | 383 case GA_CDC_DMA_ADDR: |
384 case GA_STOP_WATCH: | |
385 case GA_COMM_FLAG: | |
386 case GA_CDD_FADER: | |
387 //these registers treat all writes as word-wide | |
388 value16 = value | (value << 8); | |
389 break; | |
390 default: | |
391 if (address & 1) { | |
392 value16 = cd->gate_array[reg] & 0xFF00 | value; | |
393 } else { | |
394 value16 = cd->gate_array[reg] & 0xFF | (value << 8); | |
395 } | |
384 } | 396 } |
385 return sub_gate_write16(address, vcontext, value16); | 397 return sub_gate_write16(address, vcontext, value16); |
386 } | 398 } |
387 | 399 |
388 static uint8_t can_main_access_prog(segacd_context *cd) | 400 static uint8_t can_main_access_prog(segacd_context *cd) |
586 m68k_context *m68k = vcontext; | 598 m68k_context *m68k = vcontext; |
587 genesis_context *gen = m68k->system; | 599 genesis_context *gen = m68k->system; |
588 segacd_context *cd = gen->expansion; | 600 segacd_context *cd = gen->expansion; |
589 uint32_t reg = (address & 0x1FF) >> 1; | 601 uint32_t reg = (address & 0x1FF) >> 1; |
590 uint16_t value16; | 602 uint16_t value16; |
591 if (address & 1) { | 603 switch (reg >> 1) |
592 value16 = cd->gate_array[reg] & 0xFF00 | value; | 604 { |
593 } else { | 605 case GA_HINT_VECTOR: |
594 value16 = cd->gate_array[reg] & 0xFF | (value << 8); | 606 case GA_COMM_FLAG: |
607 //writes to these regs are always treated as word wide | |
608 value16 = value | (value << 8); | |
609 break; | |
610 default: | |
611 if (address & 1) { | |
612 value16 = cd->gate_array[reg] & 0xFF00 | value; | |
613 } else { | |
614 value16 = cd->gate_array[reg] & 0xFF | (value << 8); | |
615 } | |
595 } | 616 } |
596 return main_gate_write16(address, vcontext, value16); | 617 return main_gate_write16(address, vcontext, value16); |
597 } | 618 } |
598 | 619 |
599 segacd_context *alloc_configure_segacd(system_media *media, uint32_t opts, uint8_t force_region, rom_info *info) | 620 segacd_context *alloc_configure_segacd(system_media *media, uint32_t opts, uint8_t force_region, rom_info *info) |