BizHawk/BizHawk.Emulation.Cores/Calculator/TI83.IVideoProvider.cs

46 lines
1015 B
C#
Raw Normal View History

2015-02-07 14:38:29 +00:00
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Calculators
{
2017-04-17 20:23:04 +00:00
public partial class TI83 : IVideoProvider
2015-02-07 14:38:29 +00:00
{
2017-04-17 20:23:04 +00:00
public int VirtualWidth => 96;
public int VirtualHeight => 64;
public int BufferWidth => 96;
public int BufferHeight => 64;
public int BackgroundColor => 0;
2017-05-05 16:25:38 +00:00
public int VsyncNumerator => NullVideo.DefaultVsyncNum;
public int VsyncDenominator => NullVideo.DefaultVsyncDen;
2015-02-07 14:38:29 +00:00
public int[] GetVideoBuffer()
{
// unflatten bit buffer
int[] pixels = new int[96 * 64];
int i = 0;
for (int y = 0; y < 64; y++)
{
for (int x = 0; x < 96; x++)
{
2017-04-17 20:23:04 +00:00
int offset = (y * 96) + x;
2015-02-07 14:38:29 +00:00
int bufbyte = offset >> 3;
int bufbit = offset & 7;
2017-04-17 20:23:04 +00:00
int bit = (_vram[bufbyte] >> (7 - bufbit)) & 1;
2015-02-07 14:38:29 +00:00
if (bit == 0)
{
2017-04-17 20:23:04 +00:00
unchecked
{
pixels[i++] = (int)Settings.BGColor;
}
2015-02-07 14:38:29 +00:00
}
else
{
pixels[i++] = (int)Settings.ForeColor;
}
}
}
return pixels;
}
}
}