/
MachineTypes.java
180 lines (166 loc) · 6.11 KB
/
MachineTypes.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package machine;
/**
*
* @author jsanchez
*/
public enum MachineTypes {
SPECTRUM16K(0),
SPECTRUM48K(1),
SPECTRUM128K(2),
SPECTRUMPLUS2(3),
SPECTRUMPLUS2A(4),
SPECTRUMPLUS3(5);
static public enum CodeModel { SPECTRUM48K, SPECTRUM128K, SPECTRUMPLUS3 };
public CodeModel codeModel; // Código de modelo
private String longModelName; // Nombre largo del modelo de Spectrum
private String shortModelName; // Nombre corto del modelo de Spectrum
public int clockFreq; // Clock frequency
public int tstatesFrame; // t-states por cuadro de la imagen
public int tstatesLine; // t-states por línea de imagen
public int upBorderWidth; // Número de líneas del borde superior
public int scanLines; // Número de líneas de imagen
public int firstScrByte; // t-states hasta el primer byte de la pantalla
public int lastScrUpdate; // t-states última actualización de la pantalla
public int outOffset; //
public int outBorderOffset; //
public int lengthINT; // Duración en t-states de la señal INT
private boolean hasAY8912; // Tiene un AY-3-8912?
private boolean hasDisk; // Tiene un controlador de disco y disquetera?
MachineTypes(int model) {
switch (model) {
case 0: // Spectrum 16K
this.longModelName = "ZX Spectrum 16K";
this.shortModelName = "16k";
this.clockFreq = 3500000;
this.tstatesFrame = 69888;
this.tstatesLine = 224;
this.upBorderWidth = 64;
this.scanLines = 312;
this.lengthINT = 32;
this.firstScrByte = 14336;
this.lastScrUpdate = 57246;
this.outOffset = 3;
this.outBorderOffset = 0;
this.hasAY8912 = false;
this.hasDisk = false;
this.codeModel = CodeModel.SPECTRUM48K;
break;
case 1: // Spectrum 48K
this.longModelName = "ZX Spectrum 48K";
this.shortModelName = "48k";
this.clockFreq = 3500000;
this.tstatesFrame = 69888;
this.tstatesLine = 224;
this.upBorderWidth = 64;
this.scanLines = 312;
this.lengthINT = 32;
this.firstScrByte = 14336;
this.lastScrUpdate = 57246;
this.outOffset = 3;
this.outBorderOffset = 0;
this.hasAY8912 = false;
this.hasDisk = false;
this.codeModel = CodeModel.SPECTRUM48K;
break;
case 2: // Spectrum 128K
this.longModelName = "ZX Spectrum 128K";
this.shortModelName = "128";
this.clockFreq = 3546900;
this.tstatesFrame = 70908;
this.tstatesLine = 228;
this.upBorderWidth = 63;
this.scanLines = 311;
this.lengthINT = 36;
this.firstScrByte = 14362;
this.lastScrUpdate = 58040;
this.outOffset = 1;
this.outBorderOffset = 2;
this.hasAY8912 = true;
this.hasDisk = false;
this.codeModel = CodeModel.SPECTRUM128K;
break;
case 3: // Spectrum +2
this.longModelName = "Amstrad ZX Spectrum +2";
this.shortModelName = " +2";
this.clockFreq = 3546900;
this.tstatesFrame = 70908;
this.tstatesLine = 228;
this.upBorderWidth = 63;
this.scanLines = 311;
this.lengthINT = 36;
this.firstScrByte = 14362;
this.lastScrUpdate = 58040;
this.outOffset = 1;
this.outBorderOffset = 2;
this.hasAY8912 = true;
this.hasDisk = false;
this.codeModel = CodeModel.SPECTRUM128K;
break;
case 4: // Spectrum +2A
this.longModelName = "ZX Spectrum +2A";
this.shortModelName = "+2A";
this.clockFreq = 3546900;
this.tstatesFrame = 70908;
this.tstatesLine = 228;
this.upBorderWidth = 63;
this.scanLines = 311;
this.lengthINT = 32;
this.firstScrByte = 14364;
this.lastScrUpdate = 58044;
this.outOffset = 1;
this.outBorderOffset = -1;
this.hasAY8912 = true;
this.hasDisk = false;
this.codeModel = CodeModel.SPECTRUMPLUS3;
break;
case 5: // Spectrum +3
this.longModelName = "ZX Spectrum +3";
this.shortModelName = " +3";
this.clockFreq = 3546900;
this.tstatesFrame = 70908;
this.tstatesLine = 228;
this.upBorderWidth = 63;
this.scanLines = 311;
this.lengthINT = 32;
this.firstScrByte = 14364;
this.lastScrUpdate = 58044;
this.outOffset = 1;
this.outBorderOffset = -1;
this.hasAY8912 = true;
this.hasDisk = true;
this.codeModel = CodeModel.SPECTRUMPLUS3;
break;
}
}
public String getLongModelName() {
return longModelName;
}
public String getShortModelName() {
return shortModelName;
}
public int getTstatesFrame() {
return tstatesFrame;
}
public int getTstatesLine() {
return tstatesLine;
}
public int getBorderLines() {
return upBorderWidth;
}
public int getScanLines() {
return scanLines;
}
public int getTstatesINT() {
return lengthINT;
}
public boolean hasAY8912() {
return hasAY8912;
}
public boolean hasDisk() {
return hasDisk;
}
}