From e347ef271364bdd1933c14f9c390b2f5a5cc50d5 Mon Sep 17 00:00:00 2001 From: EkeEke Date: Thu, 9 Jul 2015 23:49:41 +0200 Subject: [PATCH] [Core/CD] minor optimization --- core/cd_hw/cdc.c | 15 +++++---------- core/cd_hw/cdc.h | 2 +- core/cd_hw/scd.c | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/core/cd_hw/cdc.c b/core/cd_hw/cdc.c index dd75a59..cf24c9b 100644 --- a/core/cd_hw/cdc.c +++ b/core/cd_hw/cdc.c @@ -243,7 +243,7 @@ void cdc_dma_update(void) } } -int cdc_decoder_update(uint32 header) +void cdc_decoder_update(uint32 header) { /* data decoding enabled ? */ if (cdc.ctrl[0] & BIT_DECEN) @@ -274,7 +274,7 @@ int cdc_decoder_update(uint32 header) /* buffer RAM write enabled ? */ if (cdc.ctrl[0] & BIT_WRRQ) { - uint16 offset; + int offset; /* increment block pointer */ cdc.pt.w += 2352; @@ -292,19 +292,14 @@ int cdc_decoder_update(uint32 header) cdd_read_data(cdc.ram + 4 + offset); /* 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 */ - 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) diff --git a/core/cd_hw/cdc.h b/core/cd_hw/cdc.h index 651f992..dcd1610 100644 --- a/core/cd_hw/cdc.h +++ b/core/cd_hw/cdc.h @@ -63,7 +63,7 @@ extern void cdc_reset(void); extern int cdc_context_save(uint8 *state); extern int cdc_context_load(uint8 *state); 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 unsigned char cdc_reg_r(void); extern unsigned short cdc_host_r(void); diff --git a/core/cd_hw/scd.c b/core/cd_hw/scd.c index c2a1abd..91e7868 100644 --- a/core/cd_hw/scd.c +++ b/core/cd_hw/scd.c @@ -1480,7 +1480,7 @@ void scd_init(void) 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].read8 = bram_read_byte; s68k.memory_map[i].read16 = bram_read_word;