2016-10-12 23:20:23 +00:00
|
|
|
//
|
|
|
|
// Video.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 12/10/2016.
|
|
|
|
// Copyright © 2016 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef Video_hpp
|
|
|
|
#define Video_hpp
|
|
|
|
|
|
|
|
#include "../../Outputs/CRT/CRT.hpp"
|
|
|
|
|
|
|
|
namespace Oric {
|
|
|
|
|
|
|
|
class VideoOutput {
|
|
|
|
public:
|
|
|
|
VideoOutput(uint8_t *memory);
|
2016-10-13 01:29:21 +00:00
|
|
|
std::shared_ptr<Outputs::CRT::CRT> get_crt();
|
2016-10-12 23:20:23 +00:00
|
|
|
void run_for_cycles(int number_of_cycles);
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t *_ram;
|
2016-10-13 01:29:21 +00:00
|
|
|
std::shared_ptr<Outputs::CRT::CRT> _crt;
|
|
|
|
|
|
|
|
// Counters
|
|
|
|
int _counter, _frame_counter;
|
|
|
|
|
|
|
|
// Output state
|
|
|
|
enum State {
|
2016-10-15 02:39:27 +00:00
|
|
|
Blank, Sync, Pixels, ColourBurst
|
2016-10-13 01:29:21 +00:00
|
|
|
} _state;
|
|
|
|
unsigned int _cycles_in_state;
|
|
|
|
uint8_t *_pixel_target;
|
|
|
|
|
|
|
|
// Registers
|
2016-10-13 23:34:29 +00:00
|
|
|
uint8_t _ink, _paper;
|
|
|
|
|
2016-10-13 11:59:11 +00:00
|
|
|
int _character_set_base_address;
|
2016-10-13 23:34:29 +00:00
|
|
|
inline void set_character_set_base_address()
|
|
|
|
{
|
|
|
|
if(_is_graphics_mode) _character_set_base_address = _use_alternative_character_set ? 0x9c00 : 0x9800;
|
|
|
|
else _character_set_base_address = _use_alternative_character_set ? 0xb800 : 0xb400;
|
|
|
|
}
|
|
|
|
|
2016-10-13 01:52:47 +00:00
|
|
|
bool _is_graphics_mode;
|
2016-10-13 23:34:29 +00:00
|
|
|
bool _is_sixty_hertz;
|
|
|
|
bool _use_alternative_character_set;
|
|
|
|
bool _use_double_height_characters;
|
|
|
|
bool _blink_text;
|
2016-10-15 02:39:27 +00:00
|
|
|
|
|
|
|
uint8_t _phase;
|
2016-10-12 23:20:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* Video_hpp */
|