ROLAND  0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
cpc.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) by Fred Klaus *
3  * development@fkweb.de *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 #ifndef CPC_CPC_H
21 #define CPC_CPC_H
22 
23 #include "config.h"
24 #include "types.h"
25 #include "prefs.h"
26 
27 #ifdef ENABLE_RAZE
28 #include "raze.h"
29 #endif
30 
31 #include "z80.h"
32 #include "crtc.h"
33 #include "ppi.h"
34 #include "fdc.h"
35 #include "psg.h"
36 #include "gatearray.h"
37 #include "memman.h"
38 #include "keyboard.h"
39 #include "colours.h"
40 #include "sound.h"
41 #include "vdu.h"
42 
44 namespace cpcx
45 {
46 
47 #define mPsg_write \
48 { \
49  tUBYTE control = mPsg.control() & 0xc0; /* isolate PSG control bits */ \
50  if (control == 0xc0) { /* latch address? */ \
51  mPsg.setSelected(mPsg_data); /* select new PSG register */ \
52 } else if (control == 0x80) { /* write? */ \
53  if (mPsg.selected() < 16) { /* valid register? */ \
54  mSound.setAYRegister(mPsg.selected(), mPsg_data); \
55 } \
56 } \
57 }
58 
61  class Cpc final
62  {
63 
64  public:
65  enum class CpcType : unsigned char
66  {
67  cpc464 = 0,
68  cpc664 = 1,
69  cpc6128 = 2
70  };
71  enum class RamSize : unsigned short int
72  {
73  ram64 = 64,
74  ram128 = 128,
75  ram256 = 256,
76  ram512 = 512
77  };
78  //enum Monitor {colour=0, green=1, grey=2};
79 
80 
82  Cpc(const Prefs & prefs);
84 
85  int init() ROLAND_NOEXCEPT;
86 
87  void setSpeed(uint value) {mSpeed = value;}
88 
89  uint speed() const {return mSpeed;}
90  //Monitor monitor() {return mMonitor;}
91 
92  tUBYTE z80_in_handler (tREGPAIR port) ROLAND_NOEXCEPT; //@todo change This !!
93  void z80_out_handler(tREGPAIR port, tUBYTE value) ROLAND_NOEXCEPT;
95 
96 
97  Z80 & z80() {return mZ80;}
98  Ppi & ppi() {return mPpi;}
99  Fdc & fdc() {return mFdc;}
100  Psg & psg() {return mPsg;}
101  Vdu & vdu() {return mVdu;}
102  Crtc & crtc() {return mCrtc;}
103  Sound & sound() {return mSound;}
104  MemMan & memman() {return mMemman;}
105  Colours & colours() {return mColours;}
108 
109  private:
111  //Monitor mMonitor;
112 
115 
117 
129 
130  };
131 
132 } // cpc
133 
134 #endif // CPC_CPC_H
Ppi & ppi()
Definition: cpc.h:98
Z80 mZ80
Definition: cpc.h:118
Colours mColours
Definition: cpc.h:125
CpcType
Definition: cpc.h:65
Sound mSound
Definition: cpc.h:127
void init()
Definition: roland.cpp:97
Definition: psg.h:32
Ppi mPpi
Definition: cpc.h:120
Definition: prefs.h:31
Namespace for all CPC components.
Definition: colours.cpp:22
uint mSpeed
Definition: cpc.h:113
uint mBpp
Definition: cpc.h:114
Vdu mVdu
Definition: cpc.h:128
Sound & sound()
Definition: cpc.h:103
The sound chip of the CPC.
Definition: sound.h:31
Psg & psg()
Definition: cpc.h:100
Vdu & vdu()
Definition: cpc.h:101
The floppy drive controller.
Definition: fdc.h:34
Psg mPsg
Definition: cpc.h:122
Definition: crtc.h:30
Definition: vdu.h:40
Keyboard mKeyboard
Definition: cpc.h:124
Definition: ppi.h:31
~Cpc() ROLAND_DEFAULT int init() ROLAND_NOEXCEPT
Get byte from port
Definition: 8255.txt:134
Definition: z80.h:44
Definition: memman.h:31
Prefs mPrefs
Definition: cpc.h:116
Keyboard & keyboard()
Definition: cpc.h:106
void waitstates() ROLAND_NOEXCEPT
Definition: cpc.cpp:415
Crtc & crtc()
Definition: cpc.h:102
CpcType mCpcType
Definition: cpc.h:110
Prefs prefs
Definition: roland.cpp:74
tUBYTE z80_in_handler(tREGPAIR port) ROLAND_NOEXCEPT
Definition: cpc.cpp:102
uint speed() const
Definition: cpc.h:89
Definition: colours.h:30
GateArray mGatearray
Definition: cpc.h:123
Z80 & z80()
Definition: cpc.h:97
GateArray & gatearray()
Definition: cpc.h:107
#define ROLAND_DEFAULT
Definition: compspec.h:46
uint8_t tUBYTE
Definition: types.h:74
unsigned int uint
Definition: types.h:121
Fdc mFdc
Definition: cpc.h:121
Crtc mCrtc
Definition: cpc.h:119
#define ROLAND_NOEXCEPT
Definition: compspec.h:36
Definition: cpc.h:61
Definition: keyboard.h:31
Definition: gatearray.h:31
MemMan mMemman
Definition: cpc.h:126
Cpc() ROLAND_DELETE Cpc(const Prefs &prefs)
MemMan & memman()
Definition: cpc.h:104
void z80_out_handler(tREGPAIR port, tUBYTE value) ROLAND_NOEXCEPT
Definition: cpc.cpp:242
Colours & colours()
Definition: cpc.h:105
RamSize
Definition: cpc.h:71
Fdc & fdc()
Definition: cpc.h:99
void setSpeed(uint value)
Definition: cpc.h:87
#define ROLAND_DELETE
Definition: compspec.h:47