mirror of
https://github.com/holub/mame
synced 2025-05-23 22:20:01 +03:00
AY-3-8910 unused bits in registers read back as 0 [hap]
This commit is contained in:
parent
fc27445a95
commit
0120446c89
@ -868,6 +868,7 @@ void ay8910_write_ym(void *chip, int addr, int data)
|
||||
int ay8910_read_ym(void *chip)
|
||||
{
|
||||
ay8910_context *psg = (ay8910_context *)chip;
|
||||
device_type chip_type = psg->device->type();
|
||||
int r = psg->register_latch;
|
||||
|
||||
if (r > 15) return 0;
|
||||
@ -898,7 +899,21 @@ int ay8910_read_ym(void *chip)
|
||||
logerror("%s: warning - read 8910 '%s' Port B\n",cpuexec_describe_context(psg->device->machine),psg->device->tag());
|
||||
break;
|
||||
}
|
||||
return psg->regs[r];
|
||||
|
||||
/* Depending on chip type, unused bits in registers may or may not be accessible.
|
||||
Untested chips are assumed to regard them as 'ram'
|
||||
Tested and confirmed on hardware:
|
||||
- AY-3-8910: inaccessible bits (see masks below) read back as 0
|
||||
- YM2149: no anomaly
|
||||
*/
|
||||
if (chip_type == AY8910) {
|
||||
const UINT8 mask[0x10]={
|
||||
0xff,0x0f,0xff,0x0f,0xff,0x0f,0x1f,0xff,0x1f,0x1f,0x1f,0xff,0xff,0x0f,0xff,0xff
|
||||
};
|
||||
|
||||
return psg->regs[r] & mask[r];
|
||||
}
|
||||
else return psg->regs[r];
|
||||
}
|
||||
|
||||
/*************************************
|
||||
|
Loading…
Reference in New Issue
Block a user