public ushort Render(VIC vic, ushort x, byte shift) { IVideoOutput output = vic.OutputDevice; ushort[] collision = vic.CollisionMatrix; byte b1, b2; vic.ReadVideoMatrix(out b1, out b2); uint bgColor = vic.GetBackgroundColor(0); uint color = Pallete.CvtColors[b2 & 0x7]; bool mc = (b2 & 0x8) != 0; ushort y = vic.Raster; uint pos = (uint)(y * VIC.X_RESOLUTION + x); if (mc) { uint bits = (uint)(vic.Memory.Read(vic.GetCharGenMemoryAddress((ushort)((b1 << 3) | vic.RC))) << (shift & ~1)); bits <<= 2; uint pixel = (bits & 0x300) >> 8; bool next = (shift & 1) != 0; for (uint lim = pos + 8 - shift; pos < lim; pos++) { output.OutputPixel(pos, pixel < 3 ? vic.GetBackgroundColor((byte)pixel) : color); collision[pos] = (pixel & 2) != 0 ? (ushort)CollisionState.Foreground : (ushort)0; if (next) { bits <<= 2; pixel = (bits & 0x300) >> 8; } next = !next; } } else { uint bits = (uint)(vic.Memory.Read(vic.GetCharGenMemoryAddress((ushort)((b1 << 3) | vic.RC))) << shift); for (uint lim = pos + 8; pos < lim; pos++) { bits <<= 1; uint pixel = bits & 0x100; output.OutputPixel(pos, pixel == 0 ? bgColor : color); collision[pos] = (ushort)pixel; } } return (ushort)(x + 8 - shift); }
public ushort Render(VIC vic, ushort x, byte shift) { IVideoOutput output = vic.OutputDevice; ushort[] collision = vic.CollisionMatrix; byte b1, b2; vic.ReadVideoMatrix(out b1, out b2); byte bgColor = (byte)(b1 >> 6); b1 &= 0x3f; uint color = Pallete.CvtColors[b2]; uint bits = (uint)(vic.Memory.Read(vic.GetCharGenMemoryAddress((ushort)((b1 << 3) | vic.RC))) << shift); ushort y = vic.Raster; uint pos = (uint)(y * VIC.X_RESOLUTION + x); for (uint lim = pos + 8; pos < lim; pos++) { bits <<= 1; uint pixel = bits & 0x100; output.OutputPixel(pos, pixel == 0 ? vic.GetBackgroundColor(bgColor) : color); collision[pos] = (ushort)pixel; } return (ushort)(x + 8 - shift); }
public ushort Render(VIC vic, ushort x, byte shift) { IVideoOutput output = vic.OutputDevice; ushort[] collision = vic.CollisionMatrix; byte b1, b2; vic.ReadVideoMatrix(out b1, out b2); _colors[0] = vic.GetBackgroundColor(0); _colors[1] = Pallete.CvtColors[b1 >> 4]; _colors[2] = Pallete.CvtColors[b1 & 0x0f]; _colors[3] = Pallete.CvtColors[b2]; ushort y = vic.Raster; uint pos = (uint)(y * VIC.X_RESOLUTION + x); uint bits = (uint)(vic.Memory.Read(vic.GetBitmapMemoryAddress((ushort)((vic.VC << 3) | vic.RC))) << (shift & ~1)); bits <<= 2; uint pixel = pixel = (bits & 0x300) >> 8; bool next = (shift & 1) != 0; for (uint lim = pos + 8 - shift; pos < lim; pos++) { output.OutputPixel(pos, _colors[pixel]); collision[pos] = (bits & 2) != 0 ? (ushort)CollisionState.Foreground : (ushort)0; if (next) { bits <<= 2; pixel = (bits & 0x300) >> 8; } next = !next; } return (ushort)(x + 8 - shift); }
public ushort Render(VIC vic, ushort x, byte shift) { IVideoOutput output = vic.OutputDevice; ushort[] collision = vic.CollisionMatrix; byte b1, b2; vic.ReadVideoMatrix(out b1, out b2); uint color0 = Pallete.CvtColors[b1 & 0x0f]; uint color1 = Pallete.CvtColors[b1 >> 4]; uint bits = (uint)(vic.Memory.Read(vic.GetBitmapMemoryAddress((ushort)((vic.VC << 3) | vic.RC))) << shift); ushort y = vic.Raster; uint pos = (uint)(y * VIC.X_RESOLUTION + x); for (uint lim = pos + 8; pos < lim; pos++) { bits <<= 1; uint pixel = bits & 0x100; output.OutputPixel(pos, pixel == 0 ? color0 : color1); collision[pos] = (ushort)pixel; } return (ushort)(x + 8 - shift); }