bugfixes, cd/Memory.s
[picodrive.git] / Pico / cd / cell_map.c
CommitLineData
fa1e5e29 1
2// 64 x32 x16 x8 x4 x4
3static unsigned int cell_map(int celln)
4{
5 int col, row;
6
7 switch ((celln >> 12) & 7) { // 0-0x8000
8 case 0: // x32 cells
9 case 1:
10 case 2:
11 case 3:
12 col = celln >> 8;
13 row = celln & 0xff;
14 break;
15 case 4: // x16
16 case 5:
17 col = celln >> 7;
18 row = celln & 0x7f;
19 row |= 0x10000 >> 8;
20 break;
21 case 6: // x8
22 col = celln >> 6;
23 row = celln & 0x3f;
24 row |= 0x18000 >> 8;
25 break;
26 case 7: // x4
27 col = celln >> 5;
28 row = celln & 0x1f;
29 row |= (celln & 0x7800) >> 6;
30 break;
4ff2d527 31 default: // never happens, only here to make compiler happy
fa1e5e29 32 col = row = 0;
33 break;
34 }
35
36 return (col & 0x3f) + row*64;
37}
38