diff --git a/core/cd_hw/cdc.c b/core/cd_hw/cdc.c index cf24c9b9..69451869 100644 --- a/core/cd_hw/cdc.c +++ b/core/cd_hw/cdc.c @@ -1,8 +1,8 @@ /*************************************************************************************** * Genesis Plus - * CD data controller (LC89510 compatible) + * CD data controller (LC8951x compatible) * - * Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2012-2019 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: @@ -639,13 +639,8 @@ unsigned short cdc_host_r(void) /* check if data is available */ if (scd.regs[0x04>>1].byte.h & 0x40) { - /* read data word from CDC RAM buffer */ - uint16 data = *(uint16 *)(cdc.ram + (cdc.dac.w & 0x3ffe)); - -#ifdef LSB_FIRST - /* source data is stored in big endian format */ - data = ((data >> 8) | (data << 8)) & 0xffff; -#endif + /* read 16-bit word from CDC RAM buffer (big-endian format) */ + uint16 data = READ_WORD(cdc.ram, cdc.dac.w & 0x3ffe); #ifdef LOG_CDC error("CDC host read 0x%04x -> 0x%04x (dbc=0x%x) (%X)\n", cdc.dac.w, data, cdc.dbc.w, s68k.pc); diff --git a/core/cd_hw/cdc.h b/core/cd_hw/cdc.h index dcd16101..d346e4e9 100644 --- a/core/cd_hw/cdc.h +++ b/core/cd_hw/cdc.h @@ -1,8 +1,8 @@ /*************************************************************************************** * Genesis Plus - * CD data controller (LC89510 compatible) + * CD data controller (LC8951x compatible) * - * Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2012-2019 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: diff --git a/core/cd_hw/gfx.c b/core/cd_hw/gfx.c index 4b40c88c..811995cc 100644 --- a/core/cd_hw/gfx.c +++ b/core/cd_hw/gfx.c @@ -2,7 +2,7 @@ * Genesis Plus * CD graphics processor * - * Copyright (C) 2012 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2012-2019 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: @@ -60,13 +60,8 @@ void word_ram_0_dma_w(unsigned int words) /* DMA transfer */ while (words--) { - /* read 16-bit word from CDC buffer */ - data = *(uint16 *)(cdc.ram + src_index); - -#ifdef LSB_FIRST - /* source data is stored in big endian format */ - data = ((data >> 8) | (data << 8)) & 0xffff; -#endif + /* read 16-bit word from CDC RAM buffer (big-endian format) */ + data = READ_WORD(cdc.ram, src_index); /* write 16-bit word to WORD-RAM */ *(uint16 *)(scd.word_ram[0] + dst_index) = data ; @@ -98,13 +93,8 @@ void word_ram_1_dma_w(unsigned int words) /* DMA transfer */ while (words--) { - /* read 16-bit word from CDC buffer */ - data = *(uint16 *)(cdc.ram + src_index); - -#ifdef LSB_FIRST - /* source data is stored in big endian format */ - data = ((data >> 8) | (data << 8)) & 0xffff; -#endif + /* read 16-bit word from CDC RAM buffer (big-endian format) */ + data = READ_WORD(cdc.ram, src_index); /* write 16-bit word to WORD-RAM */ *(uint16 *)(scd.word_ram[1] + dst_index) = data ; @@ -136,13 +126,8 @@ void word_ram_2M_dma_w(unsigned int words) /* DMA transfer */ while (words--) { - /* read 16-bit word from CDC buffer */ - data = *(uint16 *)(cdc.ram + src_index); - -#ifdef LSB_FIRST - /* source data is stored in big endian format */ - data = ((data >> 8) | (data << 8)) & 0xffff; -#endif + /* read 16-bit word from CDC RAM buffer (big-endian format) */ + data = READ_WORD(cdc.ram, src_index); /* write 16-bit word to WORD-RAM */ *(uint16 *)(scd.word_ram_2M + dst_index) = data ; diff --git a/core/cd_hw/gfx.h b/core/cd_hw/gfx.h index 62419742..754968ea 100644 --- a/core/cd_hw/gfx.h +++ b/core/cd_hw/gfx.h @@ -2,7 +2,7 @@ * Genesis Plus * CD graphics processor * - * Copyright (C) 2012 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2012-2019 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: diff --git a/core/cd_hw/scd.c b/core/cd_hw/scd.c index 74d17953..61f302b1 100644 --- a/core/cd_hw/scd.c +++ b/core/cd_hw/scd.c @@ -101,13 +101,8 @@ void prg_ram_dma_w(unsigned int words) /* DMA transfer */ while (words--) { - /* read 16-bit word from CDC buffer */ - data = *(uint16 *)(cdc.ram + src_index); - -#ifdef LSB_FIRST - /* source data is stored in big endian format */ - data = ((data >> 8) | (data << 8)) & 0xffff; -#endif + /* read 16-bit word from CDC RAM buffer (big-endian format) */ + data = READ_WORD(cdc.ram, src_index); /* write 16-bit word to PRG-RAM */ *(uint16 *)(scd.prg_ram + dst_index) = data ;