mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-03 11:30:22 +00:00
Rename ms_pWorkBuffer to m_pWorkBuffer (as it's no longer static)
This commit is contained in:
parent
d2a34e1f91
commit
50a0e81941
@ -67,13 +67,13 @@ CImageBase::CImageBase()
|
||||
: m_uNumTracksInImage(0)
|
||||
, m_uVolumeNumber(DEFAULT_VOLUME_NUMBER)
|
||||
{
|
||||
ms_pWorkBuffer = new BYTE[TRACK_DENIBBLIZED_SIZE * 2];
|
||||
m_pWorkBuffer = new BYTE[TRACK_DENIBBLIZED_SIZE * 2];
|
||||
}
|
||||
|
||||
CImageBase::~CImageBase()
|
||||
{
|
||||
delete [] ms_pWorkBuffer;
|
||||
ms_pWorkBuffer = NULL;
|
||||
delete [] m_pWorkBuffer;
|
||||
m_pWorkBuffer = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -299,8 +299,8 @@ LPBYTE CImageBase::Code62(int sector)
|
||||
// CONVERT THE 256 8-BIT BYTES INTO 342 6-BIT BYTES, WHICH WE STORE
|
||||
// STARTING AT 4K INTO THE WORK BUFFER.
|
||||
{
|
||||
LPBYTE sectorbase = ms_pWorkBuffer+(sector << 8);
|
||||
LPBYTE resultptr = ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
LPBYTE sectorbase = m_pWorkBuffer+(sector << 8);
|
||||
LPBYTE resultptr = m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
BYTE offset = 0xAC;
|
||||
while (offset != 0x02)
|
||||
{
|
||||
@ -326,8 +326,8 @@ LPBYTE CImageBase::Code62(int sector)
|
||||
// BLOCK OF 343 BYTES STARTING AT 5K INTO THE WORK BUFFER.
|
||||
{
|
||||
BYTE savedval = 0;
|
||||
LPBYTE sourceptr = ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
LPBYTE resultptr = ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+0x400;
|
||||
LPBYTE sourceptr = m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
LPBYTE resultptr = m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+0x400;
|
||||
int loop = 342;
|
||||
while (loop--)
|
||||
{
|
||||
@ -343,14 +343,14 @@ LPBYTE CImageBase::Code62(int sector)
|
||||
// ZERO BITS. THE CONVERTED BLOCK OF 343 BYTES IS STORED STARTING AT 4K
|
||||
// INTO THE WORK BUFFER.
|
||||
{
|
||||
LPBYTE sourceptr = ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+0x400;
|
||||
LPBYTE resultptr = ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
LPBYTE sourceptr = m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+0x400;
|
||||
LPBYTE resultptr = m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
int loop = 343;
|
||||
while (loop--)
|
||||
*(resultptr++) = ms_DiskByte[(*(sourceptr++)) >> 2];
|
||||
}
|
||||
|
||||
return ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
return m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
@ -374,8 +374,8 @@ void CImageBase::Decode62(LPBYTE imageptr)
|
||||
|
||||
// USING OUR TABLE, CONVERT THE DISK BYTES BACK INTO 6-BIT BYTES
|
||||
{
|
||||
LPBYTE sourceptr = ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
LPBYTE resultptr = ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+0x400;
|
||||
LPBYTE sourceptr = m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
LPBYTE resultptr = m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+0x400;
|
||||
int loop = 343;
|
||||
while (loop--)
|
||||
*(resultptr++) = sixbitbyte[*(sourceptr++) & 0x7F];
|
||||
@ -385,8 +385,8 @@ void CImageBase::Decode62(LPBYTE imageptr)
|
||||
// TO UNDO THE EFFECTS OF THE CHECKSUMMING PROCESS
|
||||
{
|
||||
BYTE savedval = 0;
|
||||
LPBYTE sourceptr = ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+0x400;
|
||||
LPBYTE resultptr = ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
LPBYTE sourceptr = m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+0x400;
|
||||
LPBYTE resultptr = m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
int loop = 342;
|
||||
while (loop--)
|
||||
{
|
||||
@ -397,8 +397,8 @@ void CImageBase::Decode62(LPBYTE imageptr)
|
||||
|
||||
// CONVERT THE 342 6-BIT BYTES INTO 256 8-BIT BYTES
|
||||
{
|
||||
LPBYTE lowbitsptr = ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
LPBYTE sectorbase = ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+0x56;
|
||||
LPBYTE lowbitsptr = m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE;
|
||||
LPBYTE sectorbase = m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+0x56;
|
||||
BYTE offset = 0xAC;
|
||||
while (offset != 0x02)
|
||||
{
|
||||
@ -429,7 +429,7 @@ void CImageBase::Decode62(LPBYTE imageptr)
|
||||
|
||||
void CImageBase::DenibblizeTrack(LPBYTE trackimage, SectorOrder_e SectorOrder, int nibbles)
|
||||
{
|
||||
memset(ms_pWorkBuffer, 0, TRACK_DENIBBLIZED_SIZE);
|
||||
memset(m_pWorkBuffer, 0, TRACK_DENIBBLIZED_SIZE);
|
||||
|
||||
// SEARCH THROUGH THE TRACK IMAGE FOR EACH SECTOR. FOR EVERY SECTOR
|
||||
// WE FIND, COPY THE NIBBLIZED DATA FOR THAT SECTOR INTO THE WORK
|
||||
@ -467,15 +467,15 @@ void CImageBase::DenibblizeTrack(LPBYTE trackimage, SectorOrder_e SectorOrder, i
|
||||
int tempoffset = offset;
|
||||
while (loop < 384) // TODO-TC: Why 384? Only need 343 for Decode62()
|
||||
{
|
||||
*(ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+loop++) = *(trackimage+tempoffset++);
|
||||
*(m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+loop++) = *(trackimage+tempoffset++);
|
||||
if (tempoffset >= nibbles)
|
||||
tempoffset = 0;
|
||||
}
|
||||
|
||||
if (byteval[2] == 0x96)
|
||||
{
|
||||
sector = ((*(ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+4) & 0x55) << 1)
|
||||
| (*(ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+5) & 0x55);
|
||||
sector = ((*(m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+4) & 0x55) << 1)
|
||||
| (*(m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE+5) & 0x55);
|
||||
|
||||
#ifdef _DEBUG
|
||||
_ASSERT( sector < NUM_SECTORS );
|
||||
@ -494,7 +494,7 @@ void CImageBase::DenibblizeTrack(LPBYTE trackimage, SectorOrder_e SectorOrder, i
|
||||
uWriteDataFieldPrologueCount++;
|
||||
_ASSERT(uWriteDataFieldPrologueCount <= NUM_SECTORS);
|
||||
#endif
|
||||
Decode62(ms_pWorkBuffer+(ms_SectorNumber[SectorOrder][sector] << 8));
|
||||
Decode62(m_pWorkBuffer+(ms_SectorNumber[SectorOrder][sector] << 8));
|
||||
}
|
||||
sector = 0;
|
||||
}
|
||||
@ -506,7 +506,7 @@ void CImageBase::DenibblizeTrack(LPBYTE trackimage, SectorOrder_e SectorOrder, i
|
||||
|
||||
DWORD CImageBase::NibblizeTrack(LPBYTE trackimagebuffer, SectorOrder_e SectorOrder, int track)
|
||||
{
|
||||
memset(ms_pWorkBuffer+TRACK_DENIBBLIZED_SIZE, 0, TRACK_DENIBBLIZED_SIZE);
|
||||
memset(m_pWorkBuffer+TRACK_DENIBBLIZED_SIZE, 0, TRACK_DENIBBLIZED_SIZE);
|
||||
LPBYTE imageptr = trackimagebuffer;
|
||||
BYTE sector = 0;
|
||||
|
||||
@ -575,9 +575,9 @@ DWORD CImageBase::NibblizeTrack(LPBYTE trackimagebuffer, SectorOrder_e SectorOrd
|
||||
void CImageBase::SkewTrack(const int nTrack, const int nNumNibbles, const LPBYTE pTrackImageBuffer)
|
||||
{
|
||||
int nSkewBytes = (nTrack*768) % nNumNibbles;
|
||||
CopyMemory(ms_pWorkBuffer, pTrackImageBuffer, nNumNibbles);
|
||||
CopyMemory(pTrackImageBuffer, ms_pWorkBuffer+nSkewBytes, nNumNibbles-nSkewBytes);
|
||||
CopyMemory(pTrackImageBuffer+nNumNibbles-nSkewBytes, ms_pWorkBuffer, nSkewBytes);
|
||||
CopyMemory(m_pWorkBuffer, pTrackImageBuffer, nNumNibbles);
|
||||
CopyMemory(pTrackImageBuffer, m_pWorkBuffer+nSkewBytes, nNumNibbles-nSkewBytes);
|
||||
CopyMemory(pTrackImageBuffer+nNumNibbles-nSkewBytes, m_pWorkBuffer, nSkewBytes);
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
@ -659,7 +659,7 @@ public:
|
||||
virtual void Read(ImageInfo* pImageInfo, const float phase, LPBYTE pTrackImageBuffer, int* pNibbles, UINT* pBitCount, bool enhanceDisk)
|
||||
{
|
||||
const UINT track = PhaseToTrack(phase);
|
||||
ReadTrack(pImageInfo, track, ms_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
|
||||
ReadTrack(pImageInfo, track, m_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
|
||||
*pNibbles = NibblizeTrack(pTrackImageBuffer, eDOSOrder, track);
|
||||
if (!enhanceDisk)
|
||||
SkewTrack(track, *pNibbles, pTrackImageBuffer);
|
||||
@ -669,7 +669,7 @@ public:
|
||||
{
|
||||
const UINT track = PhaseToTrack(phase);
|
||||
DenibblizeTrack(pTrackImageBuffer, eDOSOrder, nNibbles);
|
||||
WriteTrack(pImageInfo, track, ms_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
|
||||
WriteTrack(pImageInfo, track, m_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
|
||||
}
|
||||
|
||||
virtual bool AllowCreate(void) { return true; }
|
||||
@ -727,7 +727,7 @@ public:
|
||||
virtual void Read(ImageInfo* pImageInfo, const float phase, LPBYTE pTrackImageBuffer, int* pNibbles, UINT* pBitCount, bool enhanceDisk)
|
||||
{
|
||||
const UINT track = PhaseToTrack(phase);
|
||||
ReadTrack(pImageInfo, track, ms_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
|
||||
ReadTrack(pImageInfo, track, m_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
|
||||
*pNibbles = NibblizeTrack(pTrackImageBuffer, eProDOSOrder, track);
|
||||
if (!enhanceDisk)
|
||||
SkewTrack(track, *pNibbles, pTrackImageBuffer);
|
||||
@ -737,7 +737,7 @@ public:
|
||||
{
|
||||
const UINT track = PhaseToTrack(phase);
|
||||
DenibblizeTrack(pTrackImageBuffer, eProDOSOrder, nNibbles);
|
||||
WriteTrack(pImageInfo, track, ms_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
|
||||
WriteTrack(pImageInfo, track, m_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
|
||||
}
|
||||
|
||||
virtual eImageType GetType(void) { return eImagePO; }
|
||||
@ -929,9 +929,9 @@ public:
|
||||
{
|
||||
ConvertSectorOrder(m_pHeader+14);
|
||||
SetFilePointer(pImageInfo->hFile, track*TRACK_DENIBBLIZED_SIZE+30, NULL, FILE_BEGIN);
|
||||
memset(ms_pWorkBuffer, 0, TRACK_DENIBBLIZED_SIZE);
|
||||
memset(m_pWorkBuffer, 0, TRACK_DENIBBLIZED_SIZE);
|
||||
DWORD bytesread;
|
||||
ReadFile(pImageInfo->hFile, ms_pWorkBuffer, TRACK_DENIBBLIZED_SIZE, &bytesread, NULL);
|
||||
ReadFile(pImageInfo->hFile, m_pWorkBuffer, TRACK_DENIBBLIZED_SIZE, &bytesread, NULL);
|
||||
*pNibbles = NibblizeTrack(pTrackImageBuffer, eSIMSYSTEMOrder, track);
|
||||
}
|
||||
// OTHERWISE, IF THIS IMAGE CONTAINS NIBBLE INFORMATION, READ IT DIRECTLY INTO THE TRACK BUFFER
|
||||
|
@ -99,8 +99,6 @@ protected:
|
||||
DWORD NibblizeTrack (LPBYTE trackimagebuffer, SectorOrder_e SectorOrder, int track);
|
||||
void SkewTrack (const int nTrack, const int nNumNibbles, const LPBYTE pTrackImageBuffer);
|
||||
|
||||
LPBYTE ms_pWorkBuffer;
|
||||
|
||||
public:
|
||||
UINT m_uNumTracksInImage; // Init'd by CDiskImageHelper.Detect()/GetImageForCreation() & possibly updated by IsValidImageSize()
|
||||
|
||||
@ -108,6 +106,7 @@ protected:
|
||||
static BYTE ms_DiskByte[0x40];
|
||||
static BYTE ms_SectorNumber[NUM_SECTOR_ORDERS][NUM_SECTORS];
|
||||
BYTE m_uVolumeNumber;
|
||||
LPBYTE m_pWorkBuffer;
|
||||
};
|
||||
|
||||
//-------------------------------------
|
||||
|
@ -61,8 +61,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "Debugger/DebugDefs.h"
|
||||
#include "YamlHelper.h"
|
||||
|
||||
// in this file use allocate the 64KB of RAM with an aligned memory allocations (0x1000)
|
||||
// to ease mapping between Apple ][ and host memory space (while debugging)
|
||||
// In this file allocate the 64KB of RAM with aligned memory allocations (0x10000)
|
||||
// to ease mapping between Apple ][ and host memory space (while debugging).
|
||||
|
||||
// this is not available in Visual Studio
|
||||
// https://en.cppreference.com/w/c/memory/aligned_alloc
|
||||
|
Loading…
Reference in New Issue
Block a user