mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-09 05:25:01 +00:00
For debugging, adds a dump of anything in the [presumably] text buffer.
Nothing is there.
This commit is contained in:
@@ -84,6 +84,7 @@ class ConcreteMachine:
|
|||||||
ram_.resize(ram_size * 1024);
|
ram_.resize(ram_size * 1024);
|
||||||
|
|
||||||
memory_.set_storage(ram_, rom_);
|
memory_.set_storage(ram_, rom_);
|
||||||
|
video_.set_internal_ram(&ram_[ram_.size() - 128*1024]);
|
||||||
|
|
||||||
// TODO: enable once machine is otherwise sane.
|
// TODO: enable once machine is otherwise sane.
|
||||||
// Memory::Fuzz(ram_);
|
// Memory::Fuzz(ram_);
|
||||||
|
@@ -22,12 +22,35 @@ VideoBase::VideoBase() :
|
|||||||
VideoSwitches<Cycles>(Cycles(2), [] (Cycles) {}) {
|
VideoSwitches<Cycles>(Cycles(2), [] (Cycles) {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoBase::set_internal_ram(const uint8_t *ram) {
|
||||||
|
ram_ = ram;
|
||||||
|
}
|
||||||
|
|
||||||
void VideoBase::did_set_annunciator_3(bool) {}
|
void VideoBase::did_set_annunciator_3(bool) {}
|
||||||
void VideoBase::did_set_alternative_character_set(bool) {}
|
void VideoBase::did_set_alternative_character_set(bool) {}
|
||||||
|
|
||||||
void VideoBase::run_for(Cycles cycles) {
|
void VideoBase::run_for(Cycles cycles) {
|
||||||
// TODO: everything else!
|
// TODO: everything else!
|
||||||
|
const auto old = cycles_into_frame_;
|
||||||
cycles_into_frame_ = (cycles_into_frame_ + cycles.as<int>()) % (CyclesPerLine * Lines);
|
cycles_into_frame_ = (cycles_into_frame_ + cycles.as<int>()) % (CyclesPerLine * Lines);
|
||||||
|
|
||||||
|
// DEBUGGING HACK!!
|
||||||
|
// Scan the output buffer, assuming this is 40-column text mode, and print anything found.
|
||||||
|
if(cycles_into_frame_ < old) {
|
||||||
|
for(int line = 0; line < 192; line += 8) {
|
||||||
|
const uint16_t address = get_row_address(line);
|
||||||
|
|
||||||
|
bool did_print_line = false;
|
||||||
|
for(int column = 0; column < 40; column++) {
|
||||||
|
const char c = char(ram_[address + column]);
|
||||||
|
if(c > 0) {
|
||||||
|
printf("%c", c);
|
||||||
|
did_print_line = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(did_print_line) printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoBase::get_is_vertical_blank() {
|
bool VideoBase::get_is_vertical_blank() {
|
||||||
|
@@ -19,6 +19,7 @@ namespace Video {
|
|||||||
class VideoBase: public Apple::II::VideoSwitches<Cycles> {
|
class VideoBase: public Apple::II::VideoSwitches<Cycles> {
|
||||||
public:
|
public:
|
||||||
VideoBase();
|
VideoBase();
|
||||||
|
void set_internal_ram(const uint8_t *);
|
||||||
|
|
||||||
void run_for(Cycles);
|
void run_for(Cycles);
|
||||||
bool get_is_vertical_blank();
|
bool get_is_vertical_blank();
|
||||||
@@ -41,6 +42,7 @@ class VideoBase: public Apple::II::VideoSwitches<Cycles> {
|
|||||||
void set_interrupts(uint8_t);
|
void set_interrupts(uint8_t);
|
||||||
|
|
||||||
int cycles_into_frame_ = 0;
|
int cycles_into_frame_ = 0;
|
||||||
|
const uint8_t *ram_ = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Video: public VideoBase {
|
class Video: public VideoBase {
|
||||||
|
Reference in New Issue
Block a user