Previous | Next
| From: indi (all posts)
Date: 2001-03-23
Subject: Re: 1551 turbos... how they work?
|
>Sorry no... I have the old "Anatomy of the 1541" book - its all in
>there....
Found this in an earlier message on the list... thought Id repost it...
Mike
I don't know who asked for it, but here is a little C source from Frodo,
it converts 4 bytes to 5 GCR encoded bytes.
/*
* Convert 4 bytes to 5 GCR encoded bytes
*/
const uint16 gcr_table[16] = {
0x0a, 0x0b, 0x12, 0x13, 0x0e, 0x0f, 0x16, 0x17,
0x09, 0x19, 0x1a, 0x1b, 0x0d, 0x1d, 0x1e, 0x15
};
void gcr_conv4(uint8 *from, uint8 *to)
{
uint16 g;
g = (gcr_table[*from >> 4] << 5) | gcr_table[*from & 15];
*to++ = g >> 2;
*to = (g << 6) & 0xc0;
from++;
g = (gcr_table[*from >> 4] << 5) | gcr_table[*from & 15];
*to++ |= (g >> 4) & 0x3f;
*to = (g << 4) & 0xf0;
from++;
g = (gcr_table[*from >> 4] << 5) | gcr_table[*from & 15];
*to++ |= (g >> 6) & 0x0f;
*to = (g << 2) & 0xfc;
from++;
g = (gcr_table[*from >> 4] << 5) | gcr_table[*from & 15];
*to++ |= (g >> 8) & 0x03;
*to = g;
}
|
| |
Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon |