1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 16:31:31 +00:00

Stores and returns video mode.

This commit is contained in:
Thomas Harte 2019-10-27 22:39:00 -04:00
parent de1bfb4e24
commit 1aaa6331a0
2 changed files with 9 additions and 2 deletions

View File

@ -8,7 +8,6 @@
#include "Video.hpp"
#define NDEBUG
#include "../../Outputs/Log.hpp"
#include <algorithm>
@ -224,14 +223,17 @@ HalfCycles Video::get_next_sequence_point() {
// MARK: - IO dispatch
uint8_t Video::read(int address) {
LOG("[Video] read " << (address & 0x3f));
LOG("[Video] read " << PADHEX(2) << (address & 0x3f));
address &= 0x3f;
switch(address) {
default:
break;
case 0x00: return uint8_t(base_address_ >> 16);
case 0x01: return uint8_t(base_address_ >> 8);
case 0x02: return uint8_t(current_address_ >> 16);
case 0x03: return uint8_t(current_address_ >> 8);
case 0x04: return uint8_t(current_address_);
case 0x30: return video_mode_ | 0xfc;
}
return 0xff;
}
@ -246,6 +248,9 @@ void Video::write(int address, uint16_t value) {
case 0x00: base_address_ = (base_address_ & 0x00ffff) | (value << 16); break;
case 0x01: base_address_ = (base_address_ & 0xff00ff) | (value << 8); break;
// Mode.
case 0x30: video_mode_ = uint8_t(value); break;
// Palette.
case 0x20: case 0x21: case 0x22: case 0x23:
case 0x24: case 0x25: case 0x26: case 0x27:

View File

@ -57,6 +57,8 @@ class Video {
int x = 0, y = 0;
void output_border(int duration);
uint8_t video_mode_ = 0;
};
}