diff --git a/devices/heathrow.cpp b/devices/heathrow.cpp
index 1fe507f..bb64dc7 100644
--- a/devices/heathrow.cpp
+++ b/devices/heathrow.cpp
@@ -121,6 +121,15 @@ uint32_t HeathrowIC::read(uint32_t reg_start, uint32_t offset, int size) {
case 8:
res = dma_read(offset - 0x8000, size);
break;
+ case 0x13:
+ if ((offset - 0x13000) >= 0x20) {
+ LOG_F(INFO, "Serial: Reading from Channel A \n");
+ }
+ else {
+ LOG_F(INFO, "Serial: Reading from Channel B \n");
+ }
+ res = this->serial->read(offset - 0x13000);
+ break;
case 0x14:
res = this->screamer->snd_ctrl_read(offset - 0x14000, size);
break;
@@ -151,6 +160,14 @@ void HeathrowIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int
case 8:
dma_write(offset - 0x8000, value, size);
break;
+ case 0x13:
+ if ((offset - 0x13000) >= 0x20) {
+ LOG_F(INFO, "Serial: Writing to Channel A \n");
+ } else {
+ LOG_F(INFO, "Serial: Writing to Channel B \n");
+ }
+ this->serial->write(offset - 0x13000, value);
+ break;
case 0x14:
this->screamer->snd_ctrl_write(offset - 0x14000, value, size);
break;
diff --git a/devices/macio.h b/devices/macio.h
index 7138c6c..e41b7b0 100644
--- a/devices/macio.h
+++ b/devices/macio.h
@@ -60,6 +60,7 @@ along with this program. If not, see .
#include "pcidevice.h"
#include "pcihost.h"
#include "viacuda.h"
+#include "z85c30.h"
#include
/**
@@ -147,6 +148,7 @@ private:
ViaCuda* viacuda; /* VIA cell with Cuda MCU attached to it */
NVram* nvram; /* NVRAM cell */
AWACDevice* screamer; /* Screamer audio codec instance */
+ Z85C30* serial; /* Serial cell */
DMAChannel* snd_out_dma;
};
diff --git a/devices/z85c30.cpp b/devices/z85c30.cpp
new file mode 100644
index 0000000..af7f32d
--- /dev/null
+++ b/devices/z85c30.cpp
@@ -0,0 +1,70 @@
+/*
+DingusPPC - The Experimental PowerPC Macintosh emulator
+Copyright (C) 2018-20 divingkatae and maximum
+ (theweirdo) spatium
+
+(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+#include "devices/z85c30.h"
+#include
+#include
+
+
+Z85C30::Z85C30() {
+ write_registers[0x04] = 0x04;
+ write_registers[0x09] = 0xC0;
+ write_registers[0x0B] = 0x08;
+ write_registers[0x0E] = 0x30;
+ write_registers[0x0F] = 0xF8;
+
+ read_registers[0x00] = 0x44;
+ read_registers[0x01] = 0x06;
+}
+
+Z85C30::~Z85C30() {
+
+}
+
+uint8_t Z85C30::read(uint8_t reg) {
+ LOG_F(INFO, "Reading from register %d: 0x%x \n", reg, this->write_registers[reg]);
+ return this->write_registers[reg];
+}
+
+void Z85C30::write(uint8_t reg, uint8_t value) {
+ LOG_F(INFO, "Writing value 0x%x to register %d \n", value, reg);
+
+ if (reg == 0x07) {
+ if (this->enable_wr7_alt) {
+ this->wr7_alt = value;
+ }
+ else {
+ this->write_registers[0x07] = value;
+ }
+ }
+ else {
+ this->write_registers[reg] = value;
+ }
+
+ if (reg == 0x0F) {
+ if (this->write_registers[0x0F] & 0x1) {
+ this->enable_wr7_alt = true;
+ }
+ else{
+ this->enable_wr7_alt = false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/devices/z85c30.h b/devices/z85c30.h
new file mode 100644
index 0000000..5c98dc0
--- /dev/null
+++ b/devices/z85c30.h
@@ -0,0 +1,49 @@
+/*
+DingusPPC - The Experimental PowerPC Macintosh emulator
+Copyright (C) 2018-20 divingkatae and maximum
+ (theweirdo) spatium
+
+(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+/** @file Descriptor-based direct memory access emulation.
+
+ Official documentation can be found in the fifth chapter of the book
+ "Macintosh Technology in the Common Hardware Reference Platform"
+ by Apple Computer, Inc.
+ */
+
+#ifndef Z85C30_H
+#define Z85C30_H
+
+#include
+
+class Z85C30 {
+public:
+ Z85C30();
+ ~Z85C30();
+
+ uint8_t read(uint8_t reg);
+ void write(uint8_t reg, uint8_t value);
+
+ private:
+ uint8_t read_registers[16] = {0x00};
+ uint8_t write_registers[16] = {0x00};
+ uint8_t wr7_alt = 0x20;
+ bool enable_wr7_alt = false;
+};
+
+#endif /* Z85C30_H */
\ No newline at end of file