[Disk] Handle Sector & Sector Size in AddressBlock function (for future D64 support)

This commit is contained in:
LuigiBlood 2019-08-11 11:45:05 +02:00
parent 444a8a6d1a
commit db35bd6518
3 changed files with 5 additions and 7 deletions

View File

@ -261,13 +261,11 @@ void DiskBMUpdate()
void DiskBMRead()
{
DiskBMReadWrite(false);
return;
}
void DiskBMWrite()
{
DiskBMReadWrite(true);
return;
}
void DiskBMReadWrite(bool write)
@ -278,7 +276,7 @@ void DiskBMReadWrite(bool write)
uint16_t sector = dd_current;
uint16_t sectorsize = (((g_Reg->ASIC_HOST_SECBYTE & 0x00FF0000) >> 16) + 1);
uint32_t addr = g_Disk->GetDiskAddressBlock(head, track, block) + (sector * sectorsize);
uint32_t addr = g_Disk->GetDiskAddressBlock(head, track, block, sector, sectorsize);
g_Disk->SetDiskAddressBuffer(addr);
}

View File

@ -392,7 +392,7 @@ void CN64Disk::UnallocateDiskImage()
m_DiskImage = NULL;
}
uint32_t CN64Disk::GetDiskAddressBlock(uint16_t head, uint16_t track, uint16_t block)
uint32_t CN64Disk::GetDiskAddressBlock(uint16_t head, uint16_t track, uint16_t block, uint16_t sector, uint16_t sectorsize)
{
uint32_t offset = 0;
if (m_DiskFormat == DiskFormatMAME)
@ -441,11 +441,11 @@ uint32_t CN64Disk::GetDiskAddressBlock(uint16_t head, uint16_t track, uint16_t b
tr_off = track;
}
offset = MAMEStartOffset[dd_zone] + tr_off * TRACKSIZE(dd_zone) + block * BLOCKSIZE(dd_zone);
offset = MAMEStartOffset[dd_zone] + tr_off * TRACKSIZE(dd_zone) + block * BLOCKSIZE(dd_zone) + sector * sectorsize;
}
else if (m_DiskFormat == DiskFormatSDK)
{
offset = LBAToByte(0, PhysToLBA(head, track, block));
offset = LBAToByte(0, PhysToLBA(head, track, block)) + sector * sectorsize;
}
//WriteTrace(TraceN64System, TraceDebug, "Head %d Track %d Block %d - LBA %d - Address %08X", head, track, block, PhysToLBA(head, track, block), offset);
return offset;

View File

@ -30,7 +30,7 @@ public:
uint8_t * GetDiskAddressSys() { return m_DiskImage; }
uint8_t * GetDiskHeader() { return m_DiskHeader; }
void SetDiskAddressBuffer(uint32_t address) { m_DiskBufAddress = address; }
uint32_t GetDiskAddressBlock(uint16_t head, uint16_t track, uint16_t block);
uint32_t GetDiskAddressBlock(uint16_t head, uint16_t track, uint16_t block, uint16_t sector, uint16_t sectorsize);
stdstr GetRomName() const { return m_RomName; }
stdstr GetFileName() const { return m_FileName; }
stdstr GetDiskIdent() const { return m_DiskIdent; }