mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-09-29 17:56:59 +00:00
escc: unify compatible and MacRISC addressing.
This commit is contained in:
parent
f1ed56ae9a
commit
c946693450
@ -105,8 +105,7 @@ uint32_t AMIC::read(uint32_t reg_start, uint32_t offset, int size)
|
|||||||
case 1:
|
case 1:
|
||||||
return this->viacuda->read(offset >> 9);
|
return this->viacuda->read(offset >> 9);
|
||||||
case 4: // SCC registers
|
case 4: // SCC registers
|
||||||
this->escc->read_compat((offset >> 1) & 0xF);
|
return this->escc->read((offset >> 1) & 0xF);
|
||||||
return 0;
|
|
||||||
case 0xA: // MACE registers
|
case 0xA: // MACE registers
|
||||||
return this->mace->read((offset >> 4) & 0xF);
|
return this->mace->read((offset >> 4) & 0xF);
|
||||||
case 0x10: // SCSI registers
|
case 0x10: // SCSI registers
|
||||||
@ -186,7 +185,7 @@ void AMIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int size)
|
|||||||
this->viacuda->write(offset >> 9, value);
|
this->viacuda->write(offset >> 9, value);
|
||||||
return;
|
return;
|
||||||
case 4:
|
case 4:
|
||||||
this->escc->write_compat((offset >> 1) & 0xF, value);
|
this->escc->write((offset >> 1) & 0xF, value);
|
||||||
return;
|
return;
|
||||||
case 0xA: // MACE registers
|
case 0xA: // MACE registers
|
||||||
this->mace->write((offset >> 4) & 0xF, value);
|
this->mace->write((offset >> 4) & 0xF, value);
|
||||||
|
@ -134,9 +134,12 @@ uint32_t HeathrowIC::read(uint32_t reg_start, uint32_t offset, int size) {
|
|||||||
case 0x10:
|
case 0x10:
|
||||||
res = this->mesh->read((offset >> 4) & 0xF);
|
res = this->mesh->read((offset >> 4) & 0xF);
|
||||||
break;
|
break;
|
||||||
case 0x12: // ESCC compatible
|
case 0x12: // ESCC compatible addressing
|
||||||
return this->escc->read_compat((offset >> 4) & 0xF);
|
if ((offset & 0xFF) < 16) {
|
||||||
case 0x13: // ESCC MacRISC
|
return this->escc->read((offset >> 1) & 0xF);
|
||||||
|
}
|
||||||
|
// fallthrough
|
||||||
|
case 0x13: // ESCC MacRISC addressing
|
||||||
return this->escc->read((offset >> 4) & 0xF);
|
return this->escc->read((offset >> 4) & 0xF);
|
||||||
case 0x14:
|
case 0x14:
|
||||||
res = this->screamer->snd_ctrl_read(offset - 0x14000, size);
|
res = this->screamer->snd_ctrl_read(offset - 0x14000, size);
|
||||||
@ -173,10 +176,13 @@ void HeathrowIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int
|
|||||||
case 0x10:
|
case 0x10:
|
||||||
this->mesh->write((offset >> 4) & 0xF, value);
|
this->mesh->write((offset >> 4) & 0xF, value);
|
||||||
break;
|
break;
|
||||||
case 0x12: // ESCC compatible
|
case 0x12: // ESCC compatible addressing
|
||||||
this->escc->write_compat((offset >> 4) & 0xF, value);
|
if ((offset & 0xFF) < 16) {
|
||||||
|
this->escc->write((offset >> 1) & 0xF, value);
|
||||||
break;
|
break;
|
||||||
case 0x13: // ESCC MacRISC
|
}
|
||||||
|
// fallthrough
|
||||||
|
case 0x13: // ESCC MacRISC addressing
|
||||||
this->escc->write((offset >> 4) & 0xF, value);
|
this->escc->write((offset >> 4) & 0xF, value);
|
||||||
break;
|
break;
|
||||||
case 0x14:
|
case 0x14:
|
||||||
|
@ -67,38 +67,6 @@ void EsccController::write(uint8_t reg_offset, uint8_t value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t EsccController::read_compat(uint8_t reg_offset)
|
|
||||||
{
|
|
||||||
switch(reg_offset) {
|
|
||||||
case Compat::EsccReg::Port_B_Cmd:
|
|
||||||
LOG_F(9, "ESCC: reading Port B register RR%d", this->reg_ptr);
|
|
||||||
this->reg_ptr = 0;
|
|
||||||
break;
|
|
||||||
case Compat::EsccReg::Port_A_Cmd:
|
|
||||||
LOG_F(9, "ESCC: reading Port A register RR%d", this->reg_ptr);
|
|
||||||
this->reg_ptr = 0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOG_F(INFO, "ESCC: reading register %d", reg_offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EsccController::write_compat(uint8_t reg_offset, uint8_t value)
|
|
||||||
{
|
|
||||||
switch(reg_offset) {
|
|
||||||
case Compat::EsccReg::Port_B_Cmd:
|
|
||||||
this->write_internal(this->ch_b.get(), value);
|
|
||||||
break;
|
|
||||||
case Compat::EsccReg::Port_A_Cmd:
|
|
||||||
this->write_internal(this->ch_a.get(), value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOG_F(INFO, "ESCC: writing 0x%X to register %d", value, reg_offset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EsccController::write_internal(EsccChannel *ch, uint8_t value)
|
void EsccController::write_internal(EsccChannel *ch, uint8_t value)
|
||||||
{
|
{
|
||||||
if (this->reg_ptr) {
|
if (this->reg_ptr) {
|
||||||
|
@ -28,19 +28,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/** ESCC compatible (aka Macintosh legacy) register addressing */
|
/** ESCC register addresses */
|
||||||
namespace Compat {
|
|
||||||
enum EsccReg : uint8_t {
|
|
||||||
Port_B_Cmd = 0,
|
|
||||||
Port_A_Cmd = 1,
|
|
||||||
Port_B_Data = 2,
|
|
||||||
Port_A_Data = 3,
|
|
||||||
Enh_Reg_B = 4,
|
|
||||||
Enh_Reg_A = 5,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/** ESCC MacRISC style register addressing */
|
|
||||||
enum EsccReg : uint8_t {
|
enum EsccReg : uint8_t {
|
||||||
Port_B_Cmd = 0,
|
Port_B_Cmd = 0,
|
||||||
Port_B_Data = 1,
|
Port_B_Data = 1,
|
||||||
@ -50,7 +38,7 @@ enum EsccReg : uint8_t {
|
|||||||
Enh_Reg_A = 5,
|
Enh_Reg_A = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** LocalTalk registers (same in both addressing schemes) */
|
/** LocalTalk LTPC registers */
|
||||||
enum LocalTalkReg : uint8_t {
|
enum LocalTalkReg : uint8_t {
|
||||||
Rec_Count = 8,
|
Rec_Count = 8,
|
||||||
Start_A = 9,
|
Start_A = 9,
|
||||||
@ -81,14 +69,10 @@ public:
|
|||||||
EsccController();
|
EsccController();
|
||||||
~EsccController() = default;
|
~EsccController() = default;
|
||||||
|
|
||||||
// ESCC MacRISC registers access
|
// ESCC registers access
|
||||||
uint8_t read(uint8_t reg_offset);
|
uint8_t read(uint8_t reg_offset);
|
||||||
void write(uint8_t reg_offset, uint8_t value);
|
void write(uint8_t reg_offset, uint8_t value);
|
||||||
|
|
||||||
// ESCC compatible registers access
|
|
||||||
uint8_t read_compat(uint8_t reg_offset);
|
|
||||||
void write_compat(uint8_t reg_offset, uint8_t value);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void write_internal(EsccChannel* ch, uint8_t value);
|
void write_internal(EsccChannel* ch, uint8_t value);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user