static UInt8 read(RomMapperSunriseIde* rm, UInt16 address) { if (rm->ideEnabled && (address & 0x3e00) == 0x3c00) { if ((address & 1) == 0) { UInt16 value = sunriseIdeRead(rm->ide); rm->readLatch = value >> 8; return value & 0xff; } return rm->readLatch; }
UInt8 sunriseIdeReadRegister(SunriseIde* ide, UInt8 reg) { UInt8 value; if (reg == 14) { reg = 7; } if (ide->softReset) { return 0x7f | (reg == 7 ? 0x80 : 0); } if (reg == 0) { return sunriseIdeRead(ide) & 0xFF; } value = harddiskIdeReadRegister(ide->hdide[ide->currentDevice], reg); if (reg == 6) { value = (value & ~0x10) | (ide->currentDevice << 4); } return value; }