1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Improves IIe paging further.

This commit is contained in:
Thomas Harte 2018-07-29 23:02:27 -04:00
parent 632b37ecec
commit 5aa0b17720
2 changed files with 16 additions and 16 deletions

View File

@ -57,17 +57,17 @@ template <bool is_iie> class ConcreteMachine:
private: private:
struct VideoBusHandler : public AppleII::Video::BusHandler { struct VideoBusHandler : public AppleII::Video::BusHandler {
public: public:
VideoBusHandler(uint8_t *ram) : ram_(ram) {} VideoBusHandler(uint8_t *ram, uint8_t *aux_ram) : ram_(ram), aux_ram_(aux_ram) {}
uint8_t perform_read(uint16_t address) { uint8_t perform_read(uint16_t address) {
return ram_[address]; return ram_[address];
} }
uint16_t perform_aux_read(uint16_t address) { uint16_t perform_aux_read(uint16_t address) {
return static_cast<uint16_t>(ram_[address] | (ram_[address] << 8)); return static_cast<uint16_t>(ram_[address] | (aux_ram_[address] << 8));
} }
private: private:
uint8_t *ram_; uint8_t *ram_, *aux_ram_;
}; };
CPU::MOS6502::Processor<ConcreteMachine, false> m6502_; CPU::MOS6502::Processor<ConcreteMachine, false> m6502_;
@ -212,12 +212,14 @@ template <bool is_iie> class ConcreteMachine:
bool read_auxiliary_memory_ = false; bool read_auxiliary_memory_ = false;
bool write_auxiliary_memory_ = false; bool write_auxiliary_memory_ = false;
void set_main_paging() { void set_main_paging() {
printf("80store: %d; page2:%d; rdaux: %d; wraux:%d\n", video_->get_80_store(), video_->get_page2(), read_auxiliary_memory_, write_auxiliary_memory_);
bool store_80 = video_->get_80_store();
for(int target = 0x02; target < 0xc0; ++target) { for(int target = 0x02; target < 0xc0; ++target) {
write_pages_[target] = write_auxiliary_memory_ ? &aux_ram_[target << 8] : &ram_[target << 8]; write_pages_[target] = !store_80 && write_auxiliary_memory_ ? &aux_ram_[target << 8] : &ram_[target << 8];
read_pages_[target] = read_auxiliary_memory_ ? &aux_ram_[target << 8] : &ram_[target << 8]; read_pages_[target] = !store_80 && read_auxiliary_memory_ ? &aux_ram_[target << 8] : &ram_[target << 8];
} }
if(video_->get_80_store()) { if(store_80) {
int start_page, end_page; int start_page, end_page;
if(video_->get_text()) { if(video_->get_text()) {
start_page = 0x4; start_page = 0x4;
@ -294,7 +296,7 @@ template <bool is_iie> class ConcreteMachine:
public: public:
ConcreteMachine(const Analyser::Static::AppleII::Target &target, const ROMMachine::ROMFetcher &rom_fetcher): ConcreteMachine(const Analyser::Static::AppleII::Target &target, const ROMMachine::ROMFetcher &rom_fetcher):
m6502_(*this), m6502_(*this),
video_bus_handler_(ram_), video_bus_handler_(ram_, aux_ram_),
audio_toggle_(audio_queue_), audio_toggle_(audio_queue_),
speaker_(audio_toggle_) { speaker_(audio_toggle_) {
// The system's master clock rate. // The system's master clock rate.
@ -420,10 +422,6 @@ template <bool is_iie> class ConcreteMachine:
if(isReadOperation(operation)) *value = read_pages_[address >> 8][address & 0xff]; if(isReadOperation(operation)) *value = read_pages_[address >> 8][address & 0xff];
else if(write_pages_[address >> 8]) write_pages_[address >> 8][address & 0xff] = *value; else if(write_pages_[address >> 8]) write_pages_[address >> 8][address & 0xff] = *value;
// if(!isReadOperation(operation) && address >= 0xd000) {
// printf("%02x -> %04x (%04x)\n", *value, address, &write_pages_[address >> 8][address & 0xff] - ram_);
// }
if(should_load_quickly_) { if(should_load_quickly_) {
// Check for a prima facie entry into RWTS. // Check for a prima facie entry into RWTS.
if(operation == CPU::MOS6502::BusOperation::ReadOpcode && address == 0xb7b5) { if(operation == CPU::MOS6502::BusOperation::ReadOpcode && address == 0xb7b5) {
@ -619,7 +617,10 @@ template <bool is_iie> class ConcreteMachine:
case 0xc00d: video_->set_80_columns(!!(address&1)); break; case 0xc00d: video_->set_80_columns(!!(address&1)); break;
case 0xc000: case 0xc000:
case 0xc001: video_->set_80_store(!!(address&1)); break; case 0xc001:
video_->set_80_store(!!(address&1));
set_main_paging();
break;
case 0xc05e: case 0xc05e:
case 0xc05f: video_->set_double_high_resolution(!(address&1)); break; case 0xc05f: video_->set_double_high_resolution(!(address&1)); break;
@ -883,4 +884,3 @@ Machine *Machine::AppleII(const Analyser::Static::Target *target, const ROMMachi
} }
Machine::~Machine() {} Machine::~Machine() {}

View File

@ -295,13 +295,13 @@ template <class BusHandler> class Video: public VideoBase {
for(int c = column_; c < pixel_end; ++c) { for(int c = column_; c < pixel_end; ++c) {
const uint16_t characters = bus_handler_.perform_aux_read(static_cast<uint16_t>(text_address + c)); const uint16_t characters = bus_handler_.perform_aux_read(static_cast<uint16_t>(text_address + c));
const std::size_t character_addresses[2] = { const std::size_t character_addresses[2] = {
static_cast<std::size_t>(((characters & 0x3f) << 3) + pixel_row),
static_cast<std::size_t>((((characters >> 8) & 0x3f) << 3) + pixel_row), static_cast<std::size_t>((((characters >> 8) & 0x3f) << 3) + pixel_row),
static_cast<std::size_t>(((characters & 0x3f) << 3) + pixel_row),
}; };
const uint8_t character_patterns[2] = { const uint8_t character_patterns[2] = {
static_cast<uint8_t>(character_rom_[character_addresses[0]] ^ inverses[(characters >> 6) & 3]), static_cast<uint8_t>(character_rom_[character_addresses[0]] ^ inverses[(characters >> 14) & 3]),
static_cast<uint8_t>(character_rom_[character_addresses[1]] ^ inverses[(characters >> 14) & 3]), static_cast<uint8_t>(character_rom_[character_addresses[1]] ^ inverses[(characters >> 6) & 3]),
}; };
// The character ROM is output MSB to LSB rather than LSB to MSB. // The character ROM is output MSB to LSB rather than LSB to MSB.