diff --git a/Components/6522/6522.hpp b/Components/6522/6522.hpp index a519107a9..309eaeceb 100644 --- a/Components/6522/6522.hpp +++ b/Components/6522/6522.hpp @@ -10,6 +10,7 @@ #define _522_hpp #include +#include namespace MOS { @@ -17,14 +18,28 @@ template 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; }; } diff --git a/Components/6560/6560.cpp b/Components/6560/6560.cpp index 2581b7553..2ebba2aa7 100644 --- a/Components/6560/6560.cpp +++ b/Components/6560/6560.cpp @@ -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))?) "}"); } diff --git a/Machines/Atari2600/Atari2600.cpp b/Machines/Atari2600/Atari2600.cpp index e479780f5..fdd12c10d 100644 --- a/Machines/Atari2600/Atari2600.cpp +++ b/Machines/Atari2600/Atari2600.cpp @@ -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); diff --git a/Machines/Vic-20/Vic20.cpp b/Machines/Vic-20/Vic20.cpp index 1b9724487..389ae7580 100644 --- a/Machines/Vic-20/Vic20.cpp +++ b/Machines/Vic-20/Vic20.cpp @@ -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))