mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-22 01:31:25 +00:00
HDD: remove magic numbers & add GH ref (#1007)
This commit is contained in:
parent
bb6fa80335
commit
1ab0d56558
@ -522,7 +522,7 @@ BYTE __stdcall HarddiskInterfaceCard::IORead(WORD pc, WORD addr, BYTE bWrite, BY
|
||||
if (!page)
|
||||
{
|
||||
if (g_nAppMode == MODE_STEPPING)
|
||||
DebuggerBreakOnDmaToOrFromIoMemory(dstAddr, true);
|
||||
DebuggerBreakOnDmaToOrFromIoMemory(dstAddr, true); // GH#1007
|
||||
//else // Show MessageBox?
|
||||
|
||||
pCard->m_notBusyCycle = 0; // DMA complete
|
||||
@ -575,11 +575,11 @@ BYTE __stdcall HarddiskInterfaceCard::IORead(WORD pc, WORD addr, BYTE bWrite, BY
|
||||
}
|
||||
}
|
||||
|
||||
// Trap and error on any accesses that overlap with I/O memory
|
||||
if ((pHDD->m_memblock < 0xC000 && ((pHDD->m_memblock + HD_BLOCK_SIZE - 1) >= 0xC000)) // 1) Starts before I/O, but ends in I/O memory
|
||||
|| ((pHDD->m_memblock >> 12) == 0xC)) // 2) Starts in I/O memory
|
||||
// Trap and error on any accesses that overlap with I/O memory (GH#1007)
|
||||
if ((pHDD->m_memblock < APPLE_IO_BEGIN && ((pHDD->m_memblock + HD_BLOCK_SIZE - 1) >= APPLE_IO_BEGIN)) // 1) Starts before I/O, but ends in I/O memory
|
||||
|| ((pHDD->m_memblock >> 12) == (APPLE_IO_BEGIN >> 12))) // 2) Starts in I/O memory
|
||||
{
|
||||
WORD dstAddr = ((pHDD->m_memblock >> 12) == 0xC) ? pHDD->m_memblock : 0xC000;
|
||||
WORD dstAddr = ((pHDD->m_memblock >> 12) == (APPLE_IO_BEGIN >> 12)) ? pHDD->m_memblock : APPLE_IO_BEGIN;
|
||||
|
||||
if (g_nAppMode == MODE_STEPPING)
|
||||
DebuggerBreakOnDmaToOrFromIoMemory(dstAddr, false);
|
||||
@ -590,13 +590,13 @@ BYTE __stdcall HarddiskInterfaceCard::IORead(WORD pc, WORD addr, BYTE bWrite, BY
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pHDD->m_memblock <= 0xFE00)
|
||||
if (pHDD->m_memblock <= (MEMORY_LENGTH - HD_BLOCK_SIZE))
|
||||
{
|
||||
memcpy(pHDD->m_buf, mem + pHDD->m_memblock, HD_BLOCK_SIZE);
|
||||
}
|
||||
else // wraps on 64KiB boundary
|
||||
else // wraps on 64KiB boundary (GH#1007)
|
||||
{
|
||||
const UINT size = 0x10000 - pHDD->m_memblock;
|
||||
const UINT size = MEMORY_LENGTH - pHDD->m_memblock;
|
||||
memcpy(pHDD->m_buf, mem + pHDD->m_memblock, size);
|
||||
memcpy(pHDD->m_buf + size, mem, HD_BLOCK_SIZE - size);
|
||||
}
|
||||
|
@ -26,12 +26,15 @@ enum
|
||||
{
|
||||
// Note: All are in bytes!
|
||||
APPLE_SLOT_SIZE = 0x0100, // 1 page = $Cx00 .. $CxFF (slot 1 .. 7)
|
||||
APPLE_IO_BEGIN = 0xC000,
|
||||
APPLE_SLOT_BEGIN = 0xC100, // each slot has 1 page reserved for it
|
||||
APPLE_SLOT_END = 0xC7FF, //
|
||||
|
||||
FIRMWARE_EXPANSION_SIZE = 0x0800, // 8 pages = $C800 .. $CFFF
|
||||
FIRMWARE_EXPANSION_BEGIN = 0xC800, // [C800,CFFF)
|
||||
FIRMWARE_EXPANSION_END = 0xCFFF //
|
||||
FIRMWARE_EXPANSION_END = 0xCFFF, //
|
||||
|
||||
MEMORY_LENGTH = 0x10000
|
||||
};
|
||||
|
||||
enum MemoryInitPattern_e
|
||||
|
Loading…
x
Reference in New Issue
Block a user