memory composition, part 3

This commit is contained in:
tildearrow 2024-03-05 18:55:18 -05:00
parent a200d464a6
commit 92ec6f6651
36 changed files with 190 additions and 9 deletions

View file

@ -595,11 +595,19 @@ bool DivPlatformC140::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample];
}
const DivMemoryComposition* DivPlatformC140::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformC140::renderSamples(int sysID) {
memset(sampleMem,0,is219?524288:16777216);
memset(sampleOff,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample ROM";
size_t memPos=0;
for (int i=0; i<parent->song.sampleLen; i++) {
DivSample* s=parent->song.sample[i];
@ -658,6 +666,7 @@ void DivPlatformC140::renderSamples(int sysID) {
}
sampleOff[i]=memPos>>1;
sampleLoaded[i]=true;
memCompo.entries.push_back(DivMemoryEntry((DivMemoryEntryType)(DIV_MEMORY_BANK0+((memPos>>17)&3)),"Sample",i,memPos,memPos+length));
memPos+=length;
} else { // C140 (16-bit)
unsigned int length=s->length16+4;
@ -704,10 +713,14 @@ void DivPlatformC140::renderSamples(int sysID) {
}
sampleOff[i]=memPos>>1;
sampleLoaded[i]=true;
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+length));
memPos+=length;
}
}
sampleMemLen=memPos+256;
memCompo.used=sampleMemLen;
memCompo.capacity=getSampleMemCapacity(0);
}
void DivPlatformC140::set219(bool is_219) {