From 7c29e41fae881b31a7b53ec6754a55a4b20be51a Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Wed, 4 Feb 2026 16:47:57 +0600 Subject: [PATCH 1/4] atirage: Definitions for auxiliary register aperture --- devices/video/atimach64defs.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/devices/video/atimach64defs.h b/devices/video/atimach64defs.h index 475b9c38fb..be1ccd6568 100644 --- a/devices/video/atimach64defs.h +++ b/devices/video/atimach64defs.h @@ -692,6 +692,10 @@ constexpr auto MM_REGS_0_OFF = 0x007FFC00U; // offset to memory mapped registers constexpr auto MM_REGS_1_OFF = 0x007FF800U; // offset to memory mapped registers, block 1 constexpr auto MM_REGS_2_OFF = 0x003FFC00U; // offset to memory mapped registers, 4MB aperture +// Auxiliary register aperture. +constexpr auto MM_STDL_REGS_0_OFF = 0x400U; // offset to memory mapped registers, block 0 +constexpr auto MM_STDL_REGS_1_OFF = 0x000U; // offset to memory mapped registers, block 1 + constexpr auto ATI_XTAL = 14318180.0f; // external crystal oscillator frequency #endif // ATI_MACH64_DEFS_H From 6a3654e851617793ea77189b9bd0a59e518bae05 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Wed, 4 Feb 2026 16:56:19 +0600 Subject: [PATCH 2/4] atirage: Implement reads/writes from the auxiliary aperture --- devices/video/atirage.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/devices/video/atirage.cpp b/devices/video/atirage.cpp index 0d29fe82e7..d4e47b42be 100644 --- a/devices/video/atirage.cpp +++ b/devices/video/atirage.cpp @@ -627,6 +627,17 @@ uint32_t ATIRage::read(uint32_t rgn_start, uint32_t offset, int size) } if (rgn_start == this->aperture_base[2] && offset < this->aperture_size[2]) { + // The documentation for the Rage LT Pro marks the upper 2KB + // of the 4KB aux. aperture reserved, but it's used by Mac OS + // anyway for Rage II. Make it wrap around the 2KB boundary + // instead. + offset &= 0x7ff; + if (offset >= MM_STDL_REGS_0_OFF) { + return BYTESWAP_SIZED(this->read_reg(offset & 0x3FF, size), size); + } + if (offset >= MM_STDL_REGS_1_OFF) { + return BYTESWAP_SIZED(this->read_reg((offset & 0x3FF) + 0x400, size), size); + } LOG_F(WARNING, "%s: read unmapped aperture[2] region %08x.%c", this->name.c_str(), offset, SIZE_ARG(size)); return 0; @@ -674,6 +685,14 @@ void ATIRage::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int siz } if (rgn_start == this->aperture_base[2] && offset < this->aperture_size[2]) { + // See the note about wrap around above. + offset &= 0x7ff; + if (offset >= MM_STDL_REGS_0_OFF) { + return this->write_reg(offset & 0x3FF, BYTESWAP_SIZED(value, size), size); + } + if (offset >= MM_STDL_REGS_1_OFF) { + return this->write_reg((offset & 0x3FF) + 0x400, BYTESWAP_SIZED(value, size), size); + } LOG_F(WARNING, "%s: write unmapped aperture[2] region %08x.%c = %0*x", this->name.c_str(), offset, SIZE_ARG(size), size * 2, value); return; From 4c3989fa132dd65cff4f18cb0bbf14494dbdaa0c Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Wed, 4 Feb 2026 17:19:08 +0600 Subject: [PATCH 3/4] atirage: Remove unreachable logging for auxiliary aperture --- devices/video/atirage.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/devices/video/atirage.cpp b/devices/video/atirage.cpp index d4e47b42be..bdb82da022 100644 --- a/devices/video/atirage.cpp +++ b/devices/video/atirage.cpp @@ -638,8 +638,6 @@ uint32_t ATIRage::read(uint32_t rgn_start, uint32_t offset, int size) if (offset >= MM_STDL_REGS_1_OFF) { return BYTESWAP_SIZED(this->read_reg((offset & 0x3FF) + 0x400, size), size); } - LOG_F(WARNING, "%s: read unmapped aperture[2] region %08x.%c", - this->name.c_str(), offset, SIZE_ARG(size)); return 0; } @@ -693,8 +691,6 @@ void ATIRage::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int siz if (offset >= MM_STDL_REGS_1_OFF) { return this->write_reg((offset & 0x3FF) + 0x400, BYTESWAP_SIZED(value, size), size); } - LOG_F(WARNING, "%s: write unmapped aperture[2] region %08x.%c = %0*x", - this->name.c_str(), offset, SIZE_ARG(size), size * 2, value); return; } From 7abc8afc9749791af2b999e20bd8db63669eac67 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Wed, 4 Feb 2026 17:23:41 +0600 Subject: [PATCH 4/4] atirage: Remove more redundant code --- devices/video/atirage.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/devices/video/atirage.cpp b/devices/video/atirage.cpp index bdb82da022..8f9ef2551a 100644 --- a/devices/video/atirage.cpp +++ b/devices/video/atirage.cpp @@ -635,10 +635,8 @@ uint32_t ATIRage::read(uint32_t rgn_start, uint32_t offset, int size) if (offset >= MM_STDL_REGS_0_OFF) { return BYTESWAP_SIZED(this->read_reg(offset & 0x3FF, size), size); } - if (offset >= MM_STDL_REGS_1_OFF) { - return BYTESWAP_SIZED(this->read_reg((offset & 0x3FF) + 0x400, size), size); - } - return 0; + // Rest of the region is Block 1. + return BYTESWAP_SIZED(this->read_reg((offset & 0x3FF) + 0x400, size), size); } // memory mapped expansion ROM region @@ -688,10 +686,7 @@ void ATIRage::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int siz if (offset >= MM_STDL_REGS_0_OFF) { return this->write_reg(offset & 0x3FF, BYTESWAP_SIZED(value, size), size); } - if (offset >= MM_STDL_REGS_1_OFF) { - return this->write_reg((offset & 0x3FF) + 0x400, BYTESWAP_SIZED(value, size), size); - } - return; + return this->write_reg((offset & 0x3FF) + 0x400, BYTESWAP_SIZED(value, size), size); } LOG_F(WARNING, "%s: write unmapped aperture region %08x.%c = %0*x",