X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fcd%2FMisc.c;h=905e919504033953a3418f89141808cd83cbd006;hb=fa1e5e2948e9b06dec3353081081173f7ae4d742;hp=981e71af922100592d1900f29009a371bdd11956;hpb=3a81ecde1cf95372e27a3e6ca6f9c2cccc86e272;p=picodrive.git diff --git a/Pico/cd/Misc.c b/Pico/cd/Misc.c index 981e71a..905e919 100644 --- a/Pico/cd/Misc.c +++ b/Pico/cd/Misc.c @@ -16,3 +16,41 @@ unsigned char formatted_bram[4*0x10] = }; +// offs | 2Mbit | 1Mbit | +// 0 | [ 2M | unused | +// 128K | bit ] | bank0 | +// 256K | unused | bank1 | + +void wram_2M_to_1M(unsigned char *m) +{ + unsigned short *m1M_b0, *m1M_b1; + unsigned int i, tmp, *m2M; + + m2M = (unsigned int *) (m + 0x40000); + m1M_b0 = (unsigned short *) m2M; + m1M_b1 = (unsigned short *) (m + 0x60000); + + for (i = 0x40000/4; i; i--) + { + tmp = *(--m2M); + *(--m1M_b0) = tmp; + *(--m1M_b1) = tmp >> 16; + } +} + +void wram_1M_to_2M(unsigned char *m) +{ + unsigned short *m1M_b0, *m1M_b1; + unsigned int i, tmp, *m2M; + + m2M = (unsigned int *) m; + m1M_b0 = (unsigned short *) (m + 0x20000); + m1M_b1 = (unsigned short *) (m + 0x40000); + + for (i = 0x40000/4; i; i--) + { + tmp = *m1M_b0++ | (*m1M_b1++ << 16); + *m2M++ = tmp; + } +} +