mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-26 19:17:52 +00:00
Made a first attempt at D64 support. Made an error somewhere but this should be 90% of it.
This commit is contained in:
@@ -49,3 +49,19 @@ unsigned int Storage::Encodings::CommodoreGCR::encoding_for_byte(uint8_t byte)
|
||||
{
|
||||
return encoding_for_nibble(byte) | (encoding_for_nibble(byte >> 4) << 5);
|
||||
}
|
||||
|
||||
void Storage::Encodings::CommodoreGCR::encode_block(uint8_t *destination, uint8_t *source)
|
||||
{
|
||||
unsigned int encoded_bytes[4] = {
|
||||
encoding_for_byte(source[0]),
|
||||
encoding_for_byte(source[1]),
|
||||
encoding_for_byte(source[2]),
|
||||
encoding_for_byte(source[3]),
|
||||
};
|
||||
|
||||
destination[0] = (uint8_t)(encoded_bytes[0] >> 2);
|
||||
destination[1] = (uint8_t)((encoded_bytes[0] << 6) | (encoded_bytes[1] >> 4));
|
||||
destination[2] = (uint8_t)((encoded_bytes[1] << 4) | (encoded_bytes[2] >> 6));
|
||||
destination[3] = (uint8_t)((encoded_bytes[2] << 2) | (encoded_bytes[3] >> 8));
|
||||
destination[4] = (uint8_t)(encoded_bytes[3]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user