[Core/CD] minor optimization

This commit is contained in:
EkeEke 2015-07-09 23:49:41 +02:00
parent ba2d0dec0e
commit e347ef2713
3 changed files with 7 additions and 12 deletions

View File

@ -243,7 +243,7 @@ void cdc_dma_update(void)
} }
} }
int cdc_decoder_update(uint32 header) void cdc_decoder_update(uint32 header)
{ {
/* data decoding enabled ? */ /* data decoding enabled ? */
if (cdc.ctrl[0] & BIT_DECEN) if (cdc.ctrl[0] & BIT_DECEN)
@ -274,7 +274,7 @@ int cdc_decoder_update(uint32 header)
/* buffer RAM write enabled ? */ /* buffer RAM write enabled ? */
if (cdc.ctrl[0] & BIT_WRRQ) if (cdc.ctrl[0] & BIT_WRRQ)
{ {
uint16 offset; int offset;
/* increment block pointer */ /* increment block pointer */
cdc.pt.w += 2352; cdc.pt.w += 2352;
@ -292,19 +292,14 @@ int cdc_decoder_update(uint32 header)
cdd_read_data(cdc.ram + 4 + offset); cdd_read_data(cdc.ram + 4 + offset);
/* take care of buffer overrun */ /* take care of buffer overrun */
if (offset > (0x4000 - 2048 - 4)) offset = offset + 2048 + 4 - 0x4000;
if (offset > 0)
{ {
/* data should be written at the start of buffer */ /* data should be written at the start of buffer */
memcpy(cdc.ram, cdc.ram + 0x4000, offset + 2048 + 4 - 0x4000); memcpy(cdc.ram, cdc.ram + 0x4000, offset);
} }
/* read next data block */
return 1;
} }
} }
/* keep decoding same data block if Buffer Write is disabled */
return 0;
} }
void cdc_reg_w(unsigned char data) void cdc_reg_w(unsigned char data)

View File

@ -63,7 +63,7 @@ extern void cdc_reset(void);
extern int cdc_context_save(uint8 *state); extern int cdc_context_save(uint8 *state);
extern int cdc_context_load(uint8 *state); extern int cdc_context_load(uint8 *state);
extern void cdc_dma_update(void); extern void cdc_dma_update(void);
extern int cdc_decoder_update(uint32 header); extern void cdc_decoder_update(uint32 header);
extern void cdc_reg_w(unsigned char data); extern void cdc_reg_w(unsigned char data);
extern unsigned char cdc_reg_r(void); extern unsigned char cdc_reg_r(void);
extern unsigned short cdc_host_r(void); extern unsigned short cdc_host_r(void);

View File

@ -1480,7 +1480,7 @@ void scd_init(void)
case 0x0e: case 0x0e:
{ {
/* $FE0000-$FEFFFF (mirrored every 1MB): 8KB backup RAM (Wonder Mega / X'Eye BIOS access it at $FD0000-$FD1FFF ?) */ /* $FE0000-$FEFFFF (mirrored every 1MB): 8KB backup RAM */
s68k.memory_map[i].base = NULL; s68k.memory_map[i].base = NULL;
s68k.memory_map[i].read8 = bram_read_byte; s68k.memory_map[i].read8 = bram_read_byte;
s68k.memory_map[i].read16 = bram_read_word; s68k.memory_map[i].read16 = bram_read_word;