deal with some strict aliasing issues
[picodrive.git] / pico / cd / misc.c
CommitLineData
cff531af 1/*
2 * PicoDrive
3 * (C) notaz, 2007
4 *
5 * This work is licensed under the terms of MAME license.
6 * See COPYING file in the top-level directory.
7 */
51a902ae 8
efcba75f 9#include "../pico_int.h"
51a902ae 10
76276b0b 11unsigned char formatted_bram[4*0x10] =
51a902ae 12{
76276b0b 13#if 0
51a902ae 14 0x00, 0xd4, 0x63, 0x00, 0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x03, 0x00, 0x03, 0x00, 0x00, 0x03,
15 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x53, 0xd2, 0xf5, 0x3a, 0x48, 0x50, 0x35, 0x0f,
16 0x47, 0x14, 0xf5, 0x7e, 0x5c, 0xd4, 0xf3, 0x03, 0x00, 0x03, 0x12, 0x00, 0x0a, 0xff, 0xca, 0xa6,
17 0xf5, 0x27, 0xed, 0x22, 0x47, 0xfa, 0x22, 0x96, 0x6c, 0xa5, 0x88, 0x14, 0x48, 0x48, 0x0a, 0xbb,
76276b0b 18#endif
51a902ae 19 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x40,
20 0x00, 0x7d, 0x00, 0x7d, 0x00, 0x7d, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
21 0x53, 0x45, 0x47, 0x41, 0x5f, 0x43, 0x44, 0x5f, 0x52, 0x4f, 0x4d, 0x00, 0x01, 0x00, 0x00, 0x00,
22 0x52, 0x41, 0x4d, 0x5f, 0x43, 0x41, 0x52, 0x54, 0x52, 0x49, 0x44, 0x47, 0x45, 0x5f, 0x5f, 0x5f,
76276b0b 23 // SEGA_CD_ROM.....RAM_CARTRIDGE___
51a902ae 24};
25
26
fa1e5e29 27// offs | 2Mbit | 1Mbit |
28// 0 | [ 2M | unused |
29// 128K | bit ] | bank0 |
30// 256K | unused | bank1 |
31
6cadc2da 32#ifndef _ASM_MISC_C
eff55556 33PICO_INTERNAL_ASM void wram_2M_to_1M(unsigned char *m)
fa1e5e29 34{
35 unsigned short *m1M_b0, *m1M_b1;
36 unsigned int i, tmp, *m2M;
37
38 m2M = (unsigned int *) (m + 0x40000);
39 m1M_b0 = (unsigned short *) m2M;
40 m1M_b1 = (unsigned short *) (m + 0x60000);
41
42 for (i = 0x40000/4; i; i--)
43 {
44 tmp = *(--m2M);
45 *(--m1M_b0) = tmp;
46 *(--m1M_b1) = tmp >> 16;
47 }
48}
49
eff55556 50PICO_INTERNAL_ASM void wram_1M_to_2M(unsigned char *m)
fa1e5e29 51{
52 unsigned short *m1M_b0, *m1M_b1;
53 unsigned int i, tmp, *m2M;
54
55 m2M = (unsigned int *) m;
56 m1M_b0 = (unsigned short *) (m + 0x20000);
57 m1M_b1 = (unsigned short *) (m + 0x40000);
58
59 for (i = 0x40000/4; i; i--)
60 {
61 tmp = *m1M_b0++ | (*m1M_b1++ << 16);
62 *m2M++ = tmp;
63 }
64}
6cadc2da 65#endif
fa1e5e29 66