mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-27 00:30:26 +00:00
Retain command-engine context.
This commit is contained in:
parent
700470915a
commit
0c8815d6a0
@ -806,41 +806,77 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
|
||||
break;
|
||||
|
||||
case 32:
|
||||
Storage<personality>::command_context_.source_x =
|
||||
(Storage<personality>::command_context_.source_x & ~0xff) |
|
||||
value;
|
||||
break;
|
||||
case 33:
|
||||
LOG("TODO: Yamaha command source x; " << PADHEX(2) << +value);
|
||||
Storage<personality>::command_context_.source_x =
|
||||
(Storage<personality>::command_context_.source_x & ~0x100) |
|
||||
((value & 1) << 8);
|
||||
break;
|
||||
|
||||
case 34:
|
||||
Storage<personality>::command_context_.source_y =
|
||||
(Storage<personality>::command_context_.source_y & ~0xff) |
|
||||
value;
|
||||
break;
|
||||
case 35:
|
||||
LOG("TODO: Yamaha command source y; " << PADHEX(2) << +value);
|
||||
Storage<personality>::command_context_.source_y =
|
||||
(Storage<personality>::command_context_.source_y & ~0x300) |
|
||||
((value & 3) << 8);
|
||||
break;
|
||||
|
||||
case 36:
|
||||
Storage<personality>::command_context_.destination_x =
|
||||
(Storage<personality>::command_context_.destination_x & ~0xff) |
|
||||
value;
|
||||
break;
|
||||
case 37:
|
||||
LOG("TODO: Yamaha command destination x; " << PADHEX(2) << +value);
|
||||
Storage<personality>::command_context_.destination_x =
|
||||
(Storage<personality>::command_context_.destination_x & ~0x100) |
|
||||
((value & 1) << 8);
|
||||
break;
|
||||
|
||||
case 38:
|
||||
Storage<personality>::command_context_.destination_y =
|
||||
(Storage<personality>::command_context_.destination_y & ~0xff) |
|
||||
value;
|
||||
break;
|
||||
case 39:
|
||||
LOG("TODO: Yamaha command destination y; " << PADHEX(2) << +value);
|
||||
Storage<personality>::command_context_.destination_y =
|
||||
(Storage<personality>::command_context_.destination_y & ~0x300) |
|
||||
((value & 3) << 8);
|
||||
break;
|
||||
|
||||
case 40:
|
||||
Storage<personality>::command_context_.size_x =
|
||||
(Storage<personality>::command_context_.size_x & ~0xff) |
|
||||
value;
|
||||
break;
|
||||
case 41:
|
||||
LOG("TODO: Yamaha command size x; " << PADHEX(2) << +value);
|
||||
Storage<personality>::command_context_.size_x =
|
||||
(Storage<personality>::command_context_.size_x & ~0x100) |
|
||||
((value & 1) << 8);
|
||||
break;
|
||||
|
||||
case 42:
|
||||
Storage<personality>::command_context_.size_y =
|
||||
(Storage<personality>::command_context_.size_y & ~0xff) |
|
||||
value;
|
||||
break;
|
||||
case 43:
|
||||
LOG("TODO: Yamaha command size y; " << PADHEX(2) << +value);
|
||||
Storage<personality>::command_context_.size_y =
|
||||
(Storage<personality>::command_context_.size_y & ~0x300) |
|
||||
((value & 3) << 8);
|
||||
break;
|
||||
|
||||
case 44:
|
||||
LOG("TODO: Yamaha command colour; " << PADHEX(2) << +value);
|
||||
Storage<personality>::command_context_.colour = value;
|
||||
break;
|
||||
|
||||
case 45:
|
||||
LOG("TODO: Yamaha VRAM bank selection addressing and command arguments; " << PADHEX(2) << +value);
|
||||
Storage<personality>::command_context_.arguments = value;
|
||||
// b6: 0 = video RAM; 1 = expansion RAM.
|
||||
// b5: MXD (???)
|
||||
// b4: MXS
|
||||
|
@ -15,7 +15,9 @@
|
||||
#include "../../../Numeric/BitReverse.hpp"
|
||||
#include "../../../Outputs/CRT/CRT.hpp"
|
||||
|
||||
#include "AccessEnums.hpp"
|
||||
#include "PersonalityTraits.hpp"
|
||||
#include "YamahaCommands.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
@ -27,44 +29,6 @@
|
||||
namespace TI {
|
||||
namespace TMS {
|
||||
|
||||
// The screen mode is a necessary predecessor to picking the line mode,
|
||||
// which is the thing latched per line.
|
||||
enum class ScreenMode {
|
||||
// Original TMS modes.
|
||||
Blank,
|
||||
Text,
|
||||
MultiColour,
|
||||
ColouredText,
|
||||
Graphics,
|
||||
|
||||
// 8-bit Sega modes.
|
||||
SMSMode4,
|
||||
|
||||
// New Yamaha V9938 modes.
|
||||
YamahaText80,
|
||||
YamahaGraphics3,
|
||||
YamahaGraphics4,
|
||||
YamahaGraphics5,
|
||||
YamahaGraphics6,
|
||||
YamahaGraphics7,
|
||||
|
||||
// Rebranded Yamaha V9938 modes.
|
||||
YamahaGraphics1 = ColouredText,
|
||||
YamahaGraphics2 = Graphics,
|
||||
};
|
||||
|
||||
enum class LineMode {
|
||||
Text,
|
||||
Character,
|
||||
Refresh,
|
||||
SMS,
|
||||
Yamaha,
|
||||
};
|
||||
|
||||
enum class MemoryAccess {
|
||||
Read, Write, None
|
||||
};
|
||||
|
||||
// Temporary buffers collect a representation of each line prior to pixel serialisation.
|
||||
//
|
||||
// TODO: either template on personality, to avoid having to be the union of all potential footprints,
|
||||
@ -217,6 +181,10 @@ template <Personality personality> struct Storage<personality, std::enable_if_t<
|
||||
next_event_ = no_sprites_events;
|
||||
}
|
||||
|
||||
// Command engine state.
|
||||
CommandContext command_context_;
|
||||
Command *command_ = nullptr;
|
||||
|
||||
Storage() noexcept {
|
||||
// Perform sanity checks on the event lists.
|
||||
#ifndef NDEBUG
|
||||
|
57
Components/9918/Implementation/AccessEnums.hpp
Normal file
57
Components/9918/Implementation/AccessEnums.hpp
Normal file
@ -0,0 +1,57 @@
|
||||
//
|
||||
// AccessEnums.hpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 26/01/2023.
|
||||
// Copyright © 2023 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef AccessEnums_hpp
|
||||
#define AccessEnums_hpp
|
||||
|
||||
|
||||
namespace TI {
|
||||
namespace TMS {
|
||||
|
||||
// The screen mode is a necessary predecessor to picking the line mode,
|
||||
// which is the thing latched per line.
|
||||
enum class ScreenMode {
|
||||
// Original TMS modes.
|
||||
Blank,
|
||||
Text,
|
||||
MultiColour,
|
||||
ColouredText,
|
||||
Graphics,
|
||||
|
||||
// 8-bit Sega modes.
|
||||
SMSMode4,
|
||||
|
||||
// New Yamaha V9938 modes.
|
||||
YamahaText80,
|
||||
YamahaGraphics3,
|
||||
YamahaGraphics4,
|
||||
YamahaGraphics5,
|
||||
YamahaGraphics6,
|
||||
YamahaGraphics7,
|
||||
|
||||
// Rebranded Yamaha V9938 modes.
|
||||
YamahaGraphics1 = ColouredText,
|
||||
YamahaGraphics2 = Graphics,
|
||||
};
|
||||
|
||||
enum class LineMode {
|
||||
Text,
|
||||
Character,
|
||||
Refresh,
|
||||
SMS,
|
||||
Yamaha,
|
||||
};
|
||||
|
||||
enum class MemoryAccess {
|
||||
Read, Write, None
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* AccessEnums_hpp */
|
46
Components/9918/Implementation/YamahaCommands.hpp
Normal file
46
Components/9918/Implementation/YamahaCommands.hpp
Normal file
@ -0,0 +1,46 @@
|
||||
//
|
||||
// YamahaCommands.hpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 26/01/2023.
|
||||
// Copyright © 2023 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef YamahaCommands_hpp
|
||||
#define YamahaCommands_hpp
|
||||
|
||||
#include "AccessEnums.hpp"
|
||||
|
||||
namespace TI {
|
||||
namespace TMS {
|
||||
|
||||
struct CommandContext {
|
||||
int source_x = 0, source_y = 0;
|
||||
int destination_x = 0, destination_y = 0;
|
||||
int size_x = 0, size_y = 0;
|
||||
uint8_t colour = 0;
|
||||
uint8_t arguments = 0;
|
||||
};
|
||||
|
||||
struct Command {
|
||||
// In net:
|
||||
//
|
||||
// This command is blocked until @c access has been performed, reading
|
||||
// from or writing to @c value. It should not be performed until at least
|
||||
// @c cycles have passed.
|
||||
MemoryAccess access = MemoryAccess::None;
|
||||
int cycles = 0;
|
||||
uint8_t value = 0;
|
||||
|
||||
/// Current command parameters.
|
||||
CommandContext &context;
|
||||
Command(CommandContext &context) : context(context) {}
|
||||
|
||||
/// Request that the fields above are updated given the completed access.
|
||||
virtual bool next() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* YamahaCommands_hpp */
|
@ -2216,6 +2216,8 @@
|
||||
4BF0BC67297108D100CCA2B5 /* MemorySlotHandler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MemorySlotHandler.cpp; sourceTree = "<group>"; };
|
||||
4BF0BC6F2973318E00CCA2B5 /* RP5C01.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RP5C01.cpp; sourceTree = "<group>"; };
|
||||
4BF0BC702973318E00CCA2B5 /* RP5C01.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RP5C01.hpp; sourceTree = "<group>"; };
|
||||
4BF0BC732982E54700CCA2B5 /* YamahaCommands.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = YamahaCommands.hpp; sourceTree = "<group>"; };
|
||||
4BF0BC742982E6D300CCA2B5 /* AccessEnums.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = AccessEnums.hpp; sourceTree = "<group>"; };
|
||||
4BF40A5525424C770033EA39 /* LanguageCardSwitches.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = LanguageCardSwitches.hpp; sourceTree = "<group>"; };
|
||||
4BF40A5A254263140033EA39 /* AuxiliaryMemorySwitches.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = AuxiliaryMemorySwitches.hpp; sourceTree = "<group>"; };
|
||||
4BF437EC209D0F7E008CBD6B /* SegmentParser.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SegmentParser.cpp; sourceTree = "<group>"; };
|
||||
@ -4751,10 +4753,12 @@
|
||||
children = (
|
||||
4B43983829620FB1006B0BFC /* 9918.cpp */,
|
||||
4BD388411FE34E010042B588 /* 9918Base.hpp */,
|
||||
4BF0BC742982E6D300CCA2B5 /* AccessEnums.hpp */,
|
||||
4B43983C29621024006B0BFC /* ClockConverter.hpp */,
|
||||
4B43983F2967459B006B0BFC /* Draw.hpp */,
|
||||
4B43983E29628538006B0BFC /* Fetch.hpp */,
|
||||
4B262BFF29691F55002EC0F7 /* PersonalityTraits.hpp */,
|
||||
4BF0BC732982E54700CCA2B5 /* YamahaCommands.hpp */,
|
||||
);
|
||||
path = Implementation;
|
||||
sourceTree = "<group>";
|
||||
|
Loading…
x
Reference in New Issue
Block a user