1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Increased logging slightly, ensured all of colour RAM can be read, slightly improved the 2600 pixel decoder.

This commit is contained in:
Thomas Harte 2016-06-07 22:01:14 -04:00
parent 26ab96868a
commit 581eace478
4 changed files with 25 additions and 10 deletions

View File

@ -10,6 +10,7 @@
#define _522_hpp
#include <cstdint>
#include <cstdio>
namespace MOS {
@ -17,14 +18,28 @@ template <class T> class MOS6522 {
public:
MOS6522() : _data_direction{0, 0} {}
void set_register(int address, uint8_t value) {}
uint8_t get_register(int address) {return 0xff;}
void set_register(int address, uint8_t value)
{
printf("6522: %d <- %02x\n", address, value);
// switch(address)
// {
// case 0x11: _auxiliary_control_register = value; break;
// }
}
uint8_t get_register(int address)
{
printf("6522: %d\n", address);
return 0xff;
}
private:
uint16_t _interval_timers[2];
uint8_t _shift_register;
uint8_t _input_latches[2];
uint8_t _data_direction[2];
uint8_t _interrupt_flag_register, _interrupt_enable_register;
uint8_t _peripheral_control_register, _auxiliary_control_register;
};
}

View File

@ -31,8 +31,8 @@ using namespace MOS;
*/
/*
0 -> green
1 -> green
0 -> purple
1 -> purple
2 -> browny yellow
3 -> browny red
4 -> purple
@ -53,10 +53,10 @@ MOS6560::MOS6560() :
"uint c = texture(texID, coordinate).r;"
"float y = 0.75 + (float(c & 8u) / 8.0) * 0.25 * step(1, c);"
"uint iPhase = 8u;"
"float phaseOffset = 6.283185308 * (float(iPhase)) / 7.0;" // TODO: appropriate phaseOffset
"uint iPhase = c & 7u;"
"float phaseOffset = 6.283185308 * float(iPhase + 8u) / 8.0;" // TODO: appropriate phaseOffset
"return mix(step(1, c) * y, step(2, c) * step(mod(phase + phaseOffset, 6.283185308), 3.141592654), amplitude);"
"return mix(step(1, c) * y, step(2, c) * sin(phase + phaseOffset), amplitude);" // TODO: square wave (step(3.141592654, mod(phase + phaseOffset, 6.283185308))?)
"}");
}

View File

@ -69,7 +69,7 @@ void Machine::setup_output(float aspect_ratio)
"uint iPhase = (c >> 4);"
"float phaseOffset = 6.283185308 * float(iPhase - 1u) / 13.0;"
"return (float(y) / 14.0) * (1.0 - amplitude) + step(1, iPhase) * amplitude * cos(phase + phaseOffset);"
"return mix(float(y) / 14.0, step(1, iPhase) * cos(phase + phaseOffset), amplitude);"
"}");
_crt->set_output_device(Outputs::CRT::Television);
@ -89,7 +89,7 @@ void Machine::switch_region()
"uint direction = iPhase & 1u;"
"float phaseOffset = float(7u - direction) + (float(direction) - 0.5) * 2.0 * float(iPhase >> 1);"
"phaseOffset *= 6.283185308 / 12.0;"
"return (float(y) / 14.0) * (1.0 - amplitude) + step(4, (iPhase + 2u) & 15u) * amplitude * cos(phase + phaseOffset);"
"return mix(float(y) / 14.0, step(4, (iPhase + 2u) & 15u) * cos(phase + phaseOffset), amplitude);"
"}");
_crt->set_new_timing(228, 312, Outputs::CRT::ColourSpace::YUV, 228, 1);

View File

@ -23,7 +23,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
// run the phase-1 part of this cycle, in which the VIC accesses memory
uint16_t video_address = _mos6560->get_address();
_mos6560->set_graphics_value(read_memory(video_address), _colorMemory[video_address & 0x01ff]);
_mos6560->set_graphics_value(read_memory(video_address), _colorMemory[video_address & 0x03ff]);
// run the phase-2 part of the cycle, which is whatever the 6502 said it should be
if(isReadOperation(operation))