1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-11 08:30:55 +00:00

Hard-coded to 40 columns of black and white, here's some text, at least.

This commit is contained in:
Thomas Harte 2016-01-09 22:39:46 -05:00
parent 037602765a
commit 1308332a71
2 changed files with 34 additions and 8 deletions

View File

@ -229,23 +229,47 @@ inline void Machine::update_display()
{
_crt->output_blank(15 * crt_cycles_multiplier);
_outputPosition += 15;
_crt->output_data(80 * crt_cycles_multiplier);
uint8_t *output = (uint8_t *)_crt->get_write_target_for_buffer(0);
for(int c = 0; c < 80 * crt_cycles_multiplier; c++)
{
output[c] = (uint8_t)(c&7);
}
_crt->allocate_write_area(80 * crt_cycles_multiplier);
_currentLine = (uint8_t *)_crt->get_write_target_for_buffer(0);
if(current_line == 28)
_startLineAddress = _startScreenAddress;
_currentScreenAddress = _startLineAddress;
}
if(line_position >= 24 && line_position < 104)
{
// TODO: actually output some pixels, why not?
if(_currentLine)
{
if(!(line_position&1))
{
uint8_t pixels = _ram[_currentScreenAddress];
_currentScreenAddress += 8;
int output_ptr = (line_position - 24) << 3;
for(int c = 0; c < 16; c+=2)
{
_currentLine[output_ptr + c] = (pixels&0x80) ? 0 : 7;
_currentLine[output_ptr + c + 1] = (pixels&0x80) ? 0 : 7;
pixels <<= 1;
}
}
}
_outputPosition++;
}
if(line_position == 104)
{
if(!((current_line - 27)&7))
{
_startLineAddress += 40*8 - 7;
}
else
_startLineAddress++;
_currentLine = nullptr;
_crt->output_data(80 * crt_cycles_multiplier);
_crt->output_blank(24 * crt_cycles_multiplier);
_outputPosition += 24;
}

View File

@ -54,12 +54,14 @@ class Machine: public CPU6502::Processor<Machine> {
private:
uint8_t _os[16384], _basic[16384], _ram[32768];
uint8_t _interruptStatus, _interruptControl;
uint8_t palette[16];
ROMSlot _activeRom;
Outputs::CRT *_crt;
int _frameCycles, _outputPosition;
uint16_t _startScreenAddress, _currentScreenAddress;
uint16_t _startScreenAddress, _startLineAddress, _currentScreenAddress;
uint8_t *_currentLine;
inline void update_display();
inline void signal_interrupt(Interrupt interrupt);