ROLAND  0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
crtc.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2013 by Fred Klaus <development@fkweb.de> *
3  * *
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_CRTC_H
21 #define CPC_CRTC_H
22 
23 #include "types.h"
24 #include "ppi.h"
25 
26 namespace cpcx
27 {
30  class Crtc final
31  {
32 
33  public:
35  {
39  SyncWidth = 3,
50  CursorHigh = 14,
51  CursorLow = 15,
52  LightPenHigh = 16,
54  };
55 
56  enum Flags : tUWORD
57  {
58  VS = 1,
59  HS = 2,
60  HDT = 4,
61  VDT = 8,
62  HT = 16,
63  VT = 32,
64  MR = 64,
65  VTadj = 128,
66  VSf = 256
67  };
68 
69  Crtc() : mPpi(0), mSelected(0) {init();}
71 
72  void init(Ppi* ppi = nullptr);
73 
74  tUBYTE selected() const {return mSelected;}
75 
76  tUBYTE read() const {return mRegister[mSelected];}
77  tUBYTE read (tUBYTE num) const {return (num < 18) ? mRegister[num] : 0;}
78  void select(tUBYTE reg) {if (reg < 18) mSelected = reg;}
79  void write (tUBYTE reg, tUBYTE value) {mRegister[reg] = value;}
80  void write (tUBYTE value);
81 
82  uint flags() {return mFlags;}
83  tUBYTE hsw() {return mHsw;}
84  tBYTE hswVdu() {return mHswVdu;}
87  tUBYTE vsw() {return mVsw;}
90  tUBYTE skew() {return mSkew;}
98  uint addr() {return mAddr;}
99 
100 
101 
104  void removeFlags (uint flags) {mFlags &= ~flags;}
105  //void setHsw(tUBYTE val) {write(read(SyncWidth) | (val & 0x0f));}
106  //void setVsw(tUBYTE val) {write(read(SyncWidth) | (val >> 4));}
107  void setHswVdu (tUBYTE value) {mHswVdu = value;}
108  void setHswActive (tUBYTE value) {mHswActive = value;}
109  void setHswCount (tUBYTE value) {mHswCount = value;}
110  void setAddr (uint value) {mAddr = value;}
111  void setVtAdjust (tUBYTE value) {mVtAdjust = value;}
112  void setVtAdjustCount (tUBYTE value) {mVtAdjustCount = value;}
113  void setVswCount (tUBYTE value) {mVswCount = value;}
114  void setLastHDisp (tUBYTE value) {mLastHDisp = value;}
115  void setCharCount (tUBYTE value) {mCharCount = value;}
116  void setLineCount (tUBYTE value) {mLineCount = value;}
117  void setRasterCount (tUBYTE value) {mRasterCount = value;}
118  void setSkew (tUBYTE value) {mSkew = value;}
119 
120  void incVswCount() {mVswCount++;}
121  //void decVswCount() {--mVswCount;}
122  //void incLineCount() {mLineCount++;}
123 
124  private:
126 
129 
132  tBYTE mHswVdu; // formerly known as Vdu::mHsw
147 
148  };
149 
150 } // cpc
151 
152 #endif // CPC_CRTC_H
tUBYTE lineCount()
Definition: crtc.h:95
tUBYTE mSkew
Definition: crtc.h:138
tUBYTE mCharCount
Definition: crtc.h:144
30 30 27
Definition: crtc.h:43
uint requestedAddr()
Definition: crtc.h:97
VSync.
Definition: crtc.h:58
tUBYTE mRegister[18]
Definition: crtc.h:127
tUBYTE mVsw
Definition: crtc.h:135
void init()
Definition: roland.cpp:97
void incVswCount()
Definition: crtc.h:120
X X X.
Definition: crtc.h:48
38 38 31
Definition: crtc.h:40
X X X.
Definition: crtc.h:46
tUBYTE mMaxRaster
Definition: crtc.h:141
tUBYTE hsw()
Definition: crtc.h:83
uint flags()
Definition: crtc.h:82
tUBYTE mHswActive
Definition: crtc.h:134
tUBYTE mHsw
Definition: crtc.h:131
void setHswCount(tUBYTE value)
Definition: crtc.h:109
void setRasterCount(tUBYTE value)
Definition: crtc.h:117
tUBYTE vtAdjustCount()
Definition: crtc.h:92
tUBYTE selected() const
Definition: crtc.h:74
HSync.
Definition: crtc.h:59
tUBYTE skew()
Definition: crtc.h:90
Namespace for all CPC components.
Definition: colours.cpp:22
7 7 7
Definition: crtc.h:45
tUBYTE hswActive()
Definition: crtc.h:85
tUBYTE maxRaster()
Definition: crtc.h:93
X X X.
Definition: crtc.h:49
Register
Definition: crtc.h:34
46 46 46
Definition: crtc.h:38
void setHswVdu(tUBYTE value)
Definition: crtc.h:107
tUBYTE charCount()
Definition: crtc.h:96
tUBYTE lastHDisp()
Definition: crtc.h:89
void setVtAdjustCount(tUBYTE value)
Definition: crtc.h:112
X X X.
Definition: crtc.h:52
void setVswCount(tUBYTE value)
Definition: crtc.h:113
~Crtc() ROLAND_DEFAULT void init(Ppi *ppi
25 25 25
Definition: crtc.h:42
void setHswActive(tUBYTE value)
Definition: crtc.h:108
VerticalDisplayedTotal.
Definition: crtc.h:61
uint addr()
Definition: crtc.h:98
Definition: crtc.h:30
Flags
Definition: crtc.h:56
tUBYTE mVtAdjust
Definition: crtc.h:139
tBYTE hswVdu()
Definition: crtc.h:84
Definition: ppi.h:31
void setCharCount(tUBYTE value)
Definition: crtc.h:115
tUBYTE mSelected
Definition: crtc.h:128
X X X.
Definition: crtc.h:50
tUBYTE mVtAdjustCount
Definition: crtc.h:140
40 40 40
Definition: crtc.h:37
void setLastHDisp(tUBYTE value)
Definition: crtc.h:114
VerticalSyncPosition.
Definition: crtc.h:66
tUBYTE mLastHDisp
Definition: crtc.h:137
Crtc()
Definition: crtc.h:69
tBYTE mHswVdu
Definition: crtc.h:132
VerticalTotalAdjust.
Definition: crtc.h:65
void addFlags(uint flags)
Definition: crtc.h:103
uint mAddr
Definition: crtc.h:146
HorizontalDisplayedTotal.
Definition: crtc.h:60
tUBYTE mRasterCount
Definition: crtc.h:142
VerticalTotal.
Definition: crtc.h:63
X X X.
Definition: crtc.h:47
uint mFlags
Definition: crtc.h:130
int8_t tBYTE
Definition: types.h:40
tUBYTE rasterCount()
Definition: crtc.h:94
0x8E 0x8E 0x8E
Definition: crtc.h:39
X X X.
Definition: crtc.h:53
#define ROLAND_DEFAULT
Definition: compspec.h:46
uint8_t tUBYTE
Definition: types.h:74
unsigned int uint
Definition: types.h:121
void setVtAdjust(tUBYTE value)
Definition: crtc.h:111
tUBYTE read() const
Definition: crtc.h:76
tUBYTE mVswCount
Definition: crtc.h:136
tUBYTE vswCount()
Definition: crtc.h:88
uint mRequestedAddr
Definition: crtc.h:145
tUBYTE hswCount()
Definition: crtc.h:86
X X X.
Definition: crtc.h:51
HorizontalTotal.
Definition: crtc.h:62
tUBYTE read(tUBYTE num) const
Definition: crtc.h:77
PAL SECAM NTSC.
Definition: crtc.h:36
tUBYTE mLineCount
Definition: crtc.h:143
tUBYTE vtAdjust()
Definition: crtc.h:91
uint16_t tUWORD
Definition: types.h:80
0 0 6
Definition: crtc.h:41
tUBYTE vsw()
Definition: crtc.h:87
void setSkew(tUBYTE value)
Definition: crtc.h:118
void removeFlags(uint flags)
Definition: crtc.h:104
void write(tUBYTE reg, tUBYTE value)
Definition: crtc.h:79
MaximumRasterAddress.
Definition: crtc.h:64
tUBYTE mHswCount
Definition: crtc.h:133
void select(tUBYTE reg)
Definition: crtc.h:78
Ppi * mPpi
Definition: crtc.h:125
void setAddr(uint value)
Definition: crtc.h:110
void setFlags(uint flags)
Definition: crtc.h:102
void setLineCount(tUBYTE value)
Definition: crtc.h:116
0 0 0
Definition: crtc.h:44