00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef FDC_H
00021 #define FDC_H
00022
00023 #include "fdcconst.h"
00024 #include "types.h"
00025 #include "drive.h"
00026 #include "cmdtable.h"
00027
00028 #include <cstdio>
00029
00030
00032 class Fdc
00033 {
00034
00035 public:
00036 Fdc();
00037 ~Fdc() {}
00038
00039 typedef void (Fdc::*CmdHandler)(void);
00040
00041 void write_data(UBYTE val);
00042 UBYTE read_status();
00043 UBYTE read_data();
00044 void specify();
00045 void drvstat();
00046 void recalib();
00047 void intstat();
00048 void seek();
00049 void readtrk();
00050 void write();
00051 void read();
00052 void readID();
00053 void writeID();
00054 void scan();
00055
00056 void check_unit();
00057 int init_status_regs();
00058 Sector* find_sector(UBYTE *requested_CHRN);
00059 inline void cmd_write();
00060 inline void cmd_read();
00061 inline void cmd_readtrk();
00062 inline void cmd_scan();
00063
00064 int dsk_load(const char *pchFileName, int drv, char chID='A');
00065 void dsk_eject(int drv);
00066
00067
00068
00069
00070 int motor() {return mMotor;}
00071 void setMotor(int s) {mMotor=s;}
00072 int flags() {return mFlags;}
00073 void addFlags(int flags) {mFlags |= flags;}
00074 int phase() {return mPhase;}
00075 int timeout() {return mTimeout;}
00076 void setTimeout(int val) {mTimeout=val;}
00077
00078 int cmdDirection() {return mCmdDirection;}
00079
00080 bool led() {return mLed;}
00081
00082 private:
00083 int mTimeout;
00084 int mMotor;
00085 bool mLed;
00086 int mFlags;
00087 int mPhase;
00088 int mByteCount;
00089 int mBufferCount;
00090 int mCmdLength;
00091 int mResLength;
00092 int mCmdDirection;
00093 CmdHandler mCmdHandler;
00094
00095
00096 UBYTE* pbGPBuffer;
00097
00098 UBYTE* mBufferPtr;
00099 UBYTE* mBufferEndPtr;
00100 UBYTE mCommand[12];
00101 UBYTE mResult[8];
00102
00103 Drive mDriveA;
00104 Drive mDriveB;
00105
00106 Drive *mActiveDrive;
00107 Track *mActiveTrack;
00108 UWORD mReadStatusDelay;
00109 UWORD mBytesTransferred;
00110
00111 CmdTable mCmdTable;
00112
00113 FILE *pfileObject;
00114
00115 };
00116
00117 #endif
00118
00119