Slight ESCC cleanup

This commit is contained in:
dingusdev 2020-12-18 18:50:26 -07:00
parent b970a8d253
commit 457d7d34b8
3 changed files with 29 additions and 30 deletions

View File

@ -30,35 +30,32 @@ ESCC::ESCC() {}
ESCC::~ESCC() {}
uint8_t ESCC::escc_read(uint32_t offset, int size) {
uint8_t ESCC::escc_read(bool is_legacy, uint32_t offset, int size) {
return 0;
}
void ESCC::escc_write(uint32_t offset, uint8_t value, int size) {
if (offset == 0x20) {
if (!prep_value) {
store_reg = value & 0xF;
prep_value = true;
}
else {
escc_reg[store_reg] = value;
prep_value = false;
void ESCC::escc_write(bool is_legacy, uint32_t offset, uint8_t value, int size) {
if (is_legacy) {
if (offset == 0x02) {
if (!prep_value) {
store_reg = value & 0xF;
prep_value = true;
} else {
escc_reg[store_reg] = value;
prep_value = false;
}
}
}
}
uint8_t ESCC::escc_legacy_read(uint32_t offset, int size) {
return 0;
}
void ESCC::escc_legacy_write(uint32_t offset, uint8_t value, int size) {
if (offset == 0x0) {
if (!prep_value) {
store_reg = value & 0xF;
prep_value = true;
} else {
escc_reg[store_reg] = value;
prep_value = false;
}
else {
if (offset == 0x20) {
if (!prep_value) {
store_reg = value & 0xF;
prep_value = true;
} else {
escc_reg[store_reg] = value;
prep_value = false;
}
}
}
}

View File

@ -24,17 +24,19 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <cinttypes>
enum {
NOT_LEGACY_ESCC = 0,
LEGACY_ESCC = 1
};
class ESCC {
public:
ESCC();
~ESCC();
//protected:
uint8_t escc_read(uint32_t offset, int size);
void escc_write(uint32_t offset, uint8_t value, int size);
uint8_t escc_legacy_read(uint32_t offset, int size);
void escc_legacy_write(uint32_t offset, uint8_t value, int size);
uint8_t escc_read(bool is_legacy, uint32_t offset, int size);
void escc_write(bool is_legacy, uint32_t offset, uint8_t value, int size);
private:
uint8_t escc_reg[16];

View File

@ -188,7 +188,7 @@ void HeathrowIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int
LOG_F(WARNING, "LEGACY ESCC Write - Offset: %x; Value: %x; Size: %x\n", offset, value, size);
break;
case 0x13:
this->escc->escc_write((offset - 0x13000), value, size);
this->escc->escc_write(false, (offset - 0x13000), value, size);
break;
case 0x14:
this->screamer->snd_ctrl_write(offset - 0x14000, value, size);