1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-06 13:31:55 +00:00

A quick hack shows some part of the MSX logo.

This commit is contained in:
Thomas Harte 2023-01-26 21:31:49 -05:00
parent baa6f9b3cd
commit 75acbd2d6c
2 changed files with 34 additions and 10 deletions

View File

@ -866,7 +866,31 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
// Seed timing information if a command was found.
if(Storage<personality>::command_) {
// TODO.
// TODO: eliminate SUPER HACK.
// This is currently here primarily to help me to hash out the
// proper interface, and also because I'm just not persuaded
// that minimum_access_column_ works properly. Why doesn't it
// ever end up out of bounds?
// TODO: undo temporary assumption of Graphics Mode 5.
uint8_t packed_colour = Storage<personality>::command_context_.colour & 3;
packed_colour |= packed_colour << 2;
packed_colour |= packed_colour << 4;
while(!Storage<personality>::command_->done()) {
const int address =
(Storage<personality>::command_->location.v[0] >> 2) +
(Storage<personality>::command_->location.v[1] << 7);
const uint8_t mask = 0xc0 >> ((Storage<personality>::command_->location.v[0] & 3) << 1);
uint8_t v = ram_[address];
v &= ~mask;
v |= packed_colour & mask;
ram_[address] = v;
Storage<personality>::command_->advance();
}
}
// TODO: record logical mode.

View File

@ -59,11 +59,11 @@ struct Command {
CommandContext &context;
Command(CommandContext &context) : context(context) {}
/// Request that the fields above are updated given that the previously-request access
/// was completed.
///
/// @returns @c true if another access has been enqueued; @c false if this command is done.
virtual bool next() = 0;
/// @returns @c true if all output from this command is done; @c false otherwise.
virtual bool done() = 0;
/// Repopulates the fields above with the next action to take.
virtual void advance() = 0;
};
// MARK: - Line drawing.
@ -104,9 +104,11 @@ struct Line: public Command {
location = context.destination;
}
bool next() {
if(!duration_) return false;
bool done() final {
return !duration_;
}
void advance() final {
--duration_;
cycles = 88;
location += major_;
@ -116,8 +118,6 @@ struct Line: public Command {
location += minor_;
position_ += denominator_;
}
return true;
}
private: