mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-20 01:29:43 +00:00
Barebones workings for serial
This commit is contained in:
parent
8094fb30f6
commit
0a1d43db49
@ -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;
|
||||
|
@ -60,6 +60,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include "pcidevice.h"
|
||||
#include "pcihost.h"
|
||||
#include "viacuda.h"
|
||||
#include "z85c30.h"
|
||||
#include <cinttypes>
|
||||
|
||||
/**
|
||||
@ -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;
|
||||
};
|
||||
|
70
devices/z85c30.cpp
Normal file
70
devices/z85c30.cpp
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "devices/z85c30.h"
|
||||
#include <cinttypes>
|
||||
#include <thirdparty/loguru/loguru.hpp>
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
49
devices/z85c30.h
Normal file
49
devices/z85c30.h
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @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 <cinttypes>
|
||||
|
||||
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 */
|
Loading…
x
Reference in New Issue
Block a user