X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fcd%2Fcell_map.c;fp=Pico%2Fcd%2Fcell_map.c;h=5358a090cc216f53f7fca62c5aa7bf8ee4839301;hb=fa1e5e2948e9b06dec3353081081173f7ae4d742;hp=0000000000000000000000000000000000000000;hpb=3a81ecde1cf95372e27a3e6ca6f9c2cccc86e272;p=picodrive.git diff --git a/Pico/cd/cell_map.c b/Pico/cd/cell_map.c new file mode 100644 index 0000000..5358a09 --- /dev/null +++ b/Pico/cd/cell_map.c @@ -0,0 +1,38 @@ + +// 64 x32 x16 x8 x4 x4 +static unsigned int cell_map(int celln) +{ + int col, row; + + switch ((celln >> 12) & 7) { // 0-0x8000 + case 0: // x32 cells + case 1: + case 2: + case 3: + col = celln >> 8; + row = celln & 0xff; + break; + case 4: // x16 + case 5: + col = celln >> 7; + row = celln & 0x7f; + row |= 0x10000 >> 8; + break; + case 6: // x8 + col = celln >> 6; + row = celln & 0x3f; + row |= 0x18000 >> 8; + break; + case 7: // x4 + col = celln >> 5; + row = celln & 0x1f; + row |= (celln & 0x7800) >> 6; + break; + default: // just to make compiler happy + col = row = 0; + break; + } + + return (col & 0x3f) + row*64; +} +