From 30b7db3979ccf5f1f60044531a5bc1737720d8a4 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 9 Jun 2016 22:05:17 -0400 Subject: [PATCH] Attempted a square wave, made the Vic itself responsible for address manipulation re:the 6560. --- Components/6560/6560.cpp | 5 ++--- Machines/Vic-20/Vic20.cpp | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Components/6560/6560.cpp b/Components/6560/6560.cpp index f0b09adc7..1fe5e3205 100644 --- a/Components/6560/6560.cpp +++ b/Components/6560/6560.cpp @@ -57,7 +57,7 @@ MOS6560::MOS6560() : "float phaseOffset = 6.283185308 * float(iPhase + 8u) / 8.0;" // TODO: appropriate phaseOffset // sin(phase + phaseOffset) - "return mix(step(1, c) * y, step(2, c) * step(3.141592654, mod(phase + phaseOffset, 6.283185308)) * 2.0, amplitude);" // TODO: square wave (step(3.141592654, mod(phase + phaseOffset, 6.283185308))?) + "return mix(step(1, c) * y, step(2, c) * step(3.141592654, mod(phase + phaseOffset, 6.283185308)) * 2.0 - 1.0, amplitude);" // TODO: square wave (step(3.141592654, mod(phase + phaseOffset, 6.283185308))?) "}"); } @@ -226,8 +226,7 @@ uint16_t MOS6560::get_address() */ if(_column_counter&1) { - // TODO: don't add 0x8000. That's a hack. - return 0x8000 + (_character_cell_start_address + (_character_code*8) + (_row_counter&7)); + return _character_cell_start_address + (_character_code*8) + (_row_counter&7); } else { diff --git a/Machines/Vic-20/Vic20.cpp b/Machines/Vic-20/Vic20.cpp index 3f32b44b8..e35b0352c 100644 --- a/Machines/Vic-20/Vic20.cpp +++ b/Machines/Vic-20/Vic20.cpp @@ -25,6 +25,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(); + if(!(video_address&0x1000)) video_address += 0x8000; _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