platform ps2, handle audio similar to psp
[picodrive.git] / pico / cd / cell_map.c
CommitLineData
cff531af 1/*
2 * Convert "cell arrange" address to normal address.
3 * (C) notaz, 2008
4 *
5 * This work is licensed under the terms of MAME license.
6 * See COPYING file in the top-level directory.
7 */
fa1e5e29 8
9// 64 x32 x16 x8 x4 x4
10static unsigned int cell_map(int celln)
11{
12 int col, row;
13
14 switch ((celln >> 12) & 7) { // 0-0x8000
15 case 0: // x32 cells
16 case 1:
17 case 2:
18 case 3:
19 col = celln >> 8;
20 row = celln & 0xff;
21 break;
22 case 4: // x16
23 case 5:
24 col = celln >> 7;
25 row = celln & 0x7f;
26 row |= 0x10000 >> 8;
27 break;
28 case 6: // x8
29 col = celln >> 6;
30 row = celln & 0x3f;
31 row |= 0x18000 >> 8;
32 break;
33 case 7: // x4
34 col = celln >> 5;
35 row = celln & 0x1f;
36 row |= (celln & 0x7800) >> 6;
37 break;
4ff2d527 38 default: // never happens, only here to make compiler happy
fa1e5e29 39 col = row = 0;
40 break;
41 }
42
43 return (col & 0x3f) + row*64;
44}
45