giz rc1 release
[picodrive.git] / Pico / cd / Misc.c
... / ...
CommitLineData
1// Some misc stuff
2// (c) Copyright 2007, Grazvydas "notaz" Ignotas
3
4#include "../PicoInt.h"
5
6unsigned char formatted_bram[4*0x10] =
7{
8#if 0
9 0x00, 0xd4, 0x63, 0x00, 0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x03, 0x00, 0x03, 0x00, 0x00, 0x03,
10 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x53, 0xd2, 0xf5, 0x3a, 0x48, 0x50, 0x35, 0x0f,
11 0x47, 0x14, 0xf5, 0x7e, 0x5c, 0xd4, 0xf3, 0x03, 0x00, 0x03, 0x12, 0x00, 0x0a, 0xff, 0xca, 0xa6,
12 0xf5, 0x27, 0xed, 0x22, 0x47, 0xfa, 0x22, 0x96, 0x6c, 0xa5, 0x88, 0x14, 0x48, 0x48, 0x0a, 0xbb,
13#endif
14 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x40,
15 0x00, 0x7d, 0x00, 0x7d, 0x00, 0x7d, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16 0x53, 0x45, 0x47, 0x41, 0x5f, 0x43, 0x44, 0x5f, 0x52, 0x4f, 0x4d, 0x00, 0x01, 0x00, 0x00, 0x00,
17 0x52, 0x41, 0x4d, 0x5f, 0x43, 0x41, 0x52, 0x54, 0x52, 0x49, 0x44, 0x47, 0x45, 0x5f, 0x5f, 0x5f,
18 // SEGA_CD_ROM.....RAM_CARTRIDGE___
19};
20
21
22// offs | 2Mbit | 1Mbit |
23// 0 | [ 2M | unused |
24// 128K | bit ] | bank0 |
25// 256K | unused | bank1 |
26
27#ifndef _ASM_MISC_C
28PICO_INTERNAL_ASM void wram_2M_to_1M(unsigned char *m)
29{
30 unsigned short *m1M_b0, *m1M_b1;
31 unsigned int i, tmp, *m2M;
32
33 m2M = (unsigned int *) (m + 0x40000);
34 m1M_b0 = (unsigned short *) m2M;
35 m1M_b1 = (unsigned short *) (m + 0x60000);
36
37 for (i = 0x40000/4; i; i--)
38 {
39 tmp = *(--m2M);
40 *(--m1M_b0) = tmp;
41 *(--m1M_b1) = tmp >> 16;
42 }
43}
44
45PICO_INTERNAL_ASM void wram_1M_to_2M(unsigned char *m)
46{
47 unsigned short *m1M_b0, *m1M_b1;
48 unsigned int i, tmp, *m2M;
49
50 m2M = (unsigned int *) m;
51 m1M_b0 = (unsigned short *) (m + 0x20000);
52 m1M_b1 = (unsigned short *) (m + 0x40000);
53
54 for (i = 0x40000/4; i; i--)
55 {
56 tmp = *m1M_b0++ | (*m1M_b1++ << 16);
57 *m2M++ = tmp;
58 }
59}
60#endif
61