Compare commits

...
38 Commits
Author SHA1 Message Date
dingusdev 5bc1260dbb Start MTSPR/MFSPR refactor 2026-02-11 08:02:40 -07:00
dingusdev e46414721d Name DSISR bits 2026-01-22 19:07:43 -07:00
dingusdev 79784cd36c Initial improvements 2026-01-21 21:17:52 -07:00
joevt d693b0f443 maciotwo: Fix IDE read/write mask again.
Use the entire 4K range.
2026-01-20 07:07:11 -07:00
joevt 5c646e8270 maciotwo: Add methods to override OHARE_ID ids. 2026-01-17 08:40:45 -07:00
joevt 65c5d2425e maciotwo: Fix IDE read/write mask. 2026-01-17 07:02:06 -07:00
joevt f2676e0324 maciotwo: Make Ide1 optional.
Some Macs that use OHare do not have a second ATA bus exposed by Open
Firmware. Allow Ide1 to not be included.

# Conflicts:
#	devices/ioctrl/maciotwo.cpp
2026-01-17 06:54:44 -07:00
dingusdev 48adf99690 Documentation cleanup 2026-01-15 07:39:59 -07:00
joevt 3c0432053b atadefs: Add KeyLargo ATA interrupt register note. 2026-01-15 07:37:17 -07:00
joevt ebc2fcf216 atabasedevice: Add missing this. 2026-01-15 07:36:52 -07:00
joevt 25c74f76d2 idechannel: Fix read and write virtual methods. 2026-01-15 07:35:11 -07:00
dingusdev e3839bdea6 Start vendor-specific SCSI commands 2026-01-12 22:11:11 -07:00
dingusdev 742a810624 Restored floating point testing 2026-01-07 18:45:47 -07:00
dingusdev dbc10ab027 Clean-up for mode_sense_ex 2026-01-03 16:44:08 -07:00
joevt 383f6dd9a1 atahd: Fix endianness in prepare_identify_info.
Use endian macros for fields that have a specific endianness.
2026-01-03 11:22:19 -07:00
joevt be04300846 ppcexec: Add missing registers for disassembly. 2026-01-03 11:18:33 -07:00
Maxim Poliakovski 80c1ebe57d atahd: report max. PIO mode for a basic device.
Prepare identify info for advanced PIO and
Multiword DMA modes but leave them disabled
because ATA DMA doesn't work yet.
2026-01-02 22:12:53 +01:00
Maxim Poliakovski 5996358308 maciotwo: initialize and connect IDE DMA channels. 2026-01-02 21:30:21 +01:00
Maxim Poliakovski 380827e09b idechannel: inherit IdeChannel from DmaDevice. 2026-01-02 21:30:21 +01:00
Maxim Poliakovski c4be881d52 atabasedevice: add push_data and pull_data methods. 2026-01-02 21:30:21 +01:00
joevt ae56bb3743 viacuda: Add append_data for setting out_buf. 2026-01-01 07:25:30 -07:00
joevt fd5bcddcb7 viacuda: Create method for single byte packets. 2026-01-01 07:20:24 -07:00
joevt af8124a525 display_sdl: Set to null after destroy. 2026-01-01 07:14:28 -07:00
dingusdev 8105defb0b Fill out MACE stub further
Last commit of 2025. This will be further expanded next year.
2025-12-31 21:29:49 -07:00
dingusdev 7429a4111e atadefs.h: add SLEEP command code. 2025-12-29 18:37:53 +01:00
dingusdev a537d09c63 Add Page Code 0x1a for CD ROM 2025-12-27 16:01:57 -07:00
dingusdev 7fdb11d64f Another fix-up attempt 2025-12-26 18:16:25 -07:00
dingusdev 5567041c2b Fix std prefix 2025-12-26 08:07:31 -07:00
dingusdev c94cfe0d40 Add GET_CONFIG to ATAPI CD-ROM 2025-12-26 07:22:48 -07:00
Maxim Poliakovski 73d5a2374b viacuda: fix GET/SET_DEVICE_BITMAP again.
Keep only related stuff this time.
2025-12-08 02:53:36 +01:00
Maxim Poliakovski 017f559e90 Revert "viacuda: Fix CUDA_GET_DEVICE_BITMAP."
This reverts commit 2b0b926f52.
2025-12-08 02:53:36 +01:00
dingusdev 29f9ab14ee Merge pull request #157 from mrpapersonic/floppy-cleanup
Clean up floppy signature detection code.
2025-12-06 15:04:39 -07:00
dingusdev 17b2a1a6e4 Merge pull request #158 from mrpapersonic/libstdcpp-build-fix
Fix build fail on linux/libstdc++
2025-12-06 11:58:11 -07:00
Paper 77f1f72122 devices/memctrl/psx: fixed build fail on linux/libstdc++ 2025-12-06 13:00:46 -05:00
Paper 03ec9d9589 devices/floppy/floppyimg: use lambda function for HFS/MFS signature check
this is more obvious to read at a glance.
2025-12-06 08:51:35 -05:00
dingusdev b813a080da Add additional registers to read for DMAReg 2025-12-04 06:52:48 -07:00
joevt 2b0b926f52 viacuda: Fix CUDA_GET_DEVICE_BITMAP.
Bitmap should be at byte 3 and 4, not 2 and 3.
2025-12-02 07:44:53 -07:00
dingusdev 0ac0a5b77e Handle arbitration lost in Mesh 2025-12-01 08:29:05 -07:00
34 changed files with 453 additions and 123 deletions

No files matched your search

