AppleWin/source/DiskImage.h
tomcw 4a69ba8a97 git merge --squash GH125-ProDOS-Format. Fix for disk formatting #125, #196, #338:
. .dsk / .nib images
. ProDOS format / DOS 3.3 init
. authentic / enhanced disk access speed

For zero-length files, resize to the complete file size when first opened (#506)
. Support both .dsk and .nib

Created a new class FormatTrack to encapsulate the new track formatting logic

Improved precision of 'authentic' drive mode's spin emulation (#125)

Save-state: (save-state DiskII unit v2)
. support Format Track state
. save DiskLastCycle

DenibblizeTrack(): added some debug asserts and comments

Updated for VS2008/VS2013/2015/2017 projs & remove dependency on ddraw.lib for VS2013/2015

Updated disk logging:
. Moved all LOG_DISK_xx macros to new DiskLog.h (since shared by Disk.cpp and DiskFormatTrack.cpp)
. For write nibble: option to log cycle count & sync byte count
. For written track: option to log gap1/2/3 and track size
. For disk latch r/w: option to log when D5AA96 detected

Other:
. Debugger: Fix CD cmd to support absolute paths (#505)
2018-01-14 18:01:22 +00:00

86 lines
3.0 KiB
C++

#pragma once
/*
AppleWin : An Apple //e emulator for Windows
Copyright (C) 1994-1996, Michael O'Brien
Copyright (C) 1999-2001, Oliver Schmidt
Copyright (C) 2002-2005, Tom Charlesworth
Copyright (C) 2006-2010, Tom Charlesworth, Michael Pohoreski
AppleWin 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 2 of the License, or
(at your option) any later version.
AppleWin 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 AppleWin; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "DiskDefs.h"
#define TRACK_DENIBBLIZED_SIZE (16 * 256) // #Sectors x Sector-size
#define TRACKS_STANDARD 35
#define TRACKS_EXTRA 5 // Allow up to a 40-track .dsk image (160KB)
#define TRACKS_MAX (TRACKS_STANDARD+TRACKS_EXTRA)
enum Disk_Status_e
{
DISK_STATUS_OFF ,
DISK_STATUS_READ ,
DISK_STATUS_WRITE,
DISK_STATUS_PROT ,
NUM_DISK_STATUS
};
enum ImageError_e
{
eIMAGE_ERROR_NONE,
eIMAGE_ERROR_BAD_POINTER,
eIMAGE_ERROR_BAD_SIZE,
eIMAGE_ERROR_BAD_FILE,
eIMAGE_ERROR_UNSUPPORTED,
eIMAGE_ERROR_UNSUPPORTED_HDV,
eIMAGE_ERROR_GZ,
eIMAGE_ERROR_ZIP,
eIMAGE_ERROR_REJECTED_MULTI_ZIP,
eIMAGE_ERROR_UNSUPPORTED_MULTI_ZIP,
eIMAGE_ERROR_UNABLE_TO_OPEN,
eIMAGE_ERROR_UNABLE_TO_OPEN_GZ,
eIMAGE_ERROR_UNABLE_TO_OPEN_ZIP,
eIMAGE_ERROR_FAILED_TO_GET_PATHNAME,
eIMAGE_ERROR_ZEROLENGTH_WRITEPROTECTED,
eIMAGE_ERROR_FAILED_TO_INIT_ZEROLENGTH,
};
const int MAX_DISK_IMAGE_NAME = 15;
const int MAX_DISK_FULL_NAME = 127;
struct ImageInfo;
ImageError_e ImageOpen(LPCTSTR pszImageFilename, ImageInfo** ppImageInfo, bool* pWriteProtected, const bool bCreateIfNecessary, std::string& strFilenameInZip, const bool bExpectFloppy=true);
void ImageClose(ImageInfo* const pImageInfo, const bool bOpenError=false);
BOOL ImageBoot(ImageInfo* const pImageInfo);
void ImageDestroy(void);
void ImageInitialize(void);
void ImageReadTrack(ImageInfo* const pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles);
void ImageWriteTrack(ImageInfo* const pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImage, int nNibbles);
bool ImageReadBlock(ImageInfo* const pImageInfo, UINT nBlock, LPBYTE pBlockBuffer);
bool ImageWriteBlock(ImageInfo* const pImageInfo, UINT nBlock, LPBYTE pBlockBuffer);
int ImageGetNumTracks(ImageInfo* const pImageInfo);
bool ImageIsWriteProtected(ImageInfo* const pImageInfo);
bool ImageIsMultiFileZip(ImageInfo* const pImageInfo);
const char* ImageGetPathname(ImageInfo* const pImageInfo);
UINT ImageGetImageSize(ImageInfo* const pImageInfo);
void GetImageTitle(LPCTSTR pPathname, TCHAR* pImageName, TCHAR* pFullName);