// convert the 256 8-bit bytes into 342 6-bit bytes
// argument nSector is Logical Sector.(by dos order)
void CDiskImageDos::Code62(int nSector)
{
	int i;
	{
		BYTE* pbyPage = m_abyDosBuffer + ( nSector << 8 );
		BYTE offset = 0xAC;
		i = 0;
		while ( offset != 0x02 )
		{
			BYTE value = 0;
#define ADDVALUE(a)		\
			value = (value << 2 ) | (((a) & 0x01) << 1 ) | (((a) & 0x02) >> 1)
			ADDVALUE(pbyPage[offset]);	offset -= 0x56;
			ADDVALUE(pbyPage[offset]);	offset -= 0x56;
			ADDVALUE(pbyPage[offset]);	offset -= 0x53;
#undef ADDVALUE
			m_abyGcrBuffer[i++] = value << 2;
		}
		// i = 256 / 3 = 86 ( last 2 byte is only 4 bit )
		// clear off higher 2 bits of the last 2 byte
		m_abyGcrBuffer[84] &= 0x3F;
		m_abyGcrBuffer[85] &= 0x3F;
		memcpy( m_abyGcrBuffer + 86, pbyPage, 256 );
		m_abyGcrBuffer[342] = 0;
	}
	// exclusive-or the entire data block with itself offset by one byte
	{
		i = 342;
		while( i-- )
			m_abyGcrBuffer[i+1] ^= m_abyGcrBuffer[i];
	}

	{
		for( i = 0; i < 343; i++ )
			WriteNibble( sm_abyGcrEncTable[ m_abyGcrBuffer[i] >> 2 ] );
	}
}
Beispiel #2
0
int GmMemoryOutStream::AddByte8 (const byte8 & value)
{
	ADDVALUE (byte8, value, Byte8ToChars);
}
Beispiel #3
0
int GmMemoryOutStream::AddByte2 (const byte2 & value)
{
	ADDVALUE (byte2, value, Byte2ToChars);
}
Beispiel #4
0
int GmMemoryOutStream::AddByte4 (const byte4 & value)
{
	ADDVALUE (byte4, value, Byte4ToChars);
}