mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-26 09:29:45 +00:00
Steps towards CPU mapping; diagnostic.
This commit is contained in:
parent
8abf395202
commit
1a2b18f93b
@ -48,49 +48,11 @@ MOS6560::MOS6560() :
|
||||
_vertical_counter(0)
|
||||
{
|
||||
_crt->set_composite_sampling_function(
|
||||
"float angles[16] = float[]("
|
||||
"0.0," // black
|
||||
"0.0," // white
|
||||
"1.963495408493621," // red
|
||||
"5.105088062083414," // cyan
|
||||
"0.785398163397448," // purple
|
||||
"3.926990816987241," // green
|
||||
"0.0," // blue
|
||||
"3.141592653589793," // yellow
|
||||
|
||||
"2.356194490192345," // orange
|
||||
"2.748893571891069," // light yellow
|
||||
"1.963495408493621," // light red
|
||||
"5.105088062083414," // light cyan
|
||||
"0.785398163397448," // light purple
|
||||
"3.926990816987241," // light green
|
||||
"0.0," // light blue
|
||||
"3.141592653589793" // light yellow
|
||||
");"
|
||||
"float brightnesses[16] = float[]("
|
||||
"0.0 / 255.0,"
|
||||
"255.0 / 255.0,"
|
||||
"79.6875 / 255.0,"
|
||||
"159.375 / 255.0,"
|
||||
"95.625 / 255.0,"
|
||||
"127.5 / 255.0,"
|
||||
"63.75 / 255.0,"
|
||||
"191.25 / 255.0,"
|
||||
|
||||
"95.625 / 255.0,"
|
||||
"63.75 / 255.0,"
|
||||
"127.5 / 255.0,"
|
||||
"189.375 / 255.0,"
|
||||
"135.625 / 255.0,"
|
||||
"191.25 / 255.0,"
|
||||
"119.53125 / 255.0,"
|
||||
"159.375 / 255.0"
|
||||
");"
|
||||
"float composite_sample(usampler2D texID, vec2 coordinate, vec2 iCoordinate, float phase, float amplitude)"
|
||||
"{"
|
||||
"uint c = texture(texID, coordinate).r;"
|
||||
"float y = brightnesses[c];"
|
||||
"float phaseOffset = angles[c];"
|
||||
"float y = float(c >> 4) / 4.0;"
|
||||
"float phaseOffset = float(c & 15u) / 16.0;"
|
||||
|
||||
// "float chroma = step(3.141592654, mod(phase + phaseOffset, 6.283185308)) * 2.0 - 1.0;"
|
||||
"float chroma = cos(phase + phaseOffset);"
|
||||
@ -129,7 +91,7 @@ void MOS6560::set_register(int address, uint8_t value)
|
||||
break;
|
||||
|
||||
case 0xe:
|
||||
_auxiliary_colour = value >> 4;
|
||||
_auxiliary_colour = _colours[value >> 4];
|
||||
// TODO: sound amplitude
|
||||
break;
|
||||
|
||||
@ -140,8 +102,8 @@ void MOS6560::set_register(int address, uint8_t value)
|
||||
_cycles_in_state = 0;
|
||||
}
|
||||
_invertedCells = !!((value >> 3)&1);
|
||||
_borderColour = value & 0x07;
|
||||
_backgroundColour = value >> 4;
|
||||
_borderColour = _colours[value & 0x07];
|
||||
_backgroundColour = _colours[value >> 4];
|
||||
break;
|
||||
|
||||
// TODO: audio, primarily
|
||||
@ -290,7 +252,7 @@ void MOS6560::set_graphics_value(uint8_t value, uint8_t colour_value)
|
||||
|
||||
if(pixel_pointer)
|
||||
{
|
||||
uint8_t cell_colour = _character_colour & 0x7;
|
||||
uint8_t cell_colour = _colours[_character_colour & 0x7];
|
||||
if(!(_character_colour&0x8))
|
||||
{
|
||||
pixel_pointer[0] = ((_character_value >> 7)&1) ? cell_colour : _backgroundColour;
|
||||
|
@ -49,6 +49,7 @@ class MOS6560 {
|
||||
uint8_t *pixel_pointer;
|
||||
|
||||
uint8_t _registers[16];
|
||||
uint8_t _colours[16];
|
||||
|
||||
void output_border(unsigned int number_of_cycles);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user