commodore64: crop screen, fix sound pulsewidth register writing (it was being processed as 16 bits instead of 12)
This commit is contained in:
parent
58db36e311
commit
be37d1dc53
|
@ -9,14 +9,27 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
{
|
||||
public void GetSamples(out short[] samples, out int nsamp)
|
||||
{
|
||||
samples = buffer;
|
||||
nsamp = (int)bufferIndex;
|
||||
bufferIndex = 0;
|
||||
if (bufferIndex > bufferReadOffset)
|
||||
samples = new short[bufferIndex - bufferReadOffset];
|
||||
else
|
||||
samples = new short[bufferIndex + (bufferLength - bufferReadOffset)];
|
||||
|
||||
nsamp = samples.Length;
|
||||
for (uint i = 0; i < nsamp; i++)
|
||||
{
|
||||
samples[i] = buffer[bufferReadOffset];
|
||||
if (bufferReadOffset != bufferIndex)
|
||||
bufferReadOffset++;
|
||||
if (bufferReadOffset == bufferLength)
|
||||
bufferReadOffset = 0;
|
||||
}
|
||||
nsamp /= 2;
|
||||
}
|
||||
|
||||
public void DiscardSamples()
|
||||
{
|
||||
// todo
|
||||
bufferIndex = 0;
|
||||
bufferReadOffset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -488,7 +488,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
}
|
||||
set
|
||||
{
|
||||
pulseWidth &= 0xFF00;
|
||||
pulseWidth &= 0x0F00;
|
||||
pulseWidth |= value & 0x00FF;
|
||||
}
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
set
|
||||
{
|
||||
pulseWidth &= 0x00FF;
|
||||
pulseWidth |= (value & 0x00FF) << 8;
|
||||
pulseWidth |= (value & 0x000F) << 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -639,9 +639,9 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
voices[i].Synchronize(voices[syncNextTable[i]], voices[syncPrevTable[i]]);
|
||||
|
||||
// get output
|
||||
voiceOutput[0] = voices[0].Output(voices[1]);
|
||||
voiceOutput[1] = voices[1].Output(voices[2]);
|
||||
voiceOutput[2] = voices[2].Output(voices[0]);
|
||||
voiceOutput[0] = voices[0].Output(voices[2]);
|
||||
voiceOutput[1] = voices[1].Output(voices[0]);
|
||||
voiceOutput[2] = voices[2].Output(voices[1]);
|
||||
envelopeOutput[0] = envelopes[0].Level;
|
||||
envelopeOutput[1] = envelopes[1].Level;
|
||||
envelopeOutput[2] = envelopes[2].Level;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
@ -11,6 +12,8 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
private int bufHeight;
|
||||
private uint bufLength;
|
||||
private uint bufOffset;
|
||||
private Point bufPoint;
|
||||
private Rectangle bufRect;
|
||||
private int bufWidth;
|
||||
|
||||
// palette
|
||||
|
@ -41,12 +44,12 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
public int BufferHeight
|
||||
{
|
||||
get { return bufHeight; }
|
||||
get { return bufRect.Height; }
|
||||
}
|
||||
|
||||
public int BufferWidth
|
||||
{
|
||||
get { return bufWidth; }
|
||||
get { return bufRect.Width; }
|
||||
}
|
||||
|
||||
public int[] GetVideoBuffer()
|
||||
|
@ -56,7 +59,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
public int VirtualWidth
|
||||
{
|
||||
get { return bufWidth; }
|
||||
get { return bufRect.Width; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
@ -147,11 +148,12 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
cyclesPerSec = newCyclesPerSec;
|
||||
pixelBufferDelay = 12;
|
||||
pixelBackgroundBufferDelay = 4;
|
||||
bufRect = new Rectangle(136 - 24, 51 - 24, 320 + 48, 200 + 48);
|
||||
|
||||
buf = new int[bufRect.Width * bufRect.Height];
|
||||
bufLength = (uint)buf.Length;
|
||||
bufWidth = (int)(totalCycles * 8);
|
||||
bufHeight = (int)(totalLines);
|
||||
buf = new int[bufWidth * bufHeight];
|
||||
bufLength = (uint)buf.Length;
|
||||
|
||||
sprites = new Sprite[8];
|
||||
for (uint i = 0; i < 8; i++)
|
||||
|
@ -618,10 +620,22 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
// recall pixel from buffer
|
||||
pixel = pixelBuffer[pixelBufferIndex];
|
||||
|
||||
buf[bufOffset] = palette[pixel];
|
||||
bufOffset++;
|
||||
if (bufOffset == bufLength)
|
||||
bufOffset = 0;
|
||||
// plot pixel if within viewing area
|
||||
if (bufRect.Contains(bufPoint))
|
||||
{
|
||||
buf[bufOffset] = palette[pixel];
|
||||
bufOffset++;
|
||||
if (bufOffset == bufLength)
|
||||
bufOffset = 0;
|
||||
}
|
||||
bufPoint.X++;
|
||||
if (bufPoint.X == bufWidth)
|
||||
{
|
||||
bufPoint.X = 0;
|
||||
bufPoint.Y++;
|
||||
if (bufPoint.Y == bufHeight)
|
||||
bufPoint.Y = 0;
|
||||
}
|
||||
|
||||
// put the pixel from the background buffer into the main buffer
|
||||
pixel = pixelBackgroundBuffer[pixelBackgroundBufferIndex];
|
||||
|
|
Loading…
Reference in New Issue