aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Millstone2007-04-06 18:35:35 +0000
committerNeil Millstone2007-04-06 18:35:35 +0000
commitdca464b06e77c8cd26c14d421f8f1f1a2f6cadda (patch)
tree564b3590bd4a1884cf1e7b7b80bbf6248be657c1
parentc6d41c07558eb74a18e88b3fc68c5ec76bb3f9fe (diff)
downloadscummvm-rg350-dca464b06e77c8cd26c14d421f8f1f1a2f6cadda.tar.gz
scummvm-rg350-dca464b06e77c8cd26c14d421f8f1f1a2f6cadda.tar.bz2
scummvm-rg350-dca464b06e77c8cd26c14d421f8f1f1a2f6cadda.zip
Changes to CPU local ram allocation for DS port
svn-id: r26395
-rw-r--r--sound/fmopl.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/sound/fmopl.cpp b/sound/fmopl.cpp
index b70f684078..18383f27e0 100644
--- a/sound/fmopl.cpp
+++ b/sound/fmopl.cpp
@@ -62,7 +62,8 @@ static Common::RandomSource oplRnd; /* OPL random number generator */
/* sinwave entries */
/* used static memory = SIN_ENT * 4 (byte) */
#ifdef __DS__
-#define SIN_ENT 1024
+#include "dsmain.h"
+#define SIN_ENT 256
#else
#define SIN_ENT 2048
#endif
@@ -638,14 +639,17 @@ static int OPLOpenTable(void) {
ENV_CURVE = (int *)calloc(2 * 4096 + 1, sizeof(int));
#endif
+#ifdef __DS__
+ DS::fastRamReset();
+
+ TL_TABLE = (int *) DS::fastRamAlloc(TL_MAX * 2 * sizeof(int *));
+ SIN_TABLE = (int **) DS::fastRamAlloc(SIN_ENT * 4 * sizeof(int *));
+#else
+
/* allocate dynamic tables */
if((TL_TABLE = (int *)malloc(TL_MAX * 2 * sizeof(int))) == NULL)
return 0;
-#ifdef __DS__
- // On the DS, use fast RAM for the sine table, since it thrashes the cache otherwise
- SIN_TABLE = ((int **) (0x37F8000));
-#else
if((SIN_TABLE = (int **)malloc(SIN_ENT * 4 * sizeof(int *))) == NULL) {
free(TL_TABLE);
return 0;
@@ -657,6 +661,7 @@ static int OPLOpenTable(void) {
free(SIN_TABLE);
return 0;
}
+
if((VIB_TABLE = (int *)malloc(VIB_ENT * 2 * sizeof(int))) == NULL) {
free(TL_TABLE);
free(SIN_TABLE);
@@ -996,6 +1001,7 @@ void YM3812UpdateOne(FM_OPL *OPL, int16 *buffer, int length) {
uint8 rythm = OPL->rythm & 0x20;
OPL_CH *CH, *R_CH;
+
if((void *)OPL != cur_chip) {
cur_chip = (void *)OPL;
/* channel pointers */