Inlined some of the drive functions.

This commit is contained in:
Stephen White 2018-06-03 17:45:17 +10:00
parent f1623f64c6
commit 457cbafade
2 changed files with 29 additions and 33 deletions

View File

@ -386,35 +386,6 @@ void Drive::OnPortOut(void* pThis, unsigned char status)
pDrive->LED = (status & 8) != 0; pDrive->LED = (status & 8) != 0;
} }
u32 Drive::AdvanceSectorPositionR(int& byteOffset)
{
++headBitOffset %= bitsInTrack;
byteOffset = headBitOffset >> 3;
return (~headBitOffset) & 7;
}
u32 Drive::AdvanceSectorPositionW(int& byteOffset)
{
byteOffset = headBitOffset >> 3;
u32 bit = (~headBitOffset) & 7;
++headBitOffset %= bitsInTrack;
return bit;
}
bool Drive::GetNextBit()
{
int byteOffset;
int bit = AdvanceSectorPositionR(byteOffset);
return diskImage->GetNextBit(headTrackPos, byteOffset, bit);
}
void Drive::SetNextBit(bool value)
{
int byteOffset;
int bit = AdvanceSectorPositionW(byteOffset);
diskImage->SetBit(headTrackPos, byteOffset, bit, value);
}
bool Drive::Update() bool Drive::Update()
{ {
bool dataReady = false; bool dataReady = false;

View File

@ -88,10 +88,35 @@ private:
void DumpTrack(unsigned track); // Used for debugging disk images. void DumpTrack(unsigned track); // Used for debugging disk images.
u32 AdvanceSectorPositionR(int& byte_offset); // No reason why I seperate these into individual read and write versions. I was just trying to get the bit stream to line up when rewriting over existing data. // No reason why I seperate these into individual read and write versions. I was just trying to get the bit stream to line up when rewriting over existing data.
u32 AdvanceSectorPositionW(int& byte_offset); inline u32 AdvanceSectorPositionR(int& byteOffset)
bool GetNextBit(); {
void SetNextBit(bool value); ++headBitOffset %= bitsInTrack;
byteOffset = headBitOffset >> 3;
return (~headBitOffset) & 7;
}
inline u32 AdvanceSectorPositionW(int& byteOffset)
{
byteOffset = headBitOffset >> 3;
u32 bit = (~headBitOffset) & 7;
++headBitOffset %= bitsInTrack;
return bit;
}
inline bool GetNextBit()
{
int byteOffset;
int bit = AdvanceSectorPositionR(byteOffset);
return diskImage->GetNextBit(headTrackPos, byteOffset, bit);
}
inline void SetNextBit(bool value)
{
int byteOffset;
int bit = AdvanceSectorPositionW(byteOffset);
diskImage->SetBit(headTrackPos, byteOffset, bit, value);
}
DiskImage* diskImage; DiskImage* diskImage;
// When swapping disks some code waits for the write protect signal to go high which will happen if a human ejects a disk. // When swapping disks some code waits for the write protect signal to go high which will happen if a human ejects a disk.