Skip to content

Commit

Permalink
Version 3.8 - more speed, more options, better gameplay
Browse files Browse the repository at this point in the history
  • Loading branch information
wavemotion-dave committed Oct 26, 2022
1 parent d047cca commit 8f21c6e
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 90 deletions.
Binary file modified A7800DS.nds
Binary file not shown.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=3.7h
VERSION=3.8
TARGNAME=A7800DS

#---------------------------------------------------------------------------------
Expand Down
Binary file modified arm9/gfx/pdev_bg0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion arm9/source/a7800utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ void dsInstallSoundEmuFIFO(void)
}


void dsMainLoop(void)
ITCM_CODE void dsMainLoop(void)
{
static u8 lcd_swap_counter=0;
static u8 special_hsc_entry=0;
Expand Down
91 changes: 4 additions & 87 deletions arm9/source/emu/Tia.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@

byte tia_buffer[SNDLENGTH] __attribute__((section(".dtcm"))) = {0};
u32 tiaBufIdx __attribute__((section(".dtcm"))) = 0;
byte tia_volume[2] __attribute__((section(".dtcm"))) = {0};
uint tia_counter[2] __attribute__((section(".dtcm"))) = {0};
uint tia_counterMax[2] __attribute__((section(".dtcm"))) = {0};
static byte TIA_POLY4[ ] __attribute__((section(".dtcm"))) = {1,1,0,1,1,1,0,0,0,0,1,0,1,0,0};
static byte TIA_POLY5[ ] __attribute__((section(".dtcm"))) = {0,0,1,0,1,1,0,0,1,1,1,1,1,0,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,0,1};
static byte TIA_POLY9[ ] __attribute__((section(".dtcm"))) = {0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,1,0,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,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0,0,0,0,0};
static byte tia_volume[2] __attribute__((section(".dtcm"))) = {0};
static uint tia_counterMax[2] __attribute__((section(".dtcm"))) = {0};
static uint tia_counter[2] __attribute__((section(".dtcm"))) = {0};
byte tia_audc[2] __attribute__((section(".dtcm"))) = {0};
byte tia_audf[2] __attribute__((section(".dtcm"))) = {0};
byte tia_audv[2] __attribute__((section(".dtcm"))) = {0};
Expand Down Expand Up @@ -153,92 +153,10 @@ void tia_Clear( ) {
}
}

// ----------------------------------------------------------------------------
// SetRegister
// ----------------------------------------------------------------------------
void tia_SetRegister(word address, byte data)
{
byte channel=0;
byte frequency;

switch(address) {
case AUDC0:
tia_audc[0] = data & 15;
break;
case AUDC1:
tia_audc[1] = data & 15;
channel = 1;
break;
case AUDF0:
tia_audf[0] = data & 31;
break;
case AUDF1:
tia_audf[1] = data & 31;
channel = 1;
break;
case AUDV0:
tia_audv[0] = (data & 15) << 2;
break;
case AUDV1:
tia_audv[1] = (data & 15) << 2;
channel = 1;
break;
default:
return;
}

if(tia_audc[channel] == 0)
{
frequency = 0;
tia_volume[channel] = tia_audv[channel];
}
else
{
frequency = tia_audf[channel] + 1;
if(tia_audc[channel] > 11)
{
frequency *= 3;
}
}

if(frequency != tia_counterMax[channel])
{
tia_counterMax[channel] = frequency;
if(tia_counter[channel] == 0 || frequency == 0)
{
tia_counter[channel] = frequency;
}
}
}

void tia_MemoryChannel(byte channel)
{
byte frequency = 0;
if(tia_audc[channel] == 0)
{
tia_volume[channel] = tia_audv[channel];
}
else
{
frequency = tia_audf[channel] + 1;
if(tia_audc[channel] > 11)
{
frequency *= 3;
}
}

if(frequency != tia_counterMax[channel])
{
tia_counterMax[channel] = frequency;
if(tia_counter[channel] == 0 || frequency == 0)
{
tia_counter[channel] = frequency;
}
}
}

// Same as TIA_Process but designed for Pokey integration...
int TIA_Sample(void)
ITCM_CODE int TIA_Sample(void)
{
if(tia_counter[0] > 1)
{
Expand All @@ -264,7 +182,6 @@ int TIA_Sample(void)
// --------------------------------------------------------------------------------------
// Process
// --------------------------------------------------------------------------------------
u8 tia_sample __attribute__((section(".dtcm"))) = 0;
ITCM_CODE void tia_Process(void)
{
for(u8 index = 0; index < 2; index++)
Expand Down
31 changes: 30 additions & 1 deletion arm9/source/emu/Tia.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,38 @@ extern byte tia_audv[2];

extern void tia_Reset( );
extern void tia_SetRegister(word address, byte data);
extern void tia_MemoryChannel(byte channel);
extern void tia_Clear( );
extern void tia_Process(void);
extern byte tia_buffer[];
extern byte tia_volume[2];
extern uint tia_counter[2];
extern uint tia_counterMax[2];


inline void tia_MemoryChannel(byte channel)
{
byte frequency = 0;
if(tia_audc[channel] == 0)
{
tia_volume[channel] = tia_audv[channel];
}
else
{
frequency = tia_audf[channel] + 1;
if(tia_audc[channel] > 11)
{
frequency *= 3;
}
}

if(frequency != tia_counterMax[channel])
{
tia_counterMax[channel] = frequency;
if(tia_counter[channel] == 0 || frequency == 0)
{
tia_counter[channel] = frequency;
}
}
}

#endif

0 comments on commit 8f21c6e

Please sign in to comment.