+19 -11
View File
@@ -8,17 +8,19 @@ Be warned the program is highly unfinished and could use a lot of testing. Any f
While many other PowerPC emus exist (PearPC, Sheepshaver), none of them currently attempt emulation of PowerPC Macs accurately (except for QEMU).
This program aims to not only improve upon what Sheepshaver, PearPC, and other PowerPC Mac emulators have done, but also to provide a better debugging environment. This currently is designed to work best with PowerPC Old World ROMs, including those of the Power Mac 6100, 7200, and G3 Beige.
This program aims to not only improve upon what Sheepshaver, PearPC, and other PowerPC Mac emulators have done, but also to provide a better debugging environment. This currently is designed to work best with PowerPC NuBus and Old World ROMs, including those of the Power Mac 6100, 7200, and G3 Beige.
## Implemented Features
This emulator has a debugging environment, complete with a disassembler. We also have implemented enough to allow Open Firmware to boot, going so far as to allow audio playback of the boot-up jingles.
Several machines have been implemented to varying degrees, like many Old World PowerPC Macs, early New World PowerPC Macs, and the Pippin.
This emulator has a debugging environment, complete with a disassembler.
## How to Use
This program currently uses the command prompt to work.
There are a few command line arguments one must enter when starting the program.
There are a few command line arguments one can enter when starting the program.
```
-r, --realtime
@@ -36,21 +38,31 @@ Enter the interactive debugger.
-b, --bootrom TEXT:FILE
```
Specifies the Boot ROM path (optional; looks for bootrom.bin by default)
Specifies the Boot ROM path. It otherwise looks for bootrom.bin.
```
-m, --machine TEXT
```
Specify machine ID (optional; will attempt to determine machine ID from the boot rom otherwise)
Specify machine ID. Otherwise, the emulator will attempt to determine machine ID from the boot rom otherwise.
As of now, the most complete machines are the Power Mac 6100 (SCSI emulation in progress) and the Power Mac G3 Beige (SCSI + ATA emulation in progress, No ATI Rage acceleration).
As of now, the most complete machines are the Power Mac 6100, the Power Mac 7500, and the Power Mac G3 Beige.
To go into to the debugger regardless of how you started the emulator, press Control and C on the terminal window.
## How to Compile
You need to install development tools first.
At least, a C++20 compliant compiler and [CMake](https://cmake.org) are required.
At minimum, a C++20 compliant compiler and [CMake](https://cmake.org) are required.
Clone the repository using the appropriate command:
```
git clone https://github.com/dingusdev/dingusppc
```
If this is from a mirror, replace the argument with the source you want to use instead.
You will also have to recursive clone or run
```
@@ -100,7 +112,3 @@ make testppc
- 2 GB of RAM
- 2 GB of Hard Disk Space
- Graphics Card with a minimum resolution of 800*600
## Compiler Requirements
- Any C++20 compatible compiler
+8
View File
@@ -106,6 +106,7 @@ enum SPR : int {
SPRG1 = 273,
SPRG2 = 274,
SPRG3 = 275,
EAR = 282,
TBL_S = 284, // supervisor TBL
TBU_S = 285, // supervisor TBU
PVR = 287,
@@ -114,6 +115,8 @@ enum SPR : int {
PMC2 = 954,
SIA = 955,
MMCR1 = 956,
PMC3 = 957,
PMC4 = 958,
SDA = 959,
HID0 = 1008,
HID1 = 1009,
@@ -301,6 +304,11 @@ enum XER : uint32_t {
SO = 1UL << 31
};
enum DSISR : uint32_t {
PROT = 1UL << 27,
STORE = 1UL << 25
};
//for inf and nan checks
enum FPOP : int {
DIV = 0x12,
+2 -1
View File
@@ -899,7 +899,8 @@ static map<string, int> SPRName2Num = {
{"SDR1", SPR::SDR1}, {"MQ", SPR::MQ}, {"RTCU", SPR::RTCU_S},
{"RTCL", SPR::RTCL_S}, {"DSISR", SPR::DSISR}, {"DAR", SPR::DAR},
{"MMCR0", SPR::MMCR0}, {"PMC1", SPR::PMC1}, {"PMC2", SPR::PMC2},
{"SDA", SPR::SDA}, {"SIA", SPR::SIA}, {"MMCR1", SPR::MMCR1}
{"SDA", SPR::SDA}, {"SIA", SPR::SIA}, {"MMCR1", SPR::MMCR1},
{"PMC3", SPR::PMC3}, {"PMC4", SPR::PMC4},
};
static uint64_t reg_op(string& reg_name, uint64_t val, bool is_write) {
+20 -14
View File
@@ -540,12 +540,11 @@ static TLBEntry* tlb2_target_entry(uint32_t gp_va)
}
}
static TLBEntry* itlb2_refill(uint32_t guest_va)
{
static TLBEntry* itlb2_refill(uint32_t guest_va) {
BATResult bat_res;
uint32_t phys_addr;
TLBEntry *tlb_entry;
uint16_t flags = 0;
TLBEntry* tlb_entry = nullptr;
uint16_t flags = 0;
/* instruction address translation if enabled */
if (ppc_state.msr & MSR::IR) {
@@ -555,11 +554,13 @@ static TLBEntry* itlb2_refill(uint32_t guest_va)
} else {
bat_res = ppc_block_address_translation<BATType::IBAT>(guest_va);
}
if (bat_res.hit) {
// check block protection
// only PP = 0 (no access) causes ISI exception
if (!bat_res.prot) {
mmu_exception_handler(Except_Type::EXC_ISI, 0x08000000);
return nullptr; // Stop refill on exception
}
phys_addr = bat_res.phys;
flags |= TLBFlags::TLBE_FROM_BAT; // tell the world we come from
@@ -567,7 +568,7 @@ static TLBEntry* itlb2_refill(uint32_t guest_va)
// page address translation
PATResult pat_res = page_address_translation(guest_va, true, !!(ppc_state.msr & MSR::PR), 0);
phys_addr = pat_res.phys;
flags = TLBFlags::TLBE_FROM_PAT; // tell the world we come from
flags |= TLBFlags::TLBE_FROM_PAT; // tell the world we come from
}
} else { // instruction translation disabled
phys_addr = guest_va;
@@ -577,18 +578,23 @@ static TLBEntry* itlb2_refill(uint32_t guest_va)
AddressMapEntry* rgn_desc = mem_ctrl_instance->find_range(phys_addr);
if (rgn_desc) {
if (rgn_desc->type & RT_MMIO) {
ABORT_F("Instruction fetch from MMIO region at 0x%08X!\n", phys_addr);
// TODO: ISI or Machine Check for this?
mmu_exception_handler(Except_Type::EXC_ISI, 0x40000000);
}
// refill the secondary TLB
const uint32_t tag = guest_va & ~0xFFFUL;
tlb_entry = tlb2_target_entry<TLBType::ITLB>(tag);
tlb_entry->tag = tag;
tlb_entry->flags = flags | TLBFlags::PAGE_MEM;
tlb_entry->host_va_offs_r = (int64_t)rgn_desc->mem_ptr - guest_va +
(phys_addr - rgn_desc->start);
const uint32_t page_base = guest_va & ~0xFFFUL;
tlb_entry = tlb2_target_entry<TLBType::ITLB>(page_base);
tlb_entry->tag = page_base;
tlb_entry->flags = flags | TLBFlags::PAGE_MEM;
// Calculate offset based on page base to ensure alignment
tlb_entry->host_va_offs_r = (int64_t)rgn_desc->mem_ptr - (int64_t)page_base +
((phys_addr & ~0xFFFUL) - rgn_desc->start);
tlb_entry->phys_tag = phys_addr & ~0xFFFUL;
} else {
ABORT_F("Instruction fetch from unmapped memory at 0x%08X!\n", phys_addr);
// TODO: ISI or Machine Check for this?
mmu_exception_handler(Except_Type::EXC_ISI, 0x40000000);
}
return tlb_entry;
@@ -618,7 +624,7 @@ static TLBEntry* dtlb2_refill(uint32_t guest_va, int is_write, bool is_dbg = fal
LOG_F(9, "BAT DSI exception in TLB2 refill!");
if (!is_dbg)
LOG_F(9, "Attempt to write to read-only region, LA=0x%08X, PC=0x%08X!", guest_va, ppc_state.pc);
ppc_state.spr[SPR::DSISR] = 0x08000000 | (is_write << 25);
ppc_state.spr[SPR::DSISR] = DSISR::PROT | (is_write << 25);
ppc_state.spr[SPR::DAR] = guest_va;
mmu_exception_handler(Except_Type::EXC_DSI, 0);
}
+45 -4
View File
@@ -936,6 +936,11 @@ void dppc_interpreter::ppc_mfspr(uint32_t opcode) {
}
switch (ref_spr) {
case SPR::XER:
case SPR::LR:
case SPR::CTR:
ppc_state.gpr[reg_d] = ppc_state.spr[ref_spr];
break;
case SPR::MQ:
if (!(is_601 || include_601)) {
ppc_exception_handler(Except_Type::EXC_PROGRAM, Exc_Cause::ILLEGAL_OP);
@@ -987,8 +992,23 @@ void dppc_interpreter::ppc_mfspr(uint32_t opcode) {
ppc_state.spr[TBL_S] = uint32_t(tbr_value);
break;
}
case SPR::DSISR:
case SPR::DAR:
case SPR::SRR0:
case SPR::SRR1:
case SPR::PVR:
case SPR::EAR:
ppc_state.gpr[reg_d] = ppc_state.spr[ref_spr];
break;
case SPR::SPRG0:
case SPR::SPRG1:
case SPR::SPRG2:
case SPR::SPRG3:
ppc_state.gpr[reg_d] = ppc_state.spr[ref_spr];
break;
default:
// FIXME: Unknown SPR should be noop or illegal instruction.
LOG_F(ERROR, "Mystery SPR in MFSPR: %d", ref_spr);
ppc_state.gpr[reg_d] = ppc_state.spr[ref_spr];
}
}
@@ -1010,6 +1030,13 @@ void dppc_interpreter::ppc_mtspr(uint32_t opcode) {
uint32_t val = ppc_state.gpr[reg_d];
switch (ref_spr) {
case SPR::XER:
ppc_state.spr[ref_spr] = val & 0xe000ff7f;
break;
case SPR::LR:
case SPR::CTR:
ppc_state.spr[ref_spr] = val;
break;
case SPR::MQ:
if (is_601 || include_601)
ppc_state.spr[ref_spr] = val;
@@ -1019,13 +1046,13 @@ void dppc_interpreter::ppc_mtspr(uint32_t opcode) {
case SPR::RTCL_U:
case SPR::RTCU_U:
case SPR::DEC_U:
if (!is_601) {
if (is_601) {
ppc_state.spr[ref_spr] = val;
}
else {
ppc_exception_handler(Except_Type::EXC_PROGRAM, Exc_Cause::ILLEGAL_OP);
}
break;
case SPR::XER:
ppc_state.spr[ref_spr] = val & 0xe000ff7f;
break;
case SPR::SDR1:
if (ppc_state.spr[ref_spr] != val) {
ppc_state.spr[ref_spr] = val;
@@ -1058,6 +1085,19 @@ void dppc_interpreter::ppc_mtspr(uint32_t opcode) {
ppc_state.spr[TBL_S] = (uint32_t)tbr_wr_value;
ppc_state.spr[TBU_S] = val;
break;
case SPR::DSISR:
case SPR::DAR:
case SPR::SRR0:
case SPR::SRR1:
case SPR::EAR:
ppc_state.spr[ref_spr] = val;
break;
case SPR::SPRG0:
case SPR::SPRG1:
case SPR::SPRG2:
case SPR::SPRG3:
ppc_state.spr[ref_spr] = val;
break;
case SPR::PVR:
break;
case 528:
@@ -1084,6 +1124,7 @@ void dppc_interpreter::ppc_mtspr(uint32_t opcode) {
break;
default:
// FIXME: Unknown SPR should be noop or illegal instruction.
LOG_F(ERROR, "Mystery SPR in MTSPR: %d", ref_spr);
ppc_state.spr[ref_spr] = val;
}
}
+2 -1
View File
@@ -321,7 +321,8 @@ int main() {
initialize_ppc_opcode_table(); //kludge
// MPC601 sets MSR[ME] bit during hard reset / Power-On.
// Also set MSR[FP] bit so we can test FPU instructions.
ppc_state.msr = (MSR::ME | MSR::IP | MSR::FP);
int new_msr = (MSR::ME | MSR::IP | MSR::FP);
ppc_msr_did_change(ppc_state.msr, new_msr, false);
cout << "Running DingusPPC emulator tests..." << endl << endl;
+36 -3
View File
@@ -21,13 +21,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
/** @file Basic ATA device emulation. */
#include <core/timermanager.h>
#include <devices/common/ata/atabasedevice.h>
#include <devices/common/ata/atadefs.h>
#include <devices/common/ata/idechannel.h>
#include <loguru.hpp>
#include <cstring>
#include <cinttypes>
#include <core/timermanager.h>
using namespace ata_interface;
@@ -110,7 +111,7 @@ uint16_t AtaBaseDevice::read(const uint8_t reg_addr) {
void AtaBaseDevice::write(const uint8_t reg_addr, const uint16_t value) {
switch (reg_addr) {
case ATA_Reg::DATA:
if (is_selected() && this->has_data()) {
if (this->is_selected() && this->has_data()) {
*this->cur_data_ptr++ = BYTESWAP_16(value);
this->chunk_cnt -= 2;
if (this->chunk_cnt <= 0) {
@@ -159,7 +160,7 @@ void AtaBaseDevice::write(const uint8_t reg_addr, const uint16_t value) {
break;
}
this->r_command = value;
if (is_selected() || this->r_command == DIAGNOSTICS) {
if (this->is_selected() || this->r_command == DIAGNOSTICS) {
perform_command();
}
break;
@@ -191,6 +192,38 @@ void AtaBaseDevice::device_control(const uint8_t new_ctrl) {
this->r_dev_ctrl = new_ctrl;
}
int AtaBaseDevice::pull_data(uint8_t *buf, int len) {
if (!this->xfer_cnt || !this->is_dma_xfer)
return 0;
int xfer_size = std::min(this->xfer_cnt, len);
if (this->xfer_cnt != len)
LOG_F(WARNING, "%s: xfer_cnt != len", this->name.c_str());
//for (int i = 0; i < xfer_size >> 1; i++)
// this->data_ptr[i] = BYTESWAP_16(this->data_ptr[i]);
std::memcpy(buf, this->data_ptr, xfer_size);
this->xfer_cnt -= xfer_size;
if (!this->xfer_cnt) {
TimerManager::get_instance()->add_oneshot_timer(500, [this]() {
this->r_status &= ~(BSY | DRQ);
this->update_intrq(1);
});
} else {
this->r_status &= ~BSY;
this->r_status |= DRQ;
}
return xfer_size;
}
int AtaBaseDevice::push_data(uint8_t *buf, int len) {
return 0;
}
void AtaBaseDevice::update_intrq(uint8_t new_intrq_state) {
if (!this->is_selected() || (this->r_dev_ctrl & IEN))
return;
+3
View File
@@ -47,6 +47,8 @@ public:
uint16_t read(const uint8_t reg_addr) override;
void write(const uint8_t reg_addr, const uint16_t value) override;
int pull_data(uint8_t *buf, int len) override;
int push_data(uint8_t *buf, int len) override;
virtual int perform_command() = 0;
@@ -103,6 +105,7 @@ protected:
int xfer_cnt = 0;
int chunk_cnt = 0;
int chunk_size = 0;
bool is_dma_xfer = false;
std::function<void()> post_xfer_action = nullptr;
};
+5 -1
View File
@@ -56,7 +56,8 @@ enum ATA_Reg : int {
COMMAND = 0x07, // command (write)
ALT_STATUS = 0x16, // alt status (read)
DEV_CTRL = 0x16, // device control (write)
TIME_CONFIG = 0x20 // Apple ASIC specific timing configuration
TIME_CONFIG = 0x20, // Apple ASIC specific timing configuration
INT_REG = 0x30, // Interrupt Register (read) 0x40 = int request (KeyLargo only)
};
/** ATAPI specific register offsets. */
@@ -146,6 +147,7 @@ enum ATA_Cmd : uint8_t {
WRITE_DMA = 0xCA,
WRITE_DMA_NR = 0xCB,
STANDBY_IMMEDIATE = 0xE0,
SLEEP = 0xE6,
FLUSH_CACHE = 0xE7, // ATA-5
WRITE_BUFFER_DMA = 0xE9,
READ_BUFFER_DMA = 0xEB,
@@ -162,6 +164,8 @@ public:
virtual ~AtaInterface() = default;
virtual uint16_t read(const uint8_t reg_addr) = 0;
virtual void write(const uint8_t reg_addr, const uint16_t val) = 0;
virtual int pull_data(uint8_t *buf, int len) { return 0; };
virtual int push_data(uint8_t *buf, int len) { return 0; };
virtual int get_device_id() = 0;
virtual void pdiag_callback() {}
+14 -11
View File
@@ -245,29 +245,32 @@ void AtaHardDisk::prepare_identify_info() {
std::memset(this->data_buf, 0, sizeof(this->data_buf));
buf_ptr[ 0] = 0x0040; // ATA device, non-removable media, non-removable drive
buf_ptr[49] = 0x0200; // report LBA support
WRITE_WORD_LE_A(&buf_ptr[ 0], 0x0040); // ATA device, non-removable media, non-removable drive
WRITE_WORD_LE_A(&buf_ptr[49], 0x0200); // report LBA support
// Maximum number of logical sectors per data block that the device supports
// for READ_MULTIPLE/WRITE_MULTIPLE commands.
buf_ptr[47] = 0x8000 | SECTORS_PER_INT;
WRITE_WORD_LE_A(&buf_ptr[47], 0x8000 | SECTORS_PER_INT);
// If bit 8 of word 59 is set to one, then bits 7:0 indicate the number of
// logical sectors that shall be transferred per data block for
// READ_MULTIPLE/WRITE_MULTIPLE commands.
if (this->sectors_per_int)
buf_ptr[59] = 0x100 | this->sectors_per_int;
WRITE_WORD_LE_A(&buf_ptr[59], 0x100 | this->sectors_per_int);
buf_ptr[ 1] = this->cylinders;
buf_ptr[ 3] = this->heads;
buf_ptr[ 6] = this->sectors;
WRITE_WORD_LE_A(&buf_ptr[ 1], this->cylinders);
WRITE_WORD_LE_A(&buf_ptr[ 3], this->heads);
WRITE_WORD_LE_A(&buf_ptr[ 6], this->sectors);
buf_ptr[57] = this->total_sectors & 0xFFFFU;
buf_ptr[58] = (this->total_sectors >> 16) & 0xFFFFU;
WRITE_WORD_LE_A(&buf_ptr[51], 0x0200); // max. PIO mode for a basic device
// report validity for the advanced PIO and MWDMA fields
//WRITE_WORD_LE_A(&buf_ptr[53], 0x0003);
WRITE_DWORD_LE_A(&buf_ptr[57], this->total_sectors);
// report LBA capacity
WRITE_WORD_LE_A(&buf_ptr[60], (this->total_sectors & 0xFFFFU));
WRITE_WORD_LE_A(&buf_ptr[61], (this->total_sectors >> 16) & 0xFFFFU);
WRITE_DWORD_LE_A(&buf_ptr[60], this->total_sectors);
WRITE_WORD_LE_A(&buf_ptr[63], ((1 << this->cur_dma_mode) << 8) | 7);
}
+1
View File
@@ -43,6 +43,7 @@ public:
// methods to be implemented in the particular device
int perform_command() override;
virtual void perform_packet_command() = 0;
virtual int get_config(uint8_t* pkt, uint8_t* buf) = 0;
virtual int request_data() = 0;
virtual bool data_available() = 0;
+36
View File
@@ -30,6 +30,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <machines/machineproperties.h>
#include <memaccess.h>
#include <cstring>
#include <string>
#include <core/timermanager.h>
@@ -315,6 +316,18 @@ void AtapiCdrom::perform_packet_command() {
this->data_out_phase();
break;
}
case ScsiCommand::GET_CONFIG: {
this->xfer_cnt = this->get_config(this->cmd_pkt, this->data_buf);
if (this->xfer_cnt == 0) {
this->present_status();
} else {
this->xfer_cnt = std::min((int)this->r_byte_count, this->xfer_cnt);
this->data_ptr = (uint16_t*)this->data_buf;
this->status_good();
this->data_out_phase();
}
break;
}
default:
LOG_F(ERROR, "%s: unsupported ATAPI command 0x%X", this->name.c_str(),
this->cmd_pkt[0]);
@@ -323,6 +336,29 @@ void AtapiCdrom::perform_packet_command() {
}
}
int AtapiCdrom::get_config(uint8_t* pkt, uint8_t* buf) {
std::memset(buf, 0, 16);
// Data length (4 bytes header + 8 bytes for one feature descriptor - 4 bytes for length field)
uint32_t data_len = 8;
buf[0] = (data_len >> 24) & 0xFF;
buf[1] = (data_len >> 16) & 0xFF;
buf[2] = (data_len >> 8) & 0xFF;
buf[3] = data_len & 0xFF;
// Feature Descriptor 1 - Set profile to CD-ROM
buf[6] = 0;
buf[7] = 0x08;
// Feature Descriptor 2 - Feature Code, Version 0
buf[8] = 0x00;
buf[9] = 0x01; // Core Feature Code
buf[10] = 0x03; // Persist and Current bits set
buf[11] = 0x04; // Additional Length
return 12;
}
int AtapiCdrom::request_data() {
// continuation of READ_CD above
+2
View File
@@ -42,6 +42,8 @@ public:
void perform_packet_command() override;
int get_config(uint8_t* pkt, uint8_t* buf) override;
int request_data() override;
bool data_available() override {
+16
View File
@@ -30,6 +30,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
and interrupt handling.
*/
#include <core/timermanager.h>
#include <devices/common/ata/atabasedevice.h>
#include <devices/common/ata/atadefs.h>
#include <devices/common/ata/idechannel.h>
@@ -81,6 +82,21 @@ void IdeChannel::write(const uint8_t reg_addr, const uint32_t val, const int siz
}
}
int IdeChannel::xfer_from(uint8_t *buf, int len) {
return this->devices[this->cur_dev]->pull_data(buf, len);
}
int IdeChannel::xfer_to(uint8_t *buf, int len) {
return this->devices[this->cur_dev]->push_data(buf, len);
}
void IdeChannel::assert_dmareq(uint64_t delay) {
TimerManager::get_instance()->add_oneshot_timer(delay, [this]() {
//LOG_F(INFO, "%s: DMAREQ asserted", this->name.c_str());
this->channel_obj->xfer_retry();
});
}
int MacioIdeChannel::device_postinit() {
this->int_ctrl = dynamic_cast<InterruptCtrl*>(
gMachineObj->get_comp_by_type(HWCompType::INT_CTRL));
+11 -5
View File
@@ -25,6 +25,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#define IDE_CHANNEL_H
#include <devices/common/ata/atadefs.h>
#include <devices/common/dmacore.h>
#include <devices/common/hwcomponent.h>
#include <devices/common/hwinterrupt.h>
@@ -33,7 +34,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <memory>
#include <string>
class IdeChannel : public HWComponent
class IdeChannel : public HWComponent, public DmaDevice
{
public:
IdeChannel(const std::string name);
@@ -41,8 +42,11 @@ public:
void register_device(int id, AtaInterface* dev_obj);
uint32_t read(const uint8_t reg_addr, const int size);
void write(const uint8_t reg_addr, const uint32_t val, const int size);
virtual uint32_t read(const uint8_t reg_addr, const int size);
virtual void write(const uint8_t reg_addr, const uint32_t val, const int size);
int xfer_from(uint8_t *buf, int len) override;
int xfer_to(uint8_t *buf, int len) override;
void assert_pdiag() {
this->devices[0]->pdiag_callback();
@@ -60,6 +64,8 @@ public:
this->irq_callback(intrq_state);
}
void assert_dmareq(uint64_t delay);
protected:
std::function<void(const uint8_t intrq_state)> irq_callback = nullptr;
@@ -87,8 +93,8 @@ public:
int device_postinit() override;
uint32_t read(const uint8_t reg_addr, const int size);
void write(const uint8_t reg_addr, const uint32_t val, const int size);
virtual uint32_t read(const uint8_t reg_addr, const int size) override;
virtual void write(const uint8_t reg_addr, const uint32_t val, const int size) override;
private:
uint32_t ch_config = 0; // timing configuration for this channel
+9
View File
@@ -313,6 +313,15 @@ uint32_t DMAChannel::reg_read(uint32_t offset, int size) {
case DMAReg::CMD_PTR_LO:
result = this->cmd_ptr;
break;
case DMAReg::INT_SELECT:
result = this->int_select;
break;
case DMAReg::BRANCH_SELECT:
result = this->branch_select;
break;
case DMAReg::WAIT_SELECT:
result = this->wait_select;
break;
default:
LOG_F(WARNING, "%s: Unsupported DMA channel register read at 0x%X",
this->get_name().c_str(), offset);
+5 -1
View File
@@ -291,7 +291,11 @@ void MeshController::step_completed() {
}
void MeshController::report_error(const int error) {
switch(error) {
switch (error) {
case ARB_LOST:
this->exception |= EXC_ARB_LOST;
this->int_stat |= INT_EXCEPTION;
break;
case SEL_TIMEOUT:
this->exception |= EXC_SEL_TIMEOUT;
this->int_stat |= INT_EXCEPTION;
+6
View File
@@ -143,6 +143,12 @@ enum ScsiCommand : uint8_t {
READ_TOC = 0x43,
SET_CD_SPEED = 0xBB,
READ_CD = 0xBE,
// vendor specific commands
VENDOR_09 = 0x09,
EJECT = 0xC0,
READ_CDDA = 0xD8, //TOSHIBA
READ_CDDA_MSF = 0xD9, //TOSHIBA
};
enum ScsiSense : int {
+15
View File
@@ -45,6 +45,8 @@ void ScsiCdrom::process_command()
{
uint32_t lba;
uint32_t cdda_start, cdda_end, cdda_len;
this->pre_xfer_action = nullptr;
this->post_xfer_action = nullptr;
@@ -98,6 +100,19 @@ void ScsiCdrom::process_command()
this->switch_phase(ScsiPhase::DATA_IN);
}
break;
case ScsiCommand::READ_CDDA:
lba = READ_DWORD_BE_U(&cmd[2]);
cdda_len = READ_DWORD_BE_U(&cmd[6]);
this->read(lba, cdda_len, 12);
break;
case ScsiCommand::READ_CDDA_MSF:
cdda_start = (cmd[3] * 60 * 75) + (cmd[4] * 75) + cmd[5];
cdda_end = (cmd[7] * 60 * 75) + (cmd[8] * 75) + cmd[9];
cdda_len = (cdda_end > cdda_start) ? (cdda_end - cdda_start) : 0;
this->read(cdda_start, cdda_len, 12);
break;
default:
LOG_F(ERROR, "%s: unsupported command 0x%X", this->name.c_str(), cmd[0]);
this->illegal_command(cmd);
+41 -28
View File
@@ -502,6 +502,15 @@ void ViaCuda::error_response(uint32_t error) {
this->is_open_ended = false;
}
void ViaCuda::one_byte_header(uint32_t pkt_type) {
this->out_buf[0] = pkt_type;
this->out_count = 1;
this->out_pos = 0;
this->out_handler = &ViaCuda::out_buf_handler;
this->next_out_handler = &ViaCuda::null_out_handler;
this->is_open_ended = false;
}
void ViaCuda::process_packet() {
if (this->in_count < 2) {
LOG_F(ERROR, "Cuda: invalid packet (too few data)!");
@@ -529,17 +538,33 @@ void ViaCuda::process_packet() {
}
}
void ViaCuda::append_data(uint8_t* src, int len) {
if (len > 0) {
std::memcpy(&this->out_buf[this->out_count], src, len);
this->out_count += len;
}
}
template <class T>
void ViaCuda::append_data(T data) {
switch(sizeof(T)) {
case 1: this->out_buf[this->out_count] = data;
case 2: WRITE_WORD_BE_U( &this->out_buf[this->out_count], data);
case 4: WRITE_DWORD_BE_U(&this->out_buf[this->out_count], data);
}
this->out_count += sizeof(T);
}
template void ViaCuda::append_data(uint8_t data);
template void ViaCuda::append_data(uint16_t data);
template void ViaCuda::append_data(uint32_t data);
void ViaCuda::process_adb_command() {
uint8_t adb_stat, output_size;
adb_stat = this->adb_bus_obj->process_command(&this->in_buf[1],
this->in_count - 1);
response_header(CUDA_PKT_ADB, adb_stat);
output_size = this->adb_bus_obj->get_output_count();
if (output_size) {
std::memcpy(&this->out_buf[3], this->adb_bus_obj->get_output_buf(), output_size);
this->out_count += output_size;
}
this->append_data(this->adb_bus_obj->get_output_buf(), this->adb_bus_obj->get_output_count());
}
void ViaCuda::autopoll_handler() {
@@ -558,11 +583,7 @@ void ViaCuda::autopoll_handler() {
// prepare autopoll packet
response_header(CUDA_PKT_ADB, ADB_STAT_OK | ADB_STAT_AUTOPOLL);
this->out_buf[2] = poll_command; // put the proper ADB command
uint8_t output_size = this->adb_bus_obj->get_output_count();
if (output_size) {
std::memcpy(&this->out_buf[3], this->adb_bus_obj->get_output_buf(), output_size);
this->out_count += output_size;
}
this->append_data(this->adb_bus_obj->get_output_buf(), this->adb_bus_obj->get_output_count());
// assert TREQ
this->via_portb &= ~CUDA_TREQ;
@@ -584,12 +605,10 @@ void ViaCuda::autopoll_handler() {
this->out_buf[2] = CUDA_GET_REAL_TIME;
if (send_time || this->one_sec_mode == 1) {
uint32_t real_time = this_time + this->time_offset;
WRITE_DWORD_BE_U(&this->out_buf[3], real_time);
this->out_count = 7;
this->append_data(real_time);
}
} else if (this->one_sec_mode == 3) {
response_header(CUDA_PKT_TICK, 0);
this->out_count = 1;
one_byte_header(CUDA_PKT_TICK);
}
this->last_time = this_time;
@@ -631,11 +650,10 @@ void ViaCuda::pseudo_command() {
this->next_out_handler = &ViaCuda::pram_out_handler;
} else if (addr >= CUDA_ROM_START) {
// HACK: Cuda ROM dump requsted so let's partially fake it
this->out_buf[3] = 0; // empty copyright string
WRITE_WORD_BE_A(&this->out_buf[4], 0x0019U);
WRITE_WORD_BE_A(&this->out_buf[6], CUDA_FW_VERSION_MAJOR);
WRITE_WORD_BE_A(&this->out_buf[8], CUDA_FW_VERSION_MINOR);
this->out_count += 7;
this->append_data(uint8_t(0)); // empty copyright string
this->append_data(uint16_t(0x0019U));
this->append_data(uint16_t(CUDA_FW_VERSION_MAJOR));
this->append_data(uint16_t(CUDA_FW_VERSION_MINOR));
}
this->is_open_ended = true;
break;
@@ -643,8 +661,7 @@ void ViaCuda::pseudo_command() {
response_header(CUDA_PKT_PSEUDO, 0);
uint32_t this_time = this->calc_real_time();
uint32_t real_time = this_time + this->time_offset;
WRITE_DWORD_BE_U(&this->out_buf[3], real_time);
this->out_count = 7;
this->append_data(real_time);
break;
}
case CUDA_WRITE_MCU_MEM:
@@ -707,19 +724,15 @@ void ViaCuda::pseudo_command() {
break;
case CUDA_GET_AUTOPOLL_RATE:
response_header(CUDA_PKT_PSEUDO, 0);
this->out_buf[3] = this->poll_rate;
this->out_count++;
this->append_data(this->poll_rate);
break;
case CUDA_SET_DEVICE_BITMAP:
this->device_mask = READ_WORD_BE_U(&this->in_buf[2]);
response_header(CUDA_PKT_PSEUDO, 0);
this->device_mask = ((uint16_t)this->in_buf[2]) << 8;
this->device_mask |= ((uint16_t)this->in_buf[3]);
break;
case CUDA_GET_DEVICE_BITMAP:
response_header(CUDA_PKT_PSEUDO, 0);
this->out_buf[2] = (uint8_t)((this->device_mask >> 8) & 0xFF);
this->out_buf[3] = (uint8_t)((this->device_mask) & 0xFF);
this->out_count += 2;
this->append_data(this->device_mask);
break;
case CUDA_ONE_SECOND_MODE:
LOG_F(INFO, "Cuda: One Second Interrupt Mode: %d", this->in_buf[2]);
+3
View File
@@ -266,6 +266,9 @@ private:
void write(uint8_t new_state);
void response_header(uint32_t pkt_type, uint32_t pkt_flag);
void error_response(uint32_t error);
void one_byte_header(uint32_t pkt_type);
inline void append_data(uint8_t* src, int len);
template <class T> inline void append_data(T data);
void process_packet();
void process_adb_command();
void pseudo_command();
+31 -4
View File
@@ -31,9 +31,19 @@ using namespace MaceEnet;
uint8_t MaceController::read(uint8_t reg_offset)
{
switch(reg_offset) {
switch (reg_offset) {
case MaceReg::Rcv_FIFO:
return 0; //No FIFO yet
case MaceReg::Rcv_Frame_Ctrl:
return this->rcv_fc;
case MaceReg::Xmit_Frame_Stat:
return this->xmt_fs;
case MaceReg::Xmit_Retry_Cnt:
return this->xmt_retry;
case MaceReg::Rcv_Frame_Stat:
return this->rcv_fs;
case MaceReg::FIFO_Frame_Cnt:
return this->fifo_fc;
case MaceReg::Interrupt: {
uint8_t ret_val = this->int_stat;
this->int_stat = 0;
@@ -42,12 +52,26 @@ uint8_t MaceController::read(uint8_t reg_offset)
}
case MaceReg::Interrupt_Mask:
return this->int_mask;
case MaceReg::Poll:
return this->poll_reg;
case MaceReg::BIU_Config_Ctrl:
return this->biu_ctrl;
case MaceReg::FIFO_Config:
return this->fifo_ctrl;
case MaceReg::MAC_Config_Ctrl:
return this->mac_cc;
case MaceReg::PLS_Config_Ctrl:
return this->pls_cc;
case MaceReg::PHY_Config_Ctrl:
return this->phy_cc;
case MaceReg::Chip_ID_Lo:
return this->chip_id & 0xFFU;
case MaceReg::Chip_ID_Hi:
return (this->chip_id >> 8) & 0xFFU;
case MaceReg::Int_Addr_Config:
return this->addr_cfg;
case MaceReg::Missed_Pkt_Cnt:
return this->missed_pkts;
default:
LOG_F(INFO, "%s: reading from register %d", this->name.c_str(), reg_offset);
}
@@ -64,9 +88,6 @@ void MaceController::write(uint8_t reg_offset, uint8_t value)
case MaceReg::Interrupt_Mask:
this->int_mask = value;
break;
case MaceReg::MAC_Config_Ctrl:
this->mac_cfg = value;
break;
case MaceReg::BIU_Config_Ctrl:
if (value & BIU_SWRST) {
LOG_F(INFO, "%s: soft reset asserted", this->name.c_str());
@@ -74,6 +95,12 @@ void MaceController::write(uint8_t reg_offset, uint8_t value)
}
this->biu_ctrl = value;
break;
case MaceReg::FIFO_Config:
this->fifo_ctrl = value;
break;
case MaceReg::MAC_Config_Ctrl:
this->mac_cfg = value;
break;
case MaceReg::PLS_Config_Ctrl:
if (value != 7)
LOG_F(WARNING, "%s: unsupported transceiver interface 0x%X in PLSCC",
+20 -8
View File
@@ -99,14 +99,26 @@ public:
void write(uint8_t reg_offset, uint8_t value);
private:
uint16_t chip_id; // per-instance MACE Chip ID
uint8_t addr_cfg = 0;
uint8_t addr_ptr = 0;
uint8_t rcv_fc = 1;
uint8_t biu_ctrl = 0;
uint8_t mac_cfg = 0;
uint64_t phys_addr = 0;
uint64_t log_addr = 0;
uint16_t chip_id; // per-instance MACE Chip ID
uint8_t addr_cfg = 0;
uint8_t addr_ptr = 0;
uint8_t xmt_fs = 0;
uint8_t xmt_retry = 0;
uint8_t rcv_fc = 1;
uint8_t rcv_fs = 0;
uint8_t biu_ctrl = 0;
uint8_t fifo_ctrl = 0;
uint8_t poll_reg = 0;
uint8_t mac_cfg = 0;
uint8_t mac_cc = 0;
uint8_t pls_cc = 0;
uint8_t phy_cc = 0;
uint8_t fifo_fc = 0;
uint8_t missed_pkts = 0;
uint64_t phys_addr = 0;
uint64_t log_addr = 0;
// interrupt stuff
uint8_t int_stat = 0;
+16 -13
View File
@@ -34,8 +34,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
static FlopImgType identify_image(ImgFile& img_file)
{
// WOZ images identification strings
static uint8_t WOZ1_SIG[] = {0x57, 0x4F, 0x5A, 0x31, 0xFF, 0x0A, 0x0D, 0x0A};
static uint8_t WOZ2_SIG[] = {0x57, 0x4F, 0x5A, 0x32, 0xFF, 0x0A, 0x0D, 0x0A};
static const uint8_t WOZ1_SIG[] = {0x57, 0x4F, 0x5A, 0x31, 0xFF, 0x0A, 0x0D, 0x0A};
static const uint8_t WOZ2_SIG[] = {0x57, 0x4F, 0x5A, 0x32, 0xFF, 0x0A, 0x0D, 0x0A};
uint8_t buf[8] = { 0 };
@@ -47,20 +47,23 @@ static FlopImgType identify_image(ImgFile& img_file)
} else if (!std::memcmp(buf, WOZ2_SIG, sizeof(buf))) {
return FlopImgType::WOZ2;
} else {
for (int offset = 0; offset <=84; offset += 84) {
auto check_hfs_mfs = [](ImgFile& img, std::size_t offset) -> bool {
/* 2 bytes needed for MFS/HFS signature */
unsigned char buf[2];
// rewind to logical block 2
img_file.read((char *)buf, 2*BLOCK_SIZE + offset, sizeof(buf));
img.read((char *)buf, 2*BLOCK_SIZE + offset, sizeof(buf));
// check for HFS/MFS signature at the start of the logical block 2
if ((buf[0] == 0x42 && buf[1] == 0x44) ||
(buf[0] == 0xD2 && buf[1] == 0xD7)) {
if (offset) {
return FlopImgType::DC42;
} else {
return FlopImgType::RAW;
}
}
}
return ((buf[0] == 0x42 && buf[1] == 0x44)
|| (buf[0] == 0xD2 && buf[1] == 0xD7));
};
if (check_hfs_mfs(img_file, 84))
return FlopImgType::DC42;
if (check_hfs_mfs(img_file, 0))
return FlopImgType::RAW;
}
return FlopImgType::UNKNOWN;
+12
View File
@@ -350,10 +350,22 @@ public:
return std::unique_ptr<MacIoTwo>(new MacIoTwo("paddington", MIO_DEV_ID_PADDINGTON));
}
void set_fp_id(uint8_t id) {
this->fp_id = id;
}
void set_mon_id(uint8_t id) {
this->mon_id = id;
}
void set_media_bay_id(uint8_t id) {
this->mb_id = id;
}
void set_cpu_id(uint8_t id) {
this->cpu_id = id;
}
// MMIO device methods
uint32_t read(uint32_t rgn_start, uint32_t offset, int size) override;
void write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size) override;
+15 -5
View File
@@ -39,9 +39,18 @@ MacIoTwo::MacIoTwo(std::string name, uint16_t dev_id) : MacIoBase(name, dev_id)
// connect IDE HW
this->ide_0 = dynamic_cast<IdeChannel*>(gMachineObj->get_comp_by_name("Ide0"));
this->ide_1 = dynamic_cast<IdeChannel*>(gMachineObj->get_comp_by_name("Ide1"));
this->ide0_dma = std::unique_ptr<DMAChannel> (new DMAChannel("Ide0-Dma"));
this->ide0_dma->register_dma_int(this, this->register_dma_int(IntSrc::DMA_IDE0));
this->ide0_dma->connect(this->ide_0);
this->ide_0->connect(this->ide0_dma.get());
this->ide_1 = dynamic_cast<IdeChannel*>(gMachineObj->get_comp_by_name_optional("Ide1"));
this->ide1_dma = std::unique_ptr<DMAChannel> (new DMAChannel("Ide1-Dma"));
this->ide1_dma->register_dma_int(this, this->register_dma_int(IntSrc::DMA_IDE1));
if (this->ide_1) {
this->ide1_dma->connect(this->ide_1);
this->ide_1->connect(this->ide1_dma.get());
}
// connect Ethernet HW (Heathrow and Paddington)
if (this->device_id != MIO_DEV_ID_OHARE) {
@@ -101,10 +110,10 @@ uint32_t MacIoTwo::read(uint32_t rgn_start, uint32_t offset, int size) {
value = this->viacuda->read((offset >> 9) & 0xF);
break;
case 0x20: // IDE 0
value = this->ide_0->read((offset >> 4) & 0x1F, size);
value = this->ide_0->read((offset >> 4) & 0xFF, size);
break;
case 0x21: // IDE 1
value = this->ide_1->read((offset >> 4) & 0x1F, size);
value = this->ide_1 ? this->ide_1->read((offset >> 4) & 0xFF, size) : 0;
break;
default:
if (sub_addr >= 0x60) {
@@ -163,10 +172,11 @@ void MacIoTwo::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int si
this->viacuda->write((offset >> 9) & 0xF, value);
break;
case 0x20: // IDE 0
this->ide_0->write((offset >> 4) & 0x1F, value, size);
this->ide_0->write((offset >> 4) & 0xFF, value, size);
break;
case 0x21: // IDE 1
this->ide_1->write((offset >> 4) & 0x1F, value, size);
if (this->ide_1)
this->ide_1->write((offset >> 4) & 0xFF, value, size);
break;
default:
if (sub_addr >= 0x60) {
+1
View File
@@ -27,6 +27,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <cinttypes>
#include <string>
#include <algorithm>
PsxCtrl::PsxCtrl(int bridge_num, std::string name)
{
+30 -3
View File
@@ -135,12 +135,39 @@ uint32_t CdromDrive::mode_sense_ex(bool is_sense_6, uint8_t* cmd_ptr, uint8_t* d
resp_ptr[0] = page_code;
switch (page_code) {
case 0x01:
case ModePage::READ_ERROR_RECOVERY:
resp_ptr[1] = 6; // data size
std::memset(&resp_ptr[2], 0, 6);
data_ptr[1] += 8; // adjust overall length
break;
case 0x2A:
case ModePage::CDROM_AUDIO:
resp_ptr[1] = 16; // page length
std::memset(&resp_ptr[2], 0, 16);
resp_ptr[2] = (1 << 2); //immediately return status
WRITE_WORD_BE_A(&resp_ptr[6], 75); // logical block per second of audio playback
resp_ptr[8] = 0x01; // Left Channel
resp_ptr[9] = 0xFF; // Volume (0-255)
resp_ptr[10] = 0x02; // Right Channel
resp_ptr[11] = 0xFF; // Volume (0-255)
resp_ptr[12] = 0x04; // Output Port 2
resp_ptr[13] = 0x00; // Volume (0-255)
resp_ptr[14] = 0x08; // Output Port 3
resp_ptr[15] = 0x00; // Volume (0-255)
data_ptr[1] += 8; // adjust overall length
break;
case ModePage::POWER_CONDITION:
resp_ptr[1] = 10; // page length
std::memset(&resp_ptr[2], 0, 10);
resp_ptr[3] = 0; //idle and standby off
WRITE_DWORD_BE_A(&resp_ptr[4], 0); // Idle Timer (100ms units)
WRITE_DWORD_BE_A(&resp_ptr[8], 0); // Standby Timer (100ms units)
data_ptr[1] += 12; // adjust overall length
break;
case ModePage::CDROM_CAPABILITIES:
resp_ptr[1] = 18; // page data length
std::memset(&resp_ptr[2], 0, 18);
resp_ptr[2] = 0x03; // supports reading CD-R and CD-E
@@ -152,7 +179,7 @@ uint32_t CdromDrive::mode_sense_ex(bool is_sense_6, uint8_t* cmd_ptr, uint8_t* d
WRITE_WORD_BE_A(&resp_ptr[14], 706); // report current speed (4x)
data_ptr[1] += 20; // adjust overall length
break;
case 0x31:
case ModePage::VENDOR_PAGE_31:
resp_ptr[1] = 14; // page data length
std::memset(&resp_ptr[2], 0, 14);
resp_ptr[8] = 0x31;
+10
View File
@@ -44,6 +44,16 @@ typedef struct {
uint32_t start_lba;
} TrackDescriptor;
enum ModePage {
READ_ERROR_RECOVERY = 1,
CDROM_PARAMS = 0xD,
CDROM_AUDIO = 0xE,
POWER_CONDITION = 0x1A,
CDROM_CAPABILITIES = 0x2A,
VENDOR_PAGE_31 = 0x31,
ALL_PAGES = 0x3F,
};
constexpr auto CDROM_MAX_TRACKS = 100;
constexpr auto LEAD_OUT_TRK_NUM = 0xAA;
constexpr auto CDR_STD_DATA_SIZE = 2048;
+12 -4
View File
@@ -61,17 +61,25 @@ Display::Display(): impl(std::make_unique<Impl>()) {
}
Display::~Display() {
if (impl->cursor_texture)
if (impl->cursor_texture) {
SDL_DestroyTexture(impl->cursor_texture);
impl->cursor_texture = 0;
}
if (impl->disp_texture)
if (impl->disp_texture) {
SDL_DestroyTexture(impl->disp_texture);
impl->disp_texture = 0;
}
if (impl->renderer)
if (impl->renderer) {
SDL_DestroyRenderer(impl->renderer);
impl->renderer = 0;
}
if (impl->display_wnd)
if (impl->display_wnd) {
SDL_DestroyWindow(impl->display_wnd);
impl->display_wnd = 0;
}
}
const double scale_step = std::pow(2.0, 1.0/8.0);
+2 -1
View File
@@ -1,4 +1,5 @@
The AMIC is the I/O controller used in the Power Mac 6100. Physically, it's located at 0x50F00000.
The AMIC is the I/O controller used in the Power Mac 6100. Appropriately, it's the abbreviation for Apple Memory Mapped I/O Controller.
Physically, it's located at 0x50F00000.
It also:
+1 -1
View File
@@ -20,7 +20,7 @@ It also has a unique 37-pin connector dubbed the Geekport to allow hobbyists to
| CPU 0 Interrupt Mask | 0x7FFFF0F0 | |
| CPU 1 Interrupt Mask | 0x7FFFF1F0 | |
| Interrupt sources | 0x7FFFF2F0 | |
| Cross-proccessor interrupts | 0x7FFFF3F0 | |
| Cross-processor interrupts | 0x7FFFF3F0 | |
| Proc. resets, other stuff | 0x7FFFF4F0 | |
+2 -2
View File
@@ -1,6 +1,6 @@
# ROM
# ROMs
The Old World ROM is always 4 megabytes (MB). The first three MB are reserved for the 68k code, while the last MB is for the PowerPC boot-up code.
Old World ROMs are always 4 megabytes (MB). The first three MB are reserved for the 68k code, while the last MB is for the PowerPC boot-up code.
New World ROMs are 1 MB stubs containing Open Firmware and some basic drivers, but has an additional ROM stored on the Mac's hard disk to provide Toolbox functionality. The ROMs stored on the Mac's hard disk also had updates distributed.
+2 -2
View File
@@ -151,7 +151,7 @@ pci_B1
pci_C1
```
Specified what devices are conntected to a particular PCI slot. Not supported on NuBus machines such as the Power Mac 6100.
Specified what devices are connected to a particular PCI slot. Not supported on NuBus machines such as the Power Mac 6100.
```
--adb_devices TEXT
@@ -214,7 +214,7 @@ Currently, the Power Mac 6100 cannot boot any OS image containing Mac OS 9.0 or
### ATI Mach Support
The GUI engine is currently not fully implemented. As such, UI elements might not be rendered when trying to use this video card. To circumenvent this, you may wish to move the ATI Accelerator extension to the Extensions (Disabled) folder.
The GUI engine is currently not fully implemented. As such, UI elements might not be rendered when trying to use this video card. To circumvent this, you may wish to move the ATI Accelerator extension to the Extensions (Disabled) folder.
### Currently Unimplemented Features