00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef CPC_H
00021 #define CPC_H
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026
00027 #include "types.h"
00028 #include "prefs.h"
00029
00030 #ifdef ENABLE_RAZE
00031 #include "raze.h"
00032 #endif
00033
00034 #include "z80.h"
00035 #include "crtc.h"
00036 #include "ppi.h"
00037 #include "fdc.h"
00038 #include "psg.h"
00039 #include "gatearray.h"
00040 #include "memman.h"
00041 #include "keyboard.h"
00042 #include "colours.h"
00043 #include "sound.h"
00044 #include "vdu.h"
00045
00046
00047 #define MIN_SPEED_SETTING 2
00048 #define MAX_SPEED_SETTING 32
00049 #define DEF_SPEED_SETTING 4
00050
00051
00052 #define CYCLE_COUNT_INIT 80000
00053
00054 #define mPsg_write \
00055 { \
00056 UBYTE control = mPsg.control() & 0xc0; \
00057 if (control == 0xc0) { \
00058 mPsg.setSelected(mPsg_data); \
00059 } else if (control == 0x80) { \
00060 if (mPsg.selected() < 16) { \
00061 mSound.setAYRegister(mPsg.selected(), mPsg_data); \
00062 } \
00063 } \
00064 }
00065
00066
00067
00069 class Cpc
00070 {
00071
00072 public:
00073 enum CpcType {cpc464=0, cpc664=1, cpc6128=2};
00074 enum RamSize {ram64=64, ram128=128, ram256=256, ram512=512};
00075
00076
00077
00078 Cpc(Prefs* prefs);
00079 ~Cpc() {}
00080
00081 int init(Prefs* prefs=0);
00082
00083 void setSpeed(uint value) {mSpeed=value;}
00084
00085 uint speed() {return mSpeed;}
00086
00087
00088 UBYTE z80_in_handler (REGPAIR port);
00089 void z80_out_handler(REGPAIR port, UBYTE value);
00090 void waitstates();
00091
00092
00093 Z80 & z80() {return mZ80;}
00094 Ppi & ppi() {return mPpi;}
00095 Fdc & fdc() {return mFdc;}
00096 Psg & psg() {return mPsg;}
00097 Vdu & vdu() {return mVdu;}
00098 Crtc & crtc() {return mCrtc;}
00099 Sound & sound() {return mSound;}
00100 MemMan & memman() {return mMemman;}
00101 Colours & colours() {return mColours;}
00102 Keyboard & keyboard() {return mKeyboard;}
00103 GateArray & gatearray() {return mGatearray;}
00104
00105 private:
00106 CpcType mCpcType;
00107
00108
00109 uint mSpeed;
00110 uint mBpp;
00111
00112 Prefs* mPrefs;
00113
00114 Z80 mZ80;
00115 Crtc mCrtc;
00116 Ppi mPpi;
00117 Fdc mFdc;
00118 Psg mPsg;
00119 GateArray mGatearray;
00120 Keyboard mKeyboard;
00121 Colours mColours;
00122 MemMan mMemman;
00123 Sound mSound;
00124 Vdu mVdu;
00125
00126 };
00127
00128 #endif