Overhauled and unified CD-ROM emulation;

Four CD-ROM drives are now emulated;
ATAPI DMA is now emulated;
Unified CD-ROM pass through to host drive handling;
Applied all (applicable) mainline PCem commits.
This commit is contained in:
OBattler
2017-01-16 01:49:19 +01:00
parent 0a11edd343
commit 4f7fd84229
41 changed files with 5953 additions and 5129 deletions

View File

@@ -565,34 +565,39 @@ int dma_channel_write(int channel, uint16_t val)
return 0;
}
#if 0
static uint32_t PageLengthReadWrite(uint32_t PhysAddress, uint32_t TotalSize)
{
uint32_t LengthSize;
uint32_t Page;
Page = PhysAddress & 4095;
LengthSize = (Page + 4096) - PhysAddress;
if (LengthSize > TotalSize)
LengthSize = TotalSize;
return LengthSize;
if ((Page + TotalSize - 1) >= 4096)
{
TotalSize = 4096 - Page;
}
return TotalSize;
}
#endif
//DMA Bus Master Page Read/Write
void DMAPageRead(uint32_t PhysAddress, void *DataRead, uint32_t TotalSize)
{
uint32_t PageLen = PageLengthReadWrite(PhysAddress, TotalSize);
memcpy(DataRead, &ram[PhysAddress], PageLen);
DataRead -= PageLen;
TotalSize += PageLen;
// uint32_t PageLen = PageLengthReadWrite(PhysAddress, TotalSize);
memcpy(DataRead, &ram[PhysAddress], TotalSize);
// DataRead -= PageLen;
DataRead -= TotalSize;
}
void DMAPageWrite(uint32_t PhysAddress, const void *DataWrite, uint32_t TotalSize)
{
uint32_t PageLen = PageLengthReadWrite(PhysAddress, TotalSize);
memcpy(&ram[PhysAddress], DataWrite, PageLen);
DataWrite -= PageLen;
TotalSize += PageLen;
// uint32_t PageLen = PageLengthReadWrite(PhysAddress, TotalSize);
memcpy(&ram[PhysAddress], DataWrite, TotalSize);
mem_invalidate_range(PhysAddress, PhysAddress + TotalSize - 1);
// DataWrite -= PageLen;
DataWrite -= TotalSize;
}
int dma_mode(int channel)