mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-27 15:29:34 +00:00
Forward address information to a video stub.
This commit is contained in:
parent
891d5c2066
commit
38325741de
@ -8,10 +8,10 @@
|
||||
|
||||
#include "Plus4.hpp"
|
||||
|
||||
#include "Video.hpp"
|
||||
|
||||
#include "../../MachineTypes.hpp"
|
||||
|
||||
#include "../../../Processors/6502/6502.hpp"
|
||||
|
||||
#include "../../../Analyser/Static/Commodore/Target.hpp"
|
||||
|
||||
using namespace Commodore::Plus4;
|
||||
@ -207,6 +207,15 @@ public:
|
||||
case 0xff04: timers_.write<4>(*value); break;
|
||||
case 0xff05: timers_.write<5>(*value); break;
|
||||
|
||||
case 0xff06: video_.write<0xff06>(*value); break;
|
||||
case 0xff07: video_.write<0xff07>(*value); break;
|
||||
case 0xff0c: video_.write<0xff0c>(*value); break;
|
||||
case 0xff0d: video_.write<0xff0d>(*value); break;
|
||||
case 0xff12: video_.write<0xff12>(*value); break;
|
||||
case 0xff14: video_.write<0xff14>(*value); break;
|
||||
case 0xff1a: video_.write<0xff1a>(*value); break;
|
||||
case 0xff1b: video_.write<0xff1b>(*value); break;
|
||||
|
||||
default:
|
||||
printf("TODO: TED write at %04x\n", address);
|
||||
}
|
||||
@ -241,6 +250,7 @@ private:
|
||||
|
||||
Cycles timers_subcycles_;
|
||||
Timers timers_;
|
||||
Video video_;
|
||||
};
|
||||
|
||||
}
|
||||
|
81
Machines/Commodore/Plus4/Video.hpp
Normal file
81
Machines/Commodore/Plus4/Video.hpp
Normal file
@ -0,0 +1,81 @@
|
||||
//
|
||||
// Video.hpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 10/12/2024.
|
||||
// Copyright © 2024 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Commodore::Plus4 {
|
||||
|
||||
struct Video {
|
||||
public:
|
||||
template <uint16_t address>
|
||||
void write(const uint8_t value) {
|
||||
const auto load_high10 = [&](uint16_t &target) {
|
||||
target = uint16_t(
|
||||
(target & 0x00ff) | ((value & 0x3) << 8)
|
||||
);
|
||||
};
|
||||
const auto load_low8 = [&](uint16_t &target) {
|
||||
target = uint16_t(
|
||||
(target & 0xff00) | value
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
switch(address) {
|
||||
case 0xff06:
|
||||
extended_colour_mode_ = value & 0x40;
|
||||
bitmap_mode_ = value & 0x20;
|
||||
display_enable_ = value & 0x10;
|
||||
rows_25_ = value & 8;
|
||||
y_scroll_ = value & 7;
|
||||
break;
|
||||
|
||||
case 0xff07:
|
||||
characters_256_ = value & 0x80;
|
||||
is_ntsc_ = value & 0x40;
|
||||
ted_off_ = value & 0x20;
|
||||
multicolour_mode_ = value & 0x10;
|
||||
columns_40_ = value & 8;
|
||||
x_scroll_ = value & 7;
|
||||
break;
|
||||
|
||||
case 0xff12:
|
||||
character_generator_address_ = uint16_t((value & 0xfc) << 8);
|
||||
break;
|
||||
case 0xff14:
|
||||
screen_memory_address_ = uint16_t((value & 0xf8) << 8);
|
||||
break;
|
||||
|
||||
case 0xff0c: load_high10(cursor_address_); break;
|
||||
case 0xff0d: load_low8(cursor_address_); break;
|
||||
case 0xff1a: load_high10(character_row_address_); break;
|
||||
case 0xff1b: load_low8(character_row_address_); break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
bool extended_colour_mode_ = false;
|
||||
bool bitmap_mode_ = false;
|
||||
bool display_enable_ = false;
|
||||
bool rows_25_ = false;
|
||||
int y_scroll_ = 0;
|
||||
|
||||
bool characters_256_ = false;
|
||||
bool is_ntsc_ = false;
|
||||
bool ted_off_ = false;
|
||||
bool multicolour_mode_ = false;
|
||||
bool columns_40_ = false;
|
||||
int x_scroll_ = 0;
|
||||
|
||||
uint16_t cursor_address_ = 0;
|
||||
uint16_t character_row_address_ = 0;
|
||||
uint16_t character_generator_address_ = 0;
|
||||
uint16_t screen_memory_address_ = 0;
|
||||
};
|
||||
|
||||
}
|
@ -1296,6 +1296,7 @@
|
||||
42EB812C2B47008D00429AF4 /* MemoryMap.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryMap.cpp; sourceTree = "<group>"; };
|
||||
4B018B88211930DE002A3937 /* 65C02_extended_opcodes_test.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = 65C02_extended_opcodes_test.bin; path = "Klaus Dormann/65C02_extended_opcodes_test.bin"; sourceTree = "<group>"; };
|
||||
4B01A6871F22F0DB001FD6E3 /* Z80MemptrTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Z80MemptrTests.swift; sourceTree = "<group>"; };
|
||||
4B03291F2D0923E300C51EB5 /* Video.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Video.hpp; sourceTree = "<group>"; };
|
||||
4B0333AD2094081A0050B93D /* AppleDSK.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AppleDSK.cpp; sourceTree = "<group>"; };
|
||||
4B0333AE2094081A0050B93D /* AppleDSK.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = AppleDSK.hpp; sourceTree = "<group>"; };
|
||||
4B046DC31CFE651500E9E45E /* ScanProducer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ScanProducer.hpp; sourceTree = "<group>"; };
|
||||
@ -3393,6 +3394,7 @@
|
||||
children = (
|
||||
4B596EAF2D037E8800FBF4B1 /* Plus4.hpp */,
|
||||
4B596EB02D037E8800FBF4B1 /* Plus4.cpp */,
|
||||
4B03291F2D0923E300C51EB5 /* Video.hpp */,
|
||||
);
|
||||
path = Plus4;
|
||||
sourceTree = "<group>";
|
||||
|
Loading…
x
Reference in New Issue
Block a user