Skip to content

Commit

Permalink
Windows (one window), hirq
Browse files Browse the repository at this point in the history
  • Loading branch information
friol committed Apr 2, 2024
1 parent ff47873 commit 31aa9d5
Show file tree
Hide file tree
Showing 11 changed files with 2,204 additions and 73 deletions.
23 changes: 23 additions & 0 deletions apu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3473,6 +3473,29 @@ int apu::stepOne()
cycles = doBranch(offs, !flagV);
break;
}
case 0xf9:
{
// MOV X,d+Y
doMoveToX(&apu::addrDPY);
regPC += 2;
cycles = 4;
break;
}
case 0x39:
{
// AND (X),(Y)
unsigned char src = (this->*read8)(regY | ((flagP?1:0) << 8));
unsigned char dst= (this->*read8)(regX | ((flagP ? 1 : 0) << 8));

dst &= src;
doFlagsNZ(dst);

(this->*write8)(regX | ((flagP ? 1 : 0) << 8), dst);

regPC += 1;
cycles = 5;
break;
}
default:
{
// unknown opcode
Expand Down
30 changes: 26 additions & 4 deletions audioSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
extern logger glbTheLogger;

static std::deque<float> audioQueue;
static bool audioSemaphore = false;

//

Expand All @@ -14,9 +15,14 @@ DWORD CALLBACK StreamProc(HSTREAM handle, float* buffer, DWORD length, void* use

float* paudioInc = (float*)user;

audioSemaphore = true;
const unsigned int avsize = (unsigned int)audioQueue.size();

if (length == 0) return 0;
if (length == 0)
{
audioSemaphore = false;
return 0;
}

if (avsize < 2)
{
Expand All @@ -25,6 +31,7 @@ DWORD CALLBACK StreamProc(HSTREAM handle, float* buffer, DWORD length, void* use
buffer[pos] = 0;
}

audioSemaphore = false;
return length;
}

Expand All @@ -34,14 +41,23 @@ DWORD CALLBACK StreamProc(HSTREAM handle, float* buffer, DWORD length, void* use

if (nsamplesAva > 15000) (*paudioInc) -= 0.001f;
else (*paudioInc) += 0.001f;


if ((audioQueue.size() % 2) != 0)
{
glbTheLogger.logMsg("error: audio queue is not even (size"+std::to_string(audioQueue.size())+" )");
}

for (unsigned int pos = 0;pos < length / sizeof(float);pos += 2)
{
if (audioQueue.size()>=2)
{
buffer[pos] = audioQueue[0];
float s0= audioQueue[0];
float s1= audioQueue[1];

buffer[pos] = s0;
buffer[pos + 1] =s1;

audioQueue.pop_front();
buffer[pos + 1] = audioQueue[0];
audioQueue.pop_front();
}
else
Expand All @@ -52,6 +68,7 @@ DWORD CALLBACK StreamProc(HSTREAM handle, float* buffer, DWORD length, void* use
}
}

audioSemaphore = false;
return length;
}

Expand Down Expand Up @@ -87,6 +104,11 @@ audioSystem::audioSystem()

void audioSystem::feedAudiobuf(float l, float r)
{
if (audioSemaphore)
{
Sleep(1);
}

audioQueue.push_back(l);
audioQueue.push_back(r);
}
Expand Down
2 changes: 2 additions & 0 deletions debuggerSPC700.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ dbgSPC700info listOfInstrs[]
{0x4f,"PCALL $param0",2,1,true}, // validatedFC
{0xd9,"MOV $param0+Y,X",2,1,true}, // validatedFC
{0x50,"BVC $param0",2,1,true}, // validatedFC
{0xf9,"MOV X,$param0+Y",2,1,true}, // validatedFC
{0x39,"AND (X),(Y)",1,0,true}, // validatedFC


};
Expand Down
Loading

0 comments on commit 31aa9d5

Please sign in to comment.