mirror of
https://github.com/wavemotion-dave/NINTV-DS.git
synced 2025-06-18 13:55:33 -04:00
Version 4.6a with another 5% speedup on games that scroll (AD&D, TNT Cowboy, Space Spartans, etc). This is a big improvement for the DS-Lite/Phat.
This commit is contained in:
parent
4e6f3f073b
commit
05a44ef3de
2
Makefile
2
Makefile
@ -14,7 +14,7 @@ include $(DEVKITARM)/ds_rules
|
||||
|
||||
export TARGET := NINTV-DS
|
||||
export TOPDIR := $(CURDIR)
|
||||
export VERSION := 4.6
|
||||
export VERSION := 4.6a
|
||||
|
||||
ICON := -b $(CURDIR)/logo.bmp "NINTV-DS $(VERSION);wavemotion-dave;https://github.com/wavemotion-dave/NINTV-DS"
|
||||
|
||||
|
BIN
NINTV-DS.nds
BIN
NINTV-DS.nds
Binary file not shown.
@ -148,7 +148,7 @@ void AY38900::resetProcessor()
|
||||
mobs[i].reset();
|
||||
|
||||
//reset the state variables
|
||||
mode = -1;
|
||||
mode = 0xFF;
|
||||
bCP1610_PIN_IN_INTRM = TRUE;
|
||||
bCP1610_PIN_IN_BUSRQ = TRUE;
|
||||
previousDisplayEnabled = TRUE;
|
||||
@ -989,7 +989,7 @@ ITCM_CODE void AY38900::copyBackgroundBufferToStagingArea()
|
||||
short int sourceHeightY = blockTop ? 88 : (96-verticalOffset);
|
||||
short int myHoriz = (blockLeft ? (8 - horizontalOffset) : 0);
|
||||
short int myVert = (blockTop ? (8 - verticalOffset) : 0);
|
||||
short int nextSourcePixel = myHoriz + (myVert * 160);
|
||||
short int nextSourcePixel = myHoriz + (myVert * 160);
|
||||
|
||||
for (int y = 0; y < sourceHeightY; y++)
|
||||
{
|
||||
@ -998,17 +998,31 @@ ITCM_CODE void AY38900::copyBackgroundBufferToStagingArea()
|
||||
|
||||
if (blockTop) nextPixelStore0 += (PIXEL_BUFFER_ROW_SIZE*8);
|
||||
else if (verticalOffset) nextPixelStore0 += (PIXEL_BUFFER_ROW_SIZE*(verticalOffset*2));
|
||||
|
||||
|
||||
if (blockLeft) nextPixelStore0 += 4;
|
||||
else if (horizontalOffset) nextPixelStore0 += horizontalOffset;
|
||||
|
||||
|
||||
UINT8* nextPixelStore1 = nextPixelStore0 + PIXEL_BUFFER_ROW_SIZE;
|
||||
for (int x = 0; x < sourceWidthX; x++)
|
||||
|
||||
// If we are starting on an odd pixel, do that one first and then we can blast 16-bits at a time for speedup
|
||||
if (nextSourcePixel & 1)
|
||||
{
|
||||
UINT8 nextColor = backgroundBuffer[nextSourcePixel+x];
|
||||
UINT8 nextColor = backgroundBuffer[nextSourcePixel];
|
||||
*nextPixelStore0++ = nextColor;
|
||||
*nextPixelStore1++ = nextColor;
|
||||
}
|
||||
|
||||
|
||||
UINT16 *ptr = (UINT16*) &backgroundBuffer[nextSourcePixel];
|
||||
UINT16 *pix0 = (UINT16*) nextPixelStore0;
|
||||
UINT16 *pix1 = (UINT16*) nextPixelStore1;
|
||||
for (int x = 0; x < (sourceWidthX>>1); x++)
|
||||
{
|
||||
UINT16 nextColor = *ptr++;
|
||||
*pix0++ = nextColor;
|
||||
*pix1++ = nextColor;
|
||||
}
|
||||
|
||||
nextSourcePixel += 160;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ TYPEDEF_STRUCT_PACK( _AY38900State
|
||||
MOBState mobs[8];
|
||||
INT8 horizontalOffset;
|
||||
INT8 verticalOffset;
|
||||
INT8 mode;
|
||||
UINT8 mode;
|
||||
UINT16 registers[0x40];
|
||||
INT8 inVBlank;
|
||||
INT8 previousDisplayEnabled;
|
||||
@ -127,7 +127,7 @@ public:
|
||||
|
||||
//state info
|
||||
UINT8 inVBlank;
|
||||
INT8 mode;
|
||||
UINT8 mode;
|
||||
UINT8 previousDisplayEnabled;
|
||||
UINT8 displayEnabled;
|
||||
UINT8 colorStackMode;
|
||||
|
@ -22,11 +22,9 @@ UINT16 amplitudes16Bit[16] __attribute__((section(".dtcm"))) =
|
||||
// ----------------------------------------------------------------
|
||||
// These are common no matter whether we have 1 PSG or 2 (for ECS)
|
||||
// ----------------------------------------------------------------
|
||||
INT32 clockDivisor __attribute__((section(".dtcm")));
|
||||
INT32 clocksPerSample __attribute__((section(".dtcm")));
|
||||
|
||||
INT32 cachedTotalOutput __attribute__((section(".dtcm")));
|
||||
|
||||
INT32 clockDivisor __attribute__((section(".dtcm")));
|
||||
INT32 clocksPerSample __attribute__((section(".dtcm")));
|
||||
INT32 cachedTotalOutput __attribute__((section(".dtcm")));
|
||||
|
||||
extern UINT8 bUseIVoice;
|
||||
|
||||
@ -124,7 +122,7 @@ ITCM_CODE INT32 AY38914::tick(INT32 minimum)
|
||||
if (!envelopeIdle)
|
||||
{
|
||||
envelopeVolume += (envelopeAtak ? 1 : -1);
|
||||
if (envelopeVolume > 15 || envelopeVolume < 0)
|
||||
if (envelopeVolume & 0xFFFFFFF0)
|
||||
{
|
||||
if (!envelopeCont) {
|
||||
envelopeVolume = 0;
|
||||
@ -159,7 +157,7 @@ ITCM_CODE INT32 AY38914::tick(INT32 minimum)
|
||||
while (channel0.toneCounter <= 0)
|
||||
{
|
||||
channel0.toneCounter += channel0.periodValue;
|
||||
channel0.tone = !channel0.tone;
|
||||
channel0.tone ^= 1;
|
||||
}
|
||||
|
||||
//iterate the tone generator for channel 1
|
||||
@ -167,7 +165,7 @@ ITCM_CODE INT32 AY38914::tick(INT32 minimum)
|
||||
while (channel1.toneCounter <= 0)
|
||||
{
|
||||
channel1.toneCounter += channel1.periodValue;
|
||||
channel1.tone = !channel1.tone;
|
||||
channel1.tone ^= 1;
|
||||
}
|
||||
|
||||
//iterate the tone generator for channel 2
|
||||
@ -175,7 +173,7 @@ ITCM_CODE INT32 AY38914::tick(INT32 minimum)
|
||||
while (channel2.toneCounter <= 0)
|
||||
{
|
||||
channel2.toneCounter += channel2.periodValue;
|
||||
channel2.tone = !channel2.tone;
|
||||
channel2.tone ^= 1;
|
||||
}
|
||||
|
||||
cachedTotalOutput = amplitudes16Bit[(((channel0.toneDisabled | channel0.tone) & (channel0.noiseDisabled | noise)) ? (channel0.envelope ? envelopeVolume : channel0.volume) : 0)];
|
||||
@ -183,13 +181,13 @@ ITCM_CODE INT32 AY38914::tick(INT32 minimum)
|
||||
cachedTotalOutput += amplitudes16Bit[(((channel2.toneDisabled | channel2.tone) & (channel2.noiseDisabled | noise)) ? (channel2.envelope ? envelopeVolume : channel2.volume) : 0)];
|
||||
|
||||
// Now place the sample onto the audio output line...
|
||||
if (this->location == 0xF0)
|
||||
if (this->location & 0x100)
|
||||
{
|
||||
playSample1(cachedTotalOutput); // This is the ECS PSG on channel 1
|
||||
playSample0(cachedTotalOutput); // This is the normal Intellivision console PSG
|
||||
}
|
||||
else
|
||||
{
|
||||
playSample0(cachedTotalOutput); // This is the normal Intellivision console PSG
|
||||
playSample1(cachedTotalOutput); // This is the ECS PSG on channel 1
|
||||
}
|
||||
|
||||
totalTicks += clocksPerSample;
|
||||
|
@ -25,12 +25,12 @@
|
||||
// amount of NDS CPU so we try to make this as efficient as possible. Lots of ITCM and DTCM
|
||||
// memory usage here to squeeze out the best performance...
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
UINT16 audio_mixer_buffer[256] __attribute__((section(".dtcm")));
|
||||
UINT16 currentSampleIdx16 __attribute__((section(".dtcm"))) = 0;
|
||||
UINT8 currentSampleIdx8 __attribute__((section(".dtcm"))) = 0;
|
||||
UINT32 commonClocksPerTick __attribute__((section(".dtcm"))) = 0;
|
||||
extern UINT64 lcm(UINT64, UINT64);
|
||||
UINT16 audio_mixer_buffer[256] __attribute__((section(".dtcm"))) = {0};
|
||||
UINT16 currentSampleIdx16 __attribute__((section(".dtcm"))) = 0;
|
||||
UINT8 currentSampleIdx8 __attribute__((section(".dtcm"))) = 0;
|
||||
UINT32 commonClocksPerTick __attribute__((section(".dtcm"))) = 0;
|
||||
|
||||
extern UINT64 lcm(UINT64, UINT64);
|
||||
|
||||
AudioMixer::AudioMixer()
|
||||
: Processor("Audio Mixer"),
|
||||
@ -128,7 +128,7 @@ ITCM_CODE INT32 AudioMixer::tick(INT32 minimum)
|
||||
for (INT32 totalTicks = 0; totalTicks < minimum; totalTicks++)
|
||||
{
|
||||
//mix and flush the sample buffers
|
||||
for (UINT32 i = 0; i < soundChannelsToProcess; i++)
|
||||
for (UINT16 i = 0; i < soundChannelsToProcess; i++)
|
||||
{
|
||||
INT32 missingClocks = (commonClocksPerTick - commonClockCounter[i]);
|
||||
INT32 sampleToUse = (missingClocks < 0 ? previousSample[i] : currentSample[i]);
|
||||
@ -151,10 +151,10 @@ ITCM_CODE INT32 AudioMixer::tick(INT32 minimum)
|
||||
sampleBuffer[i] = -partialSample;
|
||||
commonClockCounter[i] = -missingClocks;
|
||||
}
|
||||
|
||||
if (totalSample > 0x7FFF) totalSample = 0x7FFF; // With Intellivoice or ECS extra sound channels, there are 2 or 3 audio producers... so we need to clip/cap the sound
|
||||
}
|
||||
|
||||
if (totalSample > 0x7FFF) totalSample = 0x7FFF; // With Intellivoice or ECS extra sound channels, there are 2 or 3 audio producers... so we need to clip/cap the sound
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// If we are DSi mode, we will have exactly 256 samples per frame. It's worth checking for that
|
||||
// and then we can use a UINT8 variable which doesn't need to be masked/checked as it will auto
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "Intellivision.h"
|
||||
#include "../overlay.h"
|
||||
|
||||
const UINT16 HandController::BUTTON_OUTPUT_VALUES[15] = {
|
||||
const UINT8 HandController::BUTTON_OUTPUT_VALUES[15] = {
|
||||
0x81, //OUTPUT_KEYPAD_ONE
|
||||
0x41, //OUTPUT_KEYPAD_TWO
|
||||
0x21, //OUTPUT_KEYPAD_THREE
|
||||
@ -32,7 +32,7 @@ const UINT16 HandController::BUTTON_OUTPUT_VALUES[15] = {
|
||||
0xC0 //OUTPUT_ACTION_BUTTON_BOTTOM_RIGHT
|
||||
};
|
||||
|
||||
const UINT16 HandController::DIRECTION_OUTPUT_VALUES[16] = {
|
||||
const UINT8 HandController::DIRECTION_OUTPUT_VALUES[16] = {
|
||||
0x04, //OUTPUT_DISC_NORTH
|
||||
0x14, //OUTPUT_DISC_NORTH_NORTH_EAST
|
||||
0x16, //OUTPUT_DISC_NORTH_EAST
|
||||
|
@ -45,9 +45,8 @@ class HandController : public AY38914_InputOutput, public InputConsumer
|
||||
|
||||
UINT16 inputValue;
|
||||
|
||||
static const UINT16 BUTTON_OUTPUT_VALUES[15];
|
||||
static const UINT16 DIRECTION_OUTPUT_VALUES[16];
|
||||
|
||||
static const UINT8 BUTTON_OUTPUT_VALUES[15];
|
||||
static const UINT8 DIRECTION_OUTPUT_VALUES[16];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user