MemoryMappedDevice.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: package xeij;
36:
37: import java.lang.*;
38: import java.util.*;
39:
40: public enum MemoryMappedDevice {
41:
42:
43:
44: MMD_MMR {
45: @Override public String toString () {
46: return Multilingual.mlnJapanese ? "メインメモリ" : "Main Memory";
47: }
48:
49: @Override protected byte mmdPbs (int a) {
50: a &= XEiJ.BUS_MOTHER_MASK;
51: return MainMemory.mmrM8[a];
52: }
53: @Override protected int mmdPbz (int a) {
54: a &= XEiJ.BUS_MOTHER_MASK;
55: return MainMemory.mmrM8[a] & 0xff;
56: }
57: @Override protected int mmdPws (int a) {
58: a &= XEiJ.BUS_MOTHER_MASK;
59: if (MainMemory.MMR_USE_BYTE_BUFFER) {
60: return MainMemory.mmrBuffer.getShort (a);
61: } else {
62: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
63: }
64: }
65: @Override protected int mmdPwz (int a) {
66: a &= XEiJ.BUS_MOTHER_MASK;
67: if (MainMemory.MMR_USE_BYTE_BUFFER) {
68: return MainMemory.mmrBuffer.getChar (a);
69: } else {
70: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
71: }
72: }
73: @Override protected int mmdPls (int a) {
74: a &= XEiJ.BUS_MOTHER_MASK;
75: if (MainMemory.MMR_USE_BYTE_BUFFER) {
76: return MainMemory.mmrBuffer.getInt (a);
77: } else {
78: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
79: }
80: }
81:
82: @Override protected byte mmdRbs (int a) throws M68kException {
83: XEiJ.mpuClockTime += XEiJ.busWaitTime.ram;
84: a &= XEiJ.BUS_MOTHER_MASK;
85: return MainMemory.mmrM8[a];
86: }
87: @Override protected int mmdRbz (int a) throws M68kException {
88: XEiJ.mpuClockTime += XEiJ.busWaitTime.ram;
89: a &= XEiJ.BUS_MOTHER_MASK;
90: return MainMemory.mmrM8[a] & 0xff;
91: }
92: @Override protected int mmdRws (int a) throws M68kException {
93: XEiJ.mpuClockTime += XEiJ.busWaitTime.ram;
94: a &= XEiJ.BUS_MOTHER_MASK;
95: if (MainMemory.MMR_USE_BYTE_BUFFER) {
96: return MainMemory.mmrBuffer.getShort (a);
97: } else {
98: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
99: }
100: }
101: @Override protected int mmdRwz (int a) throws M68kException {
102: XEiJ.mpuClockTime += XEiJ.busWaitTime.ram;
103: a &= XEiJ.BUS_MOTHER_MASK;
104: if (MainMemory.MMR_USE_BYTE_BUFFER) {
105: return MainMemory.mmrBuffer.getChar (a);
106: } else {
107: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
108: }
109: }
110: @Override protected int mmdRls (int a) throws M68kException {
111: XEiJ.mpuClockTime += XEiJ.busWaitTime.ramlong;
112: a &= XEiJ.BUS_MOTHER_MASK;
113: if (MainMemory.MMR_USE_BYTE_BUFFER) {
114: return MainMemory.mmrBuffer.getInt (a);
115: } else {
116: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
117: }
118: }
119:
120: @Override protected void mmdWb (int a, int d) throws M68kException {
121: XEiJ.mpuClockTime += XEiJ.busWaitTime.ram;
122: a &= XEiJ.BUS_MOTHER_MASK;
123: MainMemory.mmrM8[a ] = (byte) d;
124: }
125: @Override protected void mmdWw (int a, int d) throws M68kException {
126: XEiJ.mpuClockTime += XEiJ.busWaitTime.ram;
127: a &= XEiJ.BUS_MOTHER_MASK;
128: if (MainMemory.MMR_USE_BYTE_BUFFER) {
129: MainMemory.mmrBuffer.putShort (a, (short) d);
130: } else {
131: MainMemory.mmrM8[a ] = (byte) (d >> 8);
132: MainMemory.mmrM8[a + 1] = (byte) d;
133: }
134: }
135: @Override protected void mmdWl (int a, int d) throws M68kException {
136: XEiJ.mpuClockTime += XEiJ.busWaitTime.ramlong;
137: a &= XEiJ.BUS_MOTHER_MASK;
138: if (MainMemory.MMR_USE_BYTE_BUFFER) {
139: MainMemory.mmrBuffer.putInt (a, d);
140: } else {
141: MainMemory.mmrM8[a ] = (byte) (d >> 24);
142: MainMemory.mmrM8[a + 1] = (byte) (d >> 16);
143: MainMemory.mmrM8[a + 2] = (byte) (d >> 8);
144: MainMemory.mmrM8[a + 3] = (byte) d;
145: }
146: }
147: },
148:
149:
150:
151:
152:
153:
154: MMD_MM1 {
155: @Override public String toString () {
156: return Multilingual.mlnJapanese ? "1MB 搭載機の 2MB 目" : "2nd MB of machines with 1MB";
157: }
158:
159: @Override protected byte mmdRbs (int a) throws M68kException {
160: XEiJ.mpuClockTime += XEiJ.busWaitTime.ram;
161: return (byte) ((a & 1) == 0 ? mmdRwz (a) >> 8 : mmdRwz (a));
162: }
163: @Override protected int mmdRbz (int a) throws M68kException {
164: XEiJ.mpuClockTime += XEiJ.busWaitTime.ram;
165: return (a & 1) == 0 ? mmdRwz (a) >> 8 : mmdRwz (a) & 0xff;
166: }
167: @Override protected int mmdRws (int a) throws M68kException {
168: XEiJ.mpuClockTime += XEiJ.busWaitTime.ram;
169: return (short) mmdRwz (a);
170: }
171: @Override protected int mmdRwz (int a) throws M68kException {
172: XEiJ.mpuClockTime += XEiJ.busWaitTime.ram;
173: return XEiJ.currentModel.isShodai () ? 0x6100 : 0xffff;
174: }
175: @Override protected int mmdRls (int a) throws M68kException {
176: XEiJ.mpuClockTime += XEiJ.busWaitTime.ramlong;
177: return mmdRwz (a) << 16 | mmdRwz (a + 2);
178: }
179:
180: @Override protected void mmdWb (int a, int d) throws M68kException {
181: XEiJ.mpuClockTime += XEiJ.busWaitTime.ram;
182: }
183: @Override protected void mmdWw (int a, int d) throws M68kException {
184: XEiJ.mpuClockTime += XEiJ.busWaitTime.ram;
185: }
186: @Override protected void mmdWl (int a, int d) throws M68kException {
187: XEiJ.mpuClockTime += XEiJ.busWaitTime.ramlong;
188: }
189: },
190:
191:
192:
193: MMD_XMM {
194: @Override public String toString () {
195: return Multilingual.mlnJapanese ? "拡張メモリ" : "Expansion Memory";
196: }
197:
198: @Override protected byte mmdPbs (int a) {
199: a -= XEiJ.busExMemoryStart;
200: return XEiJ.busExMemoryArray[a];
201: }
202: @Override protected int mmdPbz (int a) {
203: a -= XEiJ.busExMemoryStart;
204: return XEiJ.busExMemoryArray[a] & 0xff;
205: }
206: @Override protected int mmdPws (int a) {
207: a -= XEiJ.busExMemoryStart;
208: return XEiJ.busExMemoryArray[a] << 8 | (XEiJ.busExMemoryArray[a + 1] & 0xff);
209: }
210: @Override protected int mmdPwz (int a) {
211: a -= XEiJ.busExMemoryStart;
212: return (char) (XEiJ.busExMemoryArray[a] << 8 | (XEiJ.busExMemoryArray[a + 1] & 0xff));
213: }
214: @Override protected int mmdPls (int a) {
215: a -= XEiJ.busExMemoryStart;
216: return XEiJ.busExMemoryArray[a] << 24 | (XEiJ.busExMemoryArray[a + 1] & 0xff) << 16 | (char) (XEiJ.busExMemoryArray[a + 2] << 8 | (XEiJ.busExMemoryArray[a + 3] & 0xff));
217: }
218:
219: @Override protected byte mmdRbs (int a) throws M68kException {
220: a -= XEiJ.busExMemoryStart;
221: return XEiJ.busExMemoryArray[a];
222: }
223: @Override protected int mmdRbz (int a) throws M68kException {
224: a -= XEiJ.busExMemoryStart;
225: return XEiJ.busExMemoryArray[a] & 0xff;
226: }
227: @Override protected int mmdRws (int a) throws M68kException {
228: a -= XEiJ.busExMemoryStart;
229: return XEiJ.busExMemoryArray[a] << 8 | (XEiJ.busExMemoryArray[a + 1] & 0xff);
230: }
231: @Override protected int mmdRwz (int a) throws M68kException {
232: a -= XEiJ.busExMemoryStart;
233: return (char) (XEiJ.busExMemoryArray[a] << 8 | (XEiJ.busExMemoryArray[a + 1] & 0xff));
234: }
235: @Override protected int mmdRls (int a) throws M68kException {
236: a -= XEiJ.busExMemoryStart;
237: return XEiJ.busExMemoryArray[a] << 24 | (XEiJ.busExMemoryArray[a + 1] & 0xff) << 16 | (char) (XEiJ.busExMemoryArray[a + 2] << 8 | (XEiJ.busExMemoryArray[a + 3] & 0xff));
238: }
239:
240: @Override protected void mmdWb (int a, int d) throws M68kException {
241: a -= XEiJ.busExMemoryStart;
242: XEiJ.busExMemoryArray[a ] = (byte) d;
243: }
244: @Override protected void mmdWw (int a, int d) throws M68kException {
245: a -= XEiJ.busExMemoryStart;
246: XEiJ.busExMemoryArray[a ] = (byte) (d >> 8);
247: XEiJ.busExMemoryArray[a + 1] = (byte) d;
248: }
249: @Override protected void mmdWl (int a, int d) throws M68kException {
250: a -= XEiJ.busExMemoryStart;
251: XEiJ.busExMemoryArray[a ] = (byte) (d >> 24);
252: XEiJ.busExMemoryArray[a + 1] = (byte) (d >> 16);
253: XEiJ.busExMemoryArray[a + 2] = (byte) (d >> 8);
254: XEiJ.busExMemoryArray[a + 3] = (byte) d;
255: }
256: },
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268: MMD_GE0 {
269: @Override public String toString () {
270: return Multilingual.mlnJapanese ? "グラフィックス画面 (512 ドット 16 色 ページ 0)" : "Graphics Screen (512 dots 16 colors page 0)";
271: }
272:
273: @Override protected byte mmdPbs (int a) {
274: a &= XEiJ.BUS_MOTHER_MASK;
275: return MainMemory.mmrM8[a];
276: }
277: @Override protected int mmdPbz (int a) {
278: a &= XEiJ.BUS_MOTHER_MASK;
279: return MainMemory.mmrM8[a];
280: }
281: @Override protected int mmdPws (int a) {
282: a &= XEiJ.BUS_MOTHER_MASK;
283: return MainMemory.mmrM8[a + 1];
284: }
285: @Override protected int mmdPwz (int a) {
286: a &= XEiJ.BUS_MOTHER_MASK;
287: return MainMemory.mmrM8[a + 1];
288: }
289: @Override protected int mmdPls (int a) {
290: a &= XEiJ.BUS_MOTHER_MASK;
291: return MainMemory.mmrM8[a + 1] << 16 | MainMemory.mmrM8[a + 3];
292: }
293:
294: @Override protected byte mmdRbs (int a) throws M68kException {
295: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
296: a &= XEiJ.BUS_MOTHER_MASK;
297: return MainMemory.mmrM8[a];
298: }
299: @Override protected int mmdRbz (int a) throws M68kException {
300: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
301: a &= XEiJ.BUS_MOTHER_MASK;
302: return MainMemory.mmrM8[a];
303: }
304: @Override protected int mmdRws (int a) throws M68kException {
305: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
306: a &= XEiJ.BUS_MOTHER_MASK;
307: return MainMemory.mmrM8[a + 1];
308: }
309: @Override protected int mmdRwz (int a) throws M68kException {
310: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
311: a &= XEiJ.BUS_MOTHER_MASK;
312: return MainMemory.mmrM8[a + 1];
313: }
314: @Override protected int mmdRls (int a) throws M68kException {
315: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
316: a &= XEiJ.BUS_MOTHER_MASK;
317: return MainMemory.mmrM8[a + 1] << 16 | MainMemory.mmrM8[a + 3];
318: }
319:
320: @Override protected void mmdWb (int a, int d) throws M68kException {
321: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
322: a &= XEiJ.BUS_MOTHER_MASK;
323: if (XEiJ.TEST_BIT_0_SHIFT ? a << 31 - 0 < 0 : (a & 1) != 0) {
324: MainMemory.mmrM8[a] = (byte) (d & 15);
325: int y = (a >> 10) - CRTC.crtR13GrYCurr[0] & 511;
326: CRTC.crtRasterStamp[y ] = 0;
327: CRTC.crtRasterStamp[y + 512] = 0;
328: }
329: }
330: @Override protected void mmdWw (int a, int d) throws M68kException {
331: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
332: a &= XEiJ.BUS_MOTHER_MASK;
333: MainMemory.mmrM8[a + 1] = (byte) (d & 15);
334: int y = (a >> 10) - CRTC.crtR13GrYCurr[0] & 511;
335: CRTC.crtRasterStamp[y ] = 0;
336: CRTC.crtRasterStamp[y + 512] = 0;
337: }
338: @Override protected void mmdWl (int a, int d) throws M68kException {
339: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
340: a &= XEiJ.BUS_MOTHER_MASK;
341: MainMemory.mmrM8[a + 1] = (byte) (d << 12 >>> 28);
342: MainMemory.mmrM8[a + 3] = (byte) (d & 15);
343: int y = (a >> 10) - CRTC.crtR13GrYCurr[0] & 511;
344: CRTC.crtRasterStamp[y ] = 0;
345: CRTC.crtRasterStamp[y + 512] = 0;
346: }
347: },
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359: MMD_GE1 {
360: @Override public String toString () {
361: return Multilingual.mlnJapanese ? "グラフィックス画面 (512 ドット 16 色 ページ 1)" : "Graphics Screen (512 dots 16 colors page 1)";
362: }
363:
364: @Override protected byte mmdPbs (int a) {
365: a &= XEiJ.BUS_MOTHER_MASK;
366: return MainMemory.mmrM8[a];
367: }
368: @Override protected int mmdPbz (int a) {
369: a &= XEiJ.BUS_MOTHER_MASK;
370: return MainMemory.mmrM8[a];
371: }
372: @Override protected int mmdPws (int a) {
373: a &= XEiJ.BUS_MOTHER_MASK;
374: return MainMemory.mmrM8[a + 1];
375: }
376: @Override protected int mmdPwz (int a) {
377: a &= XEiJ.BUS_MOTHER_MASK;
378: return MainMemory.mmrM8[a + 1];
379: }
380: @Override protected int mmdPls (int a) {
381: a &= XEiJ.BUS_MOTHER_MASK;
382: return MainMemory.mmrM8[a + 1] << 16 | MainMemory.mmrM8[a + 3];
383: }
384:
385: @Override protected byte mmdRbs (int a) throws M68kException {
386: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
387: a &= XEiJ.BUS_MOTHER_MASK;
388: return MainMemory.mmrM8[a];
389: }
390: @Override protected int mmdRbz (int a) throws M68kException {
391: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
392: a &= XEiJ.BUS_MOTHER_MASK;
393: return MainMemory.mmrM8[a];
394: }
395: @Override protected int mmdRws (int a) throws M68kException {
396: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
397: a &= XEiJ.BUS_MOTHER_MASK;
398: return MainMemory.mmrM8[a + 1];
399: }
400: @Override protected int mmdRwz (int a) throws M68kException {
401: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
402: a &= XEiJ.BUS_MOTHER_MASK;
403: return MainMemory.mmrM8[a + 1];
404: }
405: @Override protected int mmdRls (int a) throws M68kException {
406: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
407: a &= XEiJ.BUS_MOTHER_MASK;
408: return MainMemory.mmrM8[a + 1] << 16 | MainMemory.mmrM8[a + 3];
409: }
410:
411: @Override protected void mmdWb (int a, int d) throws M68kException {
412: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
413: a &= XEiJ.BUS_MOTHER_MASK;
414: if (XEiJ.TEST_BIT_0_SHIFT ? a << 31 - 0 < 0 : (a & 1) != 0) {
415: MainMemory.mmrM8[a] = (byte) (d & 15);
416: int y = (a >> 10) - CRTC.crtR13GrYCurr[1] & 511;
417: CRTC.crtRasterStamp[y ] = 0;
418: CRTC.crtRasterStamp[y + 512] = 0;
419: }
420: }
421: @Override protected void mmdWw (int a, int d) throws M68kException {
422: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
423: a &= XEiJ.BUS_MOTHER_MASK;
424: MainMemory.mmrM8[a + 1] = (byte) (d & 15);
425: int y = (a >> 10) - CRTC.crtR13GrYCurr[1] & 511;
426: CRTC.crtRasterStamp[y ] = 0;
427: CRTC.crtRasterStamp[y + 512] = 0;
428: }
429: @Override protected void mmdWl (int a, int d) throws M68kException {
430: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
431: a &= XEiJ.BUS_MOTHER_MASK;
432: MainMemory.mmrM8[a + 1] = (byte) (d << 12 >>> 28);
433: MainMemory.mmrM8[a + 3] = (byte) (d & 15);
434: int y = (a >> 10) - CRTC.crtR13GrYCurr[1] & 511;
435: CRTC.crtRasterStamp[y ] = 0;
436: CRTC.crtRasterStamp[y + 512] = 0;
437: }
438: },
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450: MMD_GE2 {
451: @Override public String toString () {
452: return Multilingual.mlnJapanese ? "グラフィックス画面 (512 ドット 16 色 ページ 2)" : "Graphics Screen (512 dots 16 colors page 2)";
453: }
454:
455: @Override protected byte mmdPbs (int a) {
456: a &= XEiJ.BUS_MOTHER_MASK;
457: return MainMemory.mmrM8[a];
458: }
459: @Override protected int mmdPbz (int a) {
460: a &= XEiJ.BUS_MOTHER_MASK;
461: return MainMemory.mmrM8[a];
462: }
463: @Override protected int mmdPws (int a) {
464: a &= XEiJ.BUS_MOTHER_MASK;
465: return MainMemory.mmrM8[a + 1];
466: }
467: @Override protected int mmdPwz (int a) {
468: a &= XEiJ.BUS_MOTHER_MASK;
469: return MainMemory.mmrM8[a + 1];
470: }
471: @Override protected int mmdPls (int a) {
472: a &= XEiJ.BUS_MOTHER_MASK;
473: return MainMemory.mmrM8[a + 1] << 16 | MainMemory.mmrM8[a + 3];
474: }
475:
476: @Override protected byte mmdRbs (int a) throws M68kException {
477: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
478: a &= XEiJ.BUS_MOTHER_MASK;
479: return MainMemory.mmrM8[a];
480: }
481: @Override protected int mmdRbz (int a) throws M68kException {
482: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
483: a &= XEiJ.BUS_MOTHER_MASK;
484: return MainMemory.mmrM8[a];
485: }
486: @Override protected int mmdRws (int a) throws M68kException {
487: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
488: a &= XEiJ.BUS_MOTHER_MASK;
489: return MainMemory.mmrM8[a + 1];
490: }
491: @Override protected int mmdRwz (int a) throws M68kException {
492: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
493: a &= XEiJ.BUS_MOTHER_MASK;
494: return MainMemory.mmrM8[a + 1];
495: }
496: @Override protected int mmdRls (int a) throws M68kException {
497: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
498: a &= XEiJ.BUS_MOTHER_MASK;
499: return MainMemory.mmrM8[a + 1] << 16 | MainMemory.mmrM8[a + 3];
500: }
501:
502: @Override protected void mmdWb (int a, int d) throws M68kException {
503: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
504: a &= XEiJ.BUS_MOTHER_MASK;
505: if (XEiJ.TEST_BIT_0_SHIFT ? a << 31 - 0 < 0 : (a & 1) != 0) {
506: MainMemory.mmrM8[a] = (byte) (d & 15);
507: int y = (a >> 10) - CRTC.crtR13GrYCurr[2] & 511;
508: CRTC.crtRasterStamp[y ] = 0;
509: CRTC.crtRasterStamp[y + 512] = 0;
510: }
511: }
512: @Override protected void mmdWw (int a, int d) throws M68kException {
513: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
514: a &= XEiJ.BUS_MOTHER_MASK;
515: MainMemory.mmrM8[a + 1] = (byte) (d & 15);
516: int y = (a >> 10) - CRTC.crtR13GrYCurr[2] & 511;
517: CRTC.crtRasterStamp[y ] = 0;
518: CRTC.crtRasterStamp[y + 512] = 0;
519: }
520: @Override protected void mmdWl (int a, int d) throws M68kException {
521: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
522: a &= XEiJ.BUS_MOTHER_MASK;
523: MainMemory.mmrM8[a + 1] = (byte) (d << 12 >>> 28);
524: MainMemory.mmrM8[a + 3] = (byte) (d & 15);
525: int y = (a >> 10) - CRTC.crtR13GrYCurr[2] & 511;
526: CRTC.crtRasterStamp[y ] = 0;
527: CRTC.crtRasterStamp[y + 512] = 0;
528: }
529: },
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541: MMD_GE3 {
542: @Override public String toString () {
543: return Multilingual.mlnJapanese ? "グラフィックス画面 (512 ドット 16 色 ページ 3)" : "Graphics Screen (512 dots 16 colors page 3)";
544: }
545:
546: @Override protected byte mmdPbs (int a) {
547: a &= XEiJ.BUS_MOTHER_MASK;
548: return MainMemory.mmrM8[a];
549: }
550: @Override protected int mmdPbz (int a) {
551: a &= XEiJ.BUS_MOTHER_MASK;
552: return MainMemory.mmrM8[a];
553: }
554: @Override protected int mmdPws (int a) {
555: a &= XEiJ.BUS_MOTHER_MASK;
556: return MainMemory.mmrM8[a + 1];
557: }
558: @Override protected int mmdPwz (int a) {
559: a &= XEiJ.BUS_MOTHER_MASK;
560: return MainMemory.mmrM8[a + 1];
561: }
562: @Override protected int mmdPls (int a) {
563: a &= XEiJ.BUS_MOTHER_MASK;
564: return MainMemory.mmrM8[a + 1] << 16 | MainMemory.mmrM8[a + 3];
565: }
566:
567: @Override protected byte mmdRbs (int a) throws M68kException {
568: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
569: a &= XEiJ.BUS_MOTHER_MASK;
570: return MainMemory.mmrM8[a];
571: }
572: @Override protected int mmdRbz (int a) throws M68kException {
573: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
574: a &= XEiJ.BUS_MOTHER_MASK;
575: return MainMemory.mmrM8[a];
576: }
577: @Override protected int mmdRws (int a) throws M68kException {
578: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
579: a &= XEiJ.BUS_MOTHER_MASK;
580: return MainMemory.mmrM8[a + 1];
581: }
582: @Override protected int mmdRwz (int a) throws M68kException {
583: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
584: a &= XEiJ.BUS_MOTHER_MASK;
585: return MainMemory.mmrM8[a + 1];
586: }
587: @Override protected int mmdRls (int a) throws M68kException {
588: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
589: a &= XEiJ.BUS_MOTHER_MASK;
590: return MainMemory.mmrM8[a + 1] << 16 | MainMemory.mmrM8[a + 3];
591: }
592:
593: @Override protected void mmdWb (int a, int d) throws M68kException {
594: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
595: a &= XEiJ.BUS_MOTHER_MASK;
596: if (XEiJ.TEST_BIT_0_SHIFT ? a << 31 - 0 < 0 : (a & 1) != 0) {
597: MainMemory.mmrM8[a] = (byte) (d & 15);
598: int y = (a >> 10) - CRTC.crtR13GrYCurr[3] & 511;
599: CRTC.crtRasterStamp[y ] = 0;
600: CRTC.crtRasterStamp[y + 512] = 0;
601: }
602: }
603: @Override protected void mmdWw (int a, int d) throws M68kException {
604: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
605: a &= XEiJ.BUS_MOTHER_MASK;
606: MainMemory.mmrM8[a + 1] = (byte) (d & 15);
607: int y = (a >> 10) - CRTC.crtR13GrYCurr[3] & 511;
608: CRTC.crtRasterStamp[y ] = 0;
609: CRTC.crtRasterStamp[y + 512] = 0;
610: }
611: @Override protected void mmdWl (int a, int d) throws M68kException {
612: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
613: a &= XEiJ.BUS_MOTHER_MASK;
614: MainMemory.mmrM8[a + 1] = (byte) (d << 12 >>> 28);
615: MainMemory.mmrM8[a + 3] = (byte) (d & 15);
616: int y = (a >> 10) - CRTC.crtR13GrYCurr[3] & 511;
617: CRTC.crtRasterStamp[y ] = 0;
618: CRTC.crtRasterStamp[y + 512] = 0;
619: }
620: },
621:
622:
623:
624:
625:
626:
627:
628:
629:
630:
631:
632: MMD_GF0 {
633: @Override public String toString () {
634: return Multilingual.mlnJapanese ? "グラフィックス画面 (512 ドット 256 色 ページ 0)" : "Graphics Screen (512 dots 256 colors page 0)";
635: }
636:
637: @Override protected byte mmdPbs (int a) {
638: a &= XEiJ.BUS_MOTHER_MASK;
639: return (byte) (MainMemory.mmrM8[a + 0x00080000] << 4 | MainMemory.mmrM8[a]);
640: }
641: @Override protected int mmdPbz (int a) {
642: a &= XEiJ.BUS_MOTHER_MASK;
643: return MainMemory.mmrM8[a + 0x00080000] << 4 | MainMemory.mmrM8[a];
644: }
645: @Override protected int mmdPws (int a) {
646: a &= XEiJ.BUS_MOTHER_MASK;
647: return MainMemory.mmrM8[a + 0x00080001] << 4 | MainMemory.mmrM8[a + 1];
648: }
649: @Override protected int mmdPwz (int a) {
650: a &= XEiJ.BUS_MOTHER_MASK;
651: return MainMemory.mmrM8[a + 0x00080001] << 4 | MainMemory.mmrM8[a + 1];
652: }
653: @Override protected int mmdPls (int a) {
654: a &= XEiJ.BUS_MOTHER_MASK;
655: return MainMemory.mmrM8[a + 0x00080001] << 20 | MainMemory.mmrM8[a + 1] << 16 | MainMemory.mmrM8[a + 0x00080003] << 4 | MainMemory.mmrM8[a + 3];
656: }
657:
658: @Override protected byte mmdRbs (int a) throws M68kException {
659: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
660: a &= XEiJ.BUS_MOTHER_MASK;
661: return (byte) (MainMemory.mmrM8[a + 0x00080000] << 4 | MainMemory.mmrM8[a]);
662: }
663: @Override protected int mmdRbz (int a) throws M68kException {
664: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
665: a &= XEiJ.BUS_MOTHER_MASK;
666: return MainMemory.mmrM8[a + 0x00080000] << 4 | MainMemory.mmrM8[a];
667: }
668: @Override protected int mmdRws (int a) throws M68kException {
669: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
670: a &= XEiJ.BUS_MOTHER_MASK;
671: return MainMemory.mmrM8[a + 0x00080001] << 4 | MainMemory.mmrM8[a + 1];
672: }
673: @Override protected int mmdRwz (int a) throws M68kException {
674: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
675: a &= XEiJ.BUS_MOTHER_MASK;
676: return MainMemory.mmrM8[a + 0x00080001] << 4 | MainMemory.mmrM8[a + 1];
677: }
678: @Override protected int mmdRls (int a) throws M68kException {
679: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
680: a &= XEiJ.BUS_MOTHER_MASK;
681: return MainMemory.mmrM8[a + 0x00080001] << 20 | MainMemory.mmrM8[a + 1] << 16 | MainMemory.mmrM8[a + 0x00080003] << 4 | MainMemory.mmrM8[a + 3];
682: }
683:
684: @Override protected void mmdWb (int a, int d) throws M68kException {
685: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
686: a &= XEiJ.BUS_MOTHER_MASK;
687: if (XEiJ.TEST_BIT_0_SHIFT ? a << 31 - 0 < 0 : (a & 1) != 0) {
688: MainMemory.mmrM8[a + 0x00080000] = (byte) (d << 24 >>> 28);
689: MainMemory.mmrM8[a ] = (byte) (d & 15);
690: a >>= 10;
691: int y = a - CRTC.crtR13GrYCurr[0] & 511;
692: CRTC.crtRasterStamp[y ] = 0;
693: CRTC.crtRasterStamp[y + 512] = 0;
694: y = a - CRTC.crtR13GrYCurr[1] & 511;
695: CRTC.crtRasterStamp[y ] = 0;
696: CRTC.crtRasterStamp[y + 512] = 0;
697: }
698: }
699: @Override protected void mmdWw (int a, int d) throws M68kException {
700: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
701: a &= XEiJ.BUS_MOTHER_MASK;
702: MainMemory.mmrM8[a + 0x00080001] = (byte) (d << 24 >>> 28);
703: MainMemory.mmrM8[a + 0x00000001] = (byte) (d & 15);
704: a >>= 10;
705: int y = a - CRTC.crtR13GrYCurr[0] & 511;
706: CRTC.crtRasterStamp[y ] = 0;
707: CRTC.crtRasterStamp[y + 512] = 0;
708: y = a - CRTC.crtR13GrYCurr[1] & 511;
709: CRTC.crtRasterStamp[y ] = 0;
710: CRTC.crtRasterStamp[y + 512] = 0;
711: }
712: @Override protected void mmdWl (int a, int d) throws M68kException {
713: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
714: a &= XEiJ.BUS_MOTHER_MASK;
715: MainMemory.mmrM8[a + 0x00080001] = (byte) (d << 8 >>> 28);
716: MainMemory.mmrM8[a + 0x00000001] = (byte) (d << 12 >>> 28);
717: MainMemory.mmrM8[a + 0x00080003] = (byte) (d << 24 >>> 28);
718: MainMemory.mmrM8[a + 0x00000003] = (byte) (d & 15);
719: a >>= 10;
720: int y = a - CRTC.crtR13GrYCurr[0] & 511;
721: CRTC.crtRasterStamp[y ] = 0;
722: CRTC.crtRasterStamp[y + 512] = 0;
723: y = a - CRTC.crtR13GrYCurr[1] & 511;
724: CRTC.crtRasterStamp[y ] = 0;
725: CRTC.crtRasterStamp[y + 512] = 0;
726: }
727: },
728:
729:
730:
731:
732:
733:
734:
735:
736:
737:
738:
739: MMD_GF1 {
740: @Override public String toString () {
741: return Multilingual.mlnJapanese ? "グラフィックス画面 (512 ドット 256 色 ページ 1)" : "Graphics Screen (512 dots 256 colors page 1)";
742: }
743:
744: @Override protected byte mmdPbs (int a) {
745: a &= XEiJ.BUS_MOTHER_MASK;
746: return (byte) (MainMemory.mmrM8[a + 0x00100000] << 4 | MainMemory.mmrM8[a + 0x00080000]);
747: }
748: @Override protected int mmdPbz (int a) {
749: a &= XEiJ.BUS_MOTHER_MASK;
750: return MainMemory.mmrM8[a + 0x00100000] << 4 | MainMemory.mmrM8[a + 0x00080000];
751: }
752: @Override protected int mmdPws (int a) {
753: a &= XEiJ.BUS_MOTHER_MASK;
754: return MainMemory.mmrM8[a + 0x00100001] << 4 | MainMemory.mmrM8[a + 0x00080001];
755: }
756: @Override protected int mmdPwz (int a) {
757: a &= XEiJ.BUS_MOTHER_MASK;
758: return MainMemory.mmrM8[a + 0x00100001] << 4 | MainMemory.mmrM8[a + 0x00080001];
759: }
760: @Override protected int mmdPls (int a) {
761: a &= XEiJ.BUS_MOTHER_MASK;
762: return MainMemory.mmrM8[a + 0x00100001] << 20 | MainMemory.mmrM8[a + 0x00080001] << 16 | MainMemory.mmrM8[a + 0x00100003] << 4 | MainMemory.mmrM8[a + 0x00080003];
763: }
764:
765: @Override protected byte mmdRbs (int a) throws M68kException {
766: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
767: a &= XEiJ.BUS_MOTHER_MASK;
768: return (byte) (MainMemory.mmrM8[a + 0x00100000] << 4 | MainMemory.mmrM8[a + 0x00080000]);
769: }
770: @Override protected int mmdRbz (int a) throws M68kException {
771: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
772: a &= XEiJ.BUS_MOTHER_MASK;
773: return MainMemory.mmrM8[a + 0x00100000] << 4 | MainMemory.mmrM8[a + 0x00080000];
774: }
775: @Override protected int mmdRws (int a) throws M68kException {
776: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
777: a &= XEiJ.BUS_MOTHER_MASK;
778: return MainMemory.mmrM8[a + 0x00100001] << 4 | MainMemory.mmrM8[a + 0x00080001];
779: }
780: @Override protected int mmdRwz (int a) throws M68kException {
781: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
782: a &= XEiJ.BUS_MOTHER_MASK;
783: return MainMemory.mmrM8[a + 0x00100001] << 4 | MainMemory.mmrM8[a + 0x00080001];
784: }
785: @Override protected int mmdRls (int a) throws M68kException {
786: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
787: a &= XEiJ.BUS_MOTHER_MASK;
788: return MainMemory.mmrM8[a + 0x00100001] << 20 | MainMemory.mmrM8[a + 0x00080001] << 16 | MainMemory.mmrM8[a + 0x00100003] << 4 | MainMemory.mmrM8[a + 0x00080003];
789: }
790:
791: @Override protected void mmdWb (int a, int d) throws M68kException {
792: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
793: a &= XEiJ.BUS_MOTHER_MASK;
794: if (XEiJ.TEST_BIT_0_SHIFT ? a << 31 - 0 < 0 : (a & 1) != 0) {
795: MainMemory.mmrM8[a + 0x00100000] = (byte) (d << 24 >>> 28);
796: MainMemory.mmrM8[a + 0x00080000] = (byte) (d & 15);
797: a >>= 10;
798: int y = a - CRTC.crtR13GrYCurr[2] & 511;
799: CRTC.crtRasterStamp[y ] = 0;
800: CRTC.crtRasterStamp[y + 512] = 0;
801: y = a - CRTC.crtR13GrYCurr[3] & 511;
802: CRTC.crtRasterStamp[y ] = 0;
803: CRTC.crtRasterStamp[y + 512] = 0;
804: }
805: }
806: @Override protected void mmdWw (int a, int d) throws M68kException {
807: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
808: a &= XEiJ.BUS_MOTHER_MASK;
809: MainMemory.mmrM8[a + 0x00100001] = (byte) (d << 24 >>> 28);
810: MainMemory.mmrM8[a + 0x00080001] = (byte) (d & 15);
811: a >>= 10;
812: int y = a - CRTC.crtR13GrYCurr[2] & 511;
813: CRTC.crtRasterStamp[y ] = 0;
814: CRTC.crtRasterStamp[y + 512] = 0;
815: y = a - CRTC.crtR13GrYCurr[3] & 511;
816: CRTC.crtRasterStamp[y ] = 0;
817: CRTC.crtRasterStamp[y + 512] = 0;
818: }
819: @Override protected void mmdWl (int a, int d) throws M68kException {
820: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
821: a &= XEiJ.BUS_MOTHER_MASK;
822: MainMemory.mmrM8[a + 0x00100001] = (byte) (d << 8 >>> 28);
823: MainMemory.mmrM8[a + 0x00080001] = (byte) (d << 12 >>> 28);
824: MainMemory.mmrM8[a + 0x00100003] = (byte) (d << 24 >>> 28);
825: MainMemory.mmrM8[a + 0x00080003] = (byte) (d & 15);
826: a >>= 10;
827: int y = a - CRTC.crtR13GrYCurr[2] & 511;
828: CRTC.crtRasterStamp[y ] = 0;
829: CRTC.crtRasterStamp[y + 512] = 0;
830: y = a - CRTC.crtR13GrYCurr[3] & 511;
831: CRTC.crtRasterStamp[y ] = 0;
832: CRTC.crtRasterStamp[y + 512] = 0;
833: }
834: },
835:
836:
837:
838:
839:
840:
841:
842:
843:
844:
845:
846:
847:
848:
849:
850:
851:
852:
853:
854:
855:
856:
857:
858:
859:
860:
861:
862:
863:
864:
865:
866:
867:
868:
869:
870:
871: MMD_GM2 {
872: @Override public String toString () {
873: return Multilingual.mlnJapanese ? "グラフィックス画面 (メモリモード 2)" : "Graphics Screen (memory mode 2)";
874: }
875:
876: @Override protected byte mmdPbs (int a) {
877: if ((a & 0x00080001) == 0x00000001) {
878: a &= 0x00c7fffe;
879: return (byte) (MainMemory.mmrM8[0x00080001 + a] << 4 |
880: MainMemory.mmrM8[0x00000001 + a]);
881: } else {
882: return 0x00;
883: }
884: }
885: @Override protected int mmdPbz (int a) {
886: if ((a & 0x00080001) == 0x00000001) {
887: a &= 0x00c7fffe;
888: return (byte) (MainMemory.mmrM8[0x00080001 + a] << 4 |
889: MainMemory.mmrM8[0x00000001 + a]);
890: } else {
891: return 0x00;
892: }
893: }
894: @Override protected int mmdPws (int a) {
895: if ((a & 0x00080000) == 0x00000000) {
896: a &= 0x00c7fffe;
897: return (MainMemory.mmrM8[0x00080001 + a] << 4 |
898: MainMemory.mmrM8[0x00000001 + a]);
899: } else {
900: a &= 0x00c7fffe;
901: return (MainMemory.mmrM8[0x00180001 + a] << 4 |
902: MainMemory.mmrM8[0x00100001 + a]);
903: }
904: }
905: @Override protected int mmdPwz (int a) {
906: if ((a & 0x00080000) == 0x00000000) {
907: a &= 0x00c7fffe;
908: return (MainMemory.mmrM8[0x00080001 + a] << 4 |
909: MainMemory.mmrM8[0x00000001 + a]);
910: } else {
911: a &= 0x00c7fffe;
912: return (MainMemory.mmrM8[0x00180001 + a] << 4 |
913: MainMemory.mmrM8[0x00100001 + a]);
914: }
915: }
916: @Override protected int mmdPls (int a) {
917: a &= 0x00d7fffe;
918: return (MainMemory.mmrM8[0x00080001 + a] << 20 |
919: MainMemory.mmrM8[0x00000001 + a] << 16 |
920: MainMemory.mmrM8[0x00080003 + a] << 4 |
921: MainMemory.mmrM8[0x00000003 + a]);
922: }
923:
924: @Override protected byte mmdRbs (int a) throws M68kException {
925: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
926: if ((a & 0x00080001) == 0x00000001) {
927: a &= 0x00c7fffe;
928: return (byte) (MainMemory.mmrM8[0x00080001 + a] << 4 |
929: MainMemory.mmrM8[0x00000001 + a]);
930: } else {
931: return 0x00;
932: }
933: }
934: @Override protected int mmdRbz (int a) throws M68kException {
935: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
936: if ((a & 0x00080001) == 0x00000001) {
937: a &= 0x00c7fffe;
938: return (byte) (MainMemory.mmrM8[0x00080001 + a] << 4 |
939: MainMemory.mmrM8[0x00000001 + a]);
940: } else {
941: return 0x00;
942: }
943: }
944: @Override protected int mmdRws (int a) throws M68kException {
945: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
946: if ((a & 0x00080000) == 0x00000000) {
947: a &= 0x00c7fffe;
948: return (MainMemory.mmrM8[0x00080001 + a] << 4 |
949: MainMemory.mmrM8[0x00000001 + a]);
950: } else {
951: a &= 0x00c7fffe;
952: return (MainMemory.mmrM8[0x00180001 + a] << 4 |
953: MainMemory.mmrM8[0x00100001 + a]);
954: }
955: }
956: @Override protected int mmdRwz (int a) throws M68kException {
957: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
958: if ((a & 0x00080000) == 0x00000000) {
959: a &= 0x00c7fffe;
960: return (MainMemory.mmrM8[0x00080001 + a] << 4 |
961: MainMemory.mmrM8[0x00000001 + a]);
962: } else {
963: a &= 0x00c7fffe;
964: return (MainMemory.mmrM8[0x00180001 + a] << 4 |
965: MainMemory.mmrM8[0x00100001 + a]);
966: }
967: }
968: @Override protected int mmdRls (int a) throws M68kException {
969: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
970: a &= 0x00d7fffe;
971: return (MainMemory.mmrM8[0x00080001 + a] << 20 |
972: MainMemory.mmrM8[0x00000001 + a] << 16 |
973: MainMemory.mmrM8[0x00080003 + a] << 4 |
974: MainMemory.mmrM8[0x00000003 + a]);
975: }
976:
977: @Override protected void mmdWb (int a, int d) throws M68kException {
978: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
979: if ((a & 0x00000001) == 0x00000000) {
980: a &= 0x00c7fffe;
981: if (XEiJ.currentMPU < Model.MPU_MC68LC040) {
982: MainMemory.mmrM8[0x00180001 + a] = (byte) (d >>> 4 & 15);
983: MainMemory.mmrM8[0x00100001 + a] = (byte) (d & 15);
984: } else {
985: MainMemory.mmrM8[0x00180001 + a] = 0;
986: MainMemory.mmrM8[0x00100001 + a] = 0;
987: }
988: a >>>= 10;
989: int y = a - CRTC.crtR13GrYCurr[3] & 511;
990: CRTC.crtRasterStamp[y ] = 0;
991: CRTC.crtRasterStamp[y + 512] = 0;
992: y = a - CRTC.crtR13GrYCurr[2] & 511;
993: CRTC.crtRasterStamp[y ] = 0;
994: CRTC.crtRasterStamp[y + 512] = 0;
995: } else {
996: a &= 0x00c7fffe;
997: MainMemory.mmrM8[0x00080001 + a] = (byte) (d >>> 4 & 15);
998: MainMemory.mmrM8[0x00000001 + a] = (byte) (d & 15);
999: a >>>= 10;
1000: int y = a - CRTC.crtR13GrYCurr[1] & 511;
1001: CRTC.crtRasterStamp[y ] = 0;
1002: CRTC.crtRasterStamp[y + 512] = 0;
1003: y = a - CRTC.crtR13GrYCurr[0] & 511;
1004: CRTC.crtRasterStamp[y ] = 0;
1005: CRTC.crtRasterStamp[y + 512] = 0;
1006: }
1007: }
1008: @Override protected void mmdWw (int a, int d) throws M68kException {
1009: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1010: a &= 0x00c7fffe;
1011: MainMemory.mmrM8[0x00180001 + a] = MainMemory.mmrM8[0x00080001 + a] = (byte) (d >>> 4 & 15);
1012: MainMemory.mmrM8[0x00100001 + a] = MainMemory.mmrM8[0x00000001 + a] = (byte) (d & 15);
1013: a >>>= 10;
1014: int y = a - CRTC.crtR13GrYCurr[3] & 511;
1015: CRTC.crtRasterStamp[y ] = 0;
1016: CRTC.crtRasterStamp[y + 512] = 0;
1017: y = a - CRTC.crtR13GrYCurr[2] & 511;
1018: CRTC.crtRasterStamp[y ] = 0;
1019: CRTC.crtRasterStamp[y + 512] = 0;
1020: y = a - CRTC.crtR13GrYCurr[1] & 511;
1021: CRTC.crtRasterStamp[y ] = 0;
1022: CRTC.crtRasterStamp[y + 512] = 0;
1023: y = a - CRTC.crtR13GrYCurr[0] & 511;
1024: CRTC.crtRasterStamp[y ] = 0;
1025: CRTC.crtRasterStamp[y + 512] = 0;
1026: }
1027: @Override protected void mmdWl (int a, int d) throws M68kException {
1028: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
1029: a &= 0x00c7fffe;
1030: MainMemory.mmrM8[0x00180001 + a] = MainMemory.mmrM8[0x00080001 + a] = (byte) (d >>> 20 & 15);
1031: MainMemory.mmrM8[0x00100001 + a] = MainMemory.mmrM8[0x00000001 + a] = (byte) (d >>> 16 & 15);
1032: MainMemory.mmrM8[0x00180003 + a] = MainMemory.mmrM8[0x00080003 + a] = (byte) (d >>> 4 & 15);
1033: MainMemory.mmrM8[0x00100003 + a] = MainMemory.mmrM8[0x00000003 + a] = (byte) (d & 15);
1034: a >>>= 10;
1035: int y = a - CRTC.crtR13GrYCurr[3] & 511;
1036: CRTC.crtRasterStamp[y ] = 0;
1037: CRTC.crtRasterStamp[y + 512] = 0;
1038: y = a - CRTC.crtR13GrYCurr[2] & 511;
1039: CRTC.crtRasterStamp[y ] = 0;
1040: CRTC.crtRasterStamp[y + 512] = 0;
1041: y = a - CRTC.crtR13GrYCurr[1] & 511;
1042: CRTC.crtRasterStamp[y ] = 0;
1043: CRTC.crtRasterStamp[y + 512] = 0;
1044: y = a - CRTC.crtR13GrYCurr[0] & 511;
1045: CRTC.crtRasterStamp[y ] = 0;
1046: CRTC.crtRasterStamp[y + 512] = 0;
1047: }
1048: },
1049:
1050:
1051:
1052:
1053:
1054:
1055:
1056:
1057:
1058:
1059:
1060: MMD_GG0 {
1061: @Override public String toString () {
1062: return Multilingual.mlnJapanese ? "グラフィックス画面 (512 ドット 65536 色)" : "Graphics Screen (512 dots 65536 colors)";
1063: }
1064:
1065: @Override protected byte mmdPbs (int a) {
1066: a &= XEiJ.BUS_MOTHER_MASK;
1067: a += -(~a & 1) & 0x00100001;
1068: return (byte) (MainMemory.mmrM8[a + 0x00080000] << 4 | MainMemory.mmrM8[a]);
1069: }
1070: @Override protected int mmdPbz (int a) {
1071: a &= XEiJ.BUS_MOTHER_MASK;
1072: a += -(~a & 1) & 0x00100001;
1073: return MainMemory.mmrM8[a + 0x00080000] << 4 | MainMemory.mmrM8[a];
1074: }
1075: @Override protected int mmdPws (int a) {
1076: a &= XEiJ.BUS_MOTHER_MASK;
1077: return (short) (MainMemory.mmrM8[a + 0x00180001] << 12 | MainMemory.mmrM8[a + 0x00100001] << 8 | MainMemory.mmrM8[a + 0x00080001] << 4 | MainMemory.mmrM8[a + 1]);
1078: }
1079: @Override protected int mmdPwz (int a) {
1080: a &= XEiJ.BUS_MOTHER_MASK;
1081: return MainMemory.mmrM8[a + 0x00180001] << 12 | MainMemory.mmrM8[a + 0x00100001] << 8 | MainMemory.mmrM8[a + 0x00080001] << 4 | MainMemory.mmrM8[a + 1];
1082: }
1083: @Override protected int mmdPls (int a) {
1084: a &= XEiJ.BUS_MOTHER_MASK;
1085: return (MainMemory.mmrM8[a + 0x00180001] << 28 | MainMemory.mmrM8[a + 0x00100001] << 24 | MainMemory.mmrM8[a + 0x00080001] << 20 | MainMemory.mmrM8[a + 1] << 16 |
1086: MainMemory.mmrM8[a + 0x00180003] << 12 | MainMemory.mmrM8[a + 0x00100003] << 8 | MainMemory.mmrM8[a + 0x00080003] << 4 | MainMemory.mmrM8[a + 3]);
1087: }
1088:
1089: @Override protected byte mmdRbs (int a) throws M68kException {
1090: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1091: a &= XEiJ.BUS_MOTHER_MASK;
1092: a += -(~a & 1) & 0x00100001;
1093: return (byte) (MainMemory.mmrM8[a + 0x00080000] << 4 | MainMemory.mmrM8[a]);
1094: }
1095: @Override protected int mmdRbz (int a) throws M68kException {
1096: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1097: a &= XEiJ.BUS_MOTHER_MASK;
1098: a += -(~a & 1) & 0x00100001;
1099: return MainMemory.mmrM8[a + 0x00080000] << 4 | MainMemory.mmrM8[a];
1100: }
1101: @Override protected int mmdRws (int a) throws M68kException {
1102: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1103: a &= XEiJ.BUS_MOTHER_MASK;
1104: return (short) (MainMemory.mmrM8[a + 0x00180001] << 12 | MainMemory.mmrM8[a + 0x00100001] << 8 | MainMemory.mmrM8[a + 0x00080001] << 4 | MainMemory.mmrM8[a + 1]);
1105: }
1106: @Override protected int mmdRwz (int a) throws M68kException {
1107: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1108: a &= XEiJ.BUS_MOTHER_MASK;
1109: return MainMemory.mmrM8[a + 0x00180001] << 12 | MainMemory.mmrM8[a + 0x00100001] << 8 | MainMemory.mmrM8[a + 0x00080001] << 4 | MainMemory.mmrM8[a + 1];
1110: }
1111: @Override protected int mmdRls (int a) throws M68kException {
1112: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
1113: a &= XEiJ.BUS_MOTHER_MASK;
1114: return (MainMemory.mmrM8[a + 0x00180001] << 28 | MainMemory.mmrM8[a + 0x00100001] << 24 | MainMemory.mmrM8[a + 0x00080001] << 20 | MainMemory.mmrM8[a + 1] << 16 |
1115: MainMemory.mmrM8[a + 0x00180003] << 12 | MainMemory.mmrM8[a + 0x00100003] << 8 | MainMemory.mmrM8[a + 0x00080003] << 4 | MainMemory.mmrM8[a + 3]);
1116: }
1117:
1118: @Override protected void mmdWb (int a, int d) throws M68kException {
1119: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1120: a &= XEiJ.BUS_MOTHER_MASK;
1121: if (XEiJ.TEST_BIT_0_SHIFT ? a << 31 - 0 >= 0 : (a & 1) == 0) {
1122: MainMemory.mmrM8[a + 0x00180001] = (byte) (d << 24 >>> 28);
1123: MainMemory.mmrM8[a + 0x00100001] = (byte) (d & 15);
1124: a >>= 10;
1125: int y = a - CRTC.crtR13GrYCurr[2] & 511;
1126: CRTC.crtRasterStamp[y ] = 0;
1127: CRTC.crtRasterStamp[y + 512] = 0;
1128: y = a - CRTC.crtR13GrYCurr[3] & 511;
1129: CRTC.crtRasterStamp[y ] = 0;
1130: CRTC.crtRasterStamp[y + 512] = 0;
1131: } else {
1132: MainMemory.mmrM8[a + 0x00080000] = (byte) (d << 24 >>> 28);
1133: MainMemory.mmrM8[a ] = (byte) (d & 15);
1134: a >>= 10;
1135: int y = a - CRTC.crtR13GrYCurr[0] & 511;
1136: CRTC.crtRasterStamp[y ] = 0;
1137: CRTC.crtRasterStamp[y + 512] = 0;
1138: y = a - CRTC.crtR13GrYCurr[1] & 511;
1139: CRTC.crtRasterStamp[y ] = 0;
1140: CRTC.crtRasterStamp[y + 512] = 0;
1141: }
1142: }
1143: @Override protected void mmdWw (int a, int d) throws M68kException {
1144: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1145: a &= XEiJ.BUS_MOTHER_MASK;
1146: MainMemory.mmrM8[a + 0x00180001] = (byte) ((char) d >>> 12);
1147: MainMemory.mmrM8[a + 0x00100001] = (byte) (d << 20 >>> 28);
1148: MainMemory.mmrM8[a + 0x00080001] = (byte) (d << 24 >>> 28);
1149: MainMemory.mmrM8[a + 0x00000001] = (byte) (d & 15);
1150: a >>= 10;
1151: int y = a - CRTC.crtR13GrYCurr[0] & 511;
1152: CRTC.crtRasterStamp[y ] = 0;
1153: CRTC.crtRasterStamp[y + 512] = 0;
1154: y = a - CRTC.crtR13GrYCurr[1] & 511;
1155: CRTC.crtRasterStamp[y ] = 0;
1156: CRTC.crtRasterStamp[y + 512] = 0;
1157: y = a - CRTC.crtR13GrYCurr[2] & 511;
1158: CRTC.crtRasterStamp[y ] = 0;
1159: CRTC.crtRasterStamp[y + 512] = 0;
1160: y = a - CRTC.crtR13GrYCurr[3] & 511;
1161: CRTC.crtRasterStamp[y ] = 0;
1162: CRTC.crtRasterStamp[y + 512] = 0;
1163: }
1164: @Override protected void mmdWl (int a, int d) throws M68kException {
1165: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
1166: a &= XEiJ.BUS_MOTHER_MASK;
1167: MainMemory.mmrM8[a + 0x00180001] = (byte) (d >>> 28);
1168: MainMemory.mmrM8[a + 0x00100001] = (byte) (d << 4 >>> 28);
1169: MainMemory.mmrM8[a + 0x00080001] = (byte) (d << 8 >>> 28);
1170: MainMemory.mmrM8[a + 0x00000001] = (byte) (d << 12 >>> 28);
1171: MainMemory.mmrM8[a + 0x00180003] = (byte) ((char) d >>> 12);
1172: MainMemory.mmrM8[a + 0x00100003] = (byte) (d << 20 >>> 28);
1173: MainMemory.mmrM8[a + 0x00080003] = (byte) (d << 24 >>> 28);
1174: MainMemory.mmrM8[a + 0x00000003] = (byte) (d & 15);
1175: a >>= 10;
1176: int y = a - CRTC.crtR13GrYCurr[0] & 511;
1177: CRTC.crtRasterStamp[y ] = 0;
1178: CRTC.crtRasterStamp[y + 512] = 0;
1179: y = a - CRTC.crtR13GrYCurr[1] & 511;
1180: CRTC.crtRasterStamp[y ] = 0;
1181: CRTC.crtRasterStamp[y + 512] = 0;
1182: y = a - CRTC.crtR13GrYCurr[2] & 511;
1183: CRTC.crtRasterStamp[y ] = 0;
1184: CRTC.crtRasterStamp[y + 512] = 0;
1185: y = a - CRTC.crtR13GrYCurr[3] & 511;
1186: CRTC.crtRasterStamp[y ] = 0;
1187: CRTC.crtRasterStamp[y + 512] = 0;
1188: }
1189: },
1190:
1191:
1192:
1193:
1194:
1195:
1196:
1197:
1198:
1199:
1200:
1201:
1202:
1203:
1204:
1205:
1206:
1207:
1208:
1209:
1210:
1211:
1212:
1213:
1214:
1215:
1216:
1217:
1218:
1219:
1220:
1221:
1222:
1223:
1224:
1225:
1226:
1227:
1228:
1229:
1230:
1231:
1232:
1233:
1234:
1235:
1236:
1237: MMD_GH0 {
1238: @Override public String toString () {
1239: return Multilingual.mlnJapanese ? "グラフィックス画面 (1024 ドット 16 色)" : "Graphics Screen (1024 dots 16 colors)";
1240: }
1241:
1242: @Override protected byte mmdPbs (int a) {
1243: int b0 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1244: return MainMemory.mmrM8[b0];
1245: }
1246: @Override protected int mmdPbz (int a) {
1247: int b0 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1248: return MainMemory.mmrM8[b0];
1249: }
1250: @Override protected int mmdPws (int a) {
1251: int b0 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1252: return MainMemory.mmrM8[b0 + 1];
1253: }
1254: @Override protected int mmdPwz (int a) {
1255: int b0 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1256: return MainMemory.mmrM8[b0 + 1];
1257: }
1258: @Override protected int mmdPls (int a) {
1259:
1260: int b0 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1261: a += 2;
1262: int b2 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1263: return MainMemory.mmrM8[b0 + 1] << 16 | MainMemory.mmrM8[b2 + 1];
1264: }
1265:
1266: @Override protected byte mmdRbs (int a) throws M68kException {
1267: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1268: int b0 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1269: return MainMemory.mmrM8[b0];
1270: }
1271: @Override protected int mmdRbz (int a) throws M68kException {
1272: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1273: int b0 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1274: return MainMemory.mmrM8[b0];
1275: }
1276: @Override protected int mmdRws (int a) throws M68kException {
1277: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1278: int b0 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1279: return MainMemory.mmrM8[b0 + 1];
1280: }
1281: @Override protected int mmdRwz (int a) throws M68kException {
1282: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1283: int b0 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1284: return MainMemory.mmrM8[b0 + 1];
1285: }
1286: @Override protected int mmdRls (int a) throws M68kException {
1287: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
1288:
1289: int b0 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1290: a += 2;
1291: int b2 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1292: return MainMemory.mmrM8[b0 + 1] << 16 | MainMemory.mmrM8[b2 + 1];
1293: }
1294:
1295: @Override protected void mmdWb (int a, int d) throws M68kException {
1296: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1297: if ((a & 1) != 0) {
1298: CRTC.crtRasterStamp[(a >> 11) - CRTC.crtR13GrYCurr[0] & 1023] = 0;
1299: int b0 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1300: MainMemory.mmrM8[b0] = (byte) (d & 15);
1301: }
1302: }
1303: @Override protected void mmdWw (int a, int d) throws M68kException {
1304: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1305: CRTC.crtRasterStamp[(a >> 11) - CRTC.crtR13GrYCurr[0] & 1023] = 0;
1306: int b0 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1307: MainMemory.mmrM8[b0 + 1] = (byte) (d & 15);
1308: }
1309: @Override protected void mmdWl (int a, int d) throws M68kException {
1310: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
1311: CRTC.crtRasterStamp[(a >> 11) - CRTC.crtR13GrYCurr[0] & 1023] = 0;
1312:
1313: int b0 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1314: a += 2;
1315: int b2 = (a & 0x00c00000 + (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1316: MainMemory.mmrM8[b0 + 1] = (byte) (d >>> 16 & 15);
1317: MainMemory.mmrM8[b2 + 1] = (byte) (d & 15);
1318: }
1319: },
1320:
1321:
1322:
1323:
1324:
1325:
1326: MMD_GI0 {
1327: @Override public String toString () {
1328: return Multilingual.mlnJapanese ? "グラフィックス画面 (1024 ドット 256 色)" : "Graphics Screen (1024 dots 256 colors)";
1329: }
1330:
1331: @Override protected byte mmdPbs (int a) {
1332: int b0 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1333: return MainMemory.mmrM8[b0];
1334: }
1335: @Override protected int mmdPbz (int a) {
1336: int b0 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1337: return MainMemory.mmrM8[b0] & 0xff;
1338: }
1339: @Override protected int mmdPws (int a) {
1340: int b0 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1341: return MainMemory.mmrM8[b0 + 1] & 0xff;
1342: }
1343: @Override protected int mmdPwz (int a) {
1344: int b0 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1345: return MainMemory.mmrM8[b0 + 1] & 0xff;
1346: }
1347: @Override protected int mmdPls (int a) {
1348:
1349: int b0 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1350: a += 2;
1351: int b2 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1352: return (MainMemory.mmrM8[b0 + 1] & 0xff) << 16 | MainMemory.mmrM8[b2 + 1] & 0xff;
1353: }
1354:
1355: @Override protected byte mmdRbs (int a) throws M68kException {
1356: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1357: int b0 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1358: return MainMemory.mmrM8[b0];
1359: }
1360: @Override protected int mmdRbz (int a) throws M68kException {
1361: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1362: int b0 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1363: return MainMemory.mmrM8[b0] & 0xff;
1364: }
1365: @Override protected int mmdRws (int a) throws M68kException {
1366: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1367: int b0 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1368: return MainMemory.mmrM8[b0 + 1] & 0xff;
1369: }
1370: @Override protected int mmdRwz (int a) throws M68kException {
1371: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1372: int b0 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1373: return MainMemory.mmrM8[b0 + 1] & 0xff;
1374: }
1375: @Override protected int mmdRls (int a) throws M68kException {
1376: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
1377:
1378: int b0 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1379: a += 2;
1380: int b2 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1381: return (MainMemory.mmrM8[b0 + 1] & 0xff) << 16 | MainMemory.mmrM8[b2 + 1] & 0xff;
1382: }
1383:
1384: @Override protected void mmdWb (int a, int d) throws M68kException {
1385: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1386: if ((a & 1) != 0) {
1387: CRTC.crtRasterStamp[(a >> 11) - CRTC.crtR13GrYCurr[0] & 1023] = 0;
1388: int b0 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1389: MainMemory.mmrM8[b0] = (byte) d;
1390: }
1391: }
1392: @Override protected void mmdWw (int a, int d) throws M68kException {
1393: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1394: CRTC.crtRasterStamp[(a >> 11) - CRTC.crtR13GrYCurr[0] & 1023] = 0;
1395: int b0 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1396: MainMemory.mmrM8[b0 + 1] = (byte) d;
1397: }
1398: @Override protected void mmdWl (int a, int d) throws M68kException {
1399: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
1400: CRTC.crtRasterStamp[(a >> 11) - CRTC.crtR13GrYCurr[0] & 1023] = 0;
1401:
1402: int b0 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1403: a += 2;
1404: int b2 = XEiJ.BUS_MODIFIED_256_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1405: MainMemory.mmrM8[b0 + 1] = (byte) (d >>> 16);
1406: MainMemory.mmrM8[b2 + 1] = (byte) d;
1407: }
1408: },
1409:
1410:
1411:
1412:
1413:
1414:
1415: MMD_GJ0 {
1416: @Override public String toString () {
1417: return Multilingual.mlnJapanese ? "グラフィックス画面 (1024 ドット 65536 色)" : "Graphics Screen (1024 dots 65536 colors)";
1418: }
1419:
1420: @Override protected byte mmdPbs (int a) {
1421: int b0 = XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1422: return MainMemory.mmrM8[b0];
1423: }
1424: @Override protected int mmdPbz (int a) {
1425: int b0 = XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1426: return MainMemory.mmrM8[b0] & 0xff;
1427: }
1428: @Override protected int mmdPws (int a) {
1429: int b0 = XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1430: return MainMemory.mmrM8[b0] << 8 | (MainMemory.mmrM8[b0 + 1] & 0xff);
1431: }
1432: @Override protected int mmdPwz (int a) {
1433: int b0 = XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1434: return (char) (MainMemory.mmrM8[b0] << 8 | (MainMemory.mmrM8[b0 + 1] & 0xff));
1435: }
1436: @Override protected int mmdPls (int a) {
1437:
1438: int b0 = XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1439: a += 2;
1440: int b2 = XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1441: return (MainMemory.mmrM8[b0] << 24 | (MainMemory.mmrM8[b0 + 1] & 0xff) << 16 |
1442: (char) (MainMemory.mmrM8[b2] << 8 | (MainMemory.mmrM8[b2 + 1] & 0xff)));
1443: }
1444:
1445: @Override protected byte mmdRbs (int a) throws M68kException {
1446: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1447: return MainMemory.mmrM8[XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10)];
1448: }
1449: @Override protected int mmdRbz (int a) throws M68kException {
1450: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1451: return MainMemory.mmrM8[XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10)] & 0xff;
1452: }
1453: @Override protected int mmdRws (int a) throws M68kException {
1454: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1455: int b0 = XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1456: return MainMemory.mmrM8[b0] << 8 | (MainMemory.mmrM8[b0 + 1] & 0xff);
1457: }
1458: @Override protected int mmdRwz (int a) throws M68kException {
1459: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1460: int b0 = XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1461: return (char) (MainMemory.mmrM8[b0] << 8 | (MainMemory.mmrM8[b0 + 1] & 0xff));
1462: }
1463: @Override protected int mmdRls (int a) throws M68kException {
1464: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
1465:
1466: int b0 = XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1467: a += 2;
1468: int b2 = XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1469: return (MainMemory.mmrM8[b0] << 24 | (MainMemory.mmrM8[b0 + 1] & 0xff) << 16 |
1470: (char) (MainMemory.mmrM8[b2] << 8 | (MainMemory.mmrM8[b2 + 1] & 0xff)));
1471: }
1472:
1473: @Override protected void mmdWb (int a, int d) throws M68kException {
1474: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1475: if ((a & 1) != 0) {
1476: CRTC.crtRasterStamp[(a >> 11) - CRTC.crtR13GrYCurr[0] & 1023] = 0;
1477: MainMemory.mmrM8[XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10)] = (byte) d;
1478: }
1479: }
1480: @Override protected void mmdWw (int a, int d) throws M68kException {
1481: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram;
1482: CRTC.crtRasterStamp[(a >> 11) - CRTC.crtR13GrYCurr[0] & 1023] = 0;
1483: int b0 = XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1484: MainMemory.mmrM8[b0] = (byte) (d >> 8);
1485: MainMemory.mmrM8[b0 + 1] = (byte) d;
1486: }
1487: @Override protected void mmdWl (int a, int d) throws M68kException {
1488: XEiJ.mpuClockTime += XEiJ.busWaitTime.gvram * 2;
1489: CRTC.crtRasterStamp[(a >> 11) - CRTC.crtR13GrYCurr[0] & 1023] = 0;
1490:
1491: int b0 = XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1492: a += 2;
1493: int b2 = XEiJ.BUS_MODIFIED_65536_PAGE + (a & (1 << 20) + 1023) + (a << 9 & 1 << 19) + (a >>> 1 & 511 << 10);
1494: MainMemory.mmrM8[b0] = (byte) (d >>> 24);
1495: MainMemory.mmrM8[b0 + 1] = (byte) (d >>> 16);
1496: MainMemory.mmrM8[b2] = (byte) (d >>> 8);
1497: MainMemory.mmrM8[b2 + 1] = (byte) d;
1498: }
1499: },
1500:
1501:
1502:
1503: MMD_TXT {
1504: @Override public String toString () {
1505: return Multilingual.mlnJapanese ? "テキスト画面" : "Text Screen";
1506: }
1507:
1508: @Override protected byte mmdPbs (int a) {
1509: a &= XEiJ.BUS_MOTHER_MASK;
1510: return MainMemory.mmrM8[a];
1511: }
1512: @Override protected int mmdPbz (int a) {
1513: a &= XEiJ.BUS_MOTHER_MASK;
1514: return MainMemory.mmrM8[a] & 0xff;
1515: }
1516: @Override protected int mmdPws (int a) {
1517: a &= XEiJ.BUS_MOTHER_MASK;
1518: if (MainMemory.MMR_USE_BYTE_BUFFER) {
1519: return MainMemory.mmrBuffer.getShort (a);
1520: } else {
1521: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
1522: }
1523: }
1524: @Override protected int mmdPwz (int a) {
1525: a &= XEiJ.BUS_MOTHER_MASK;
1526: if (MainMemory.MMR_USE_BYTE_BUFFER) {
1527: return MainMemory.mmrBuffer.getChar (a);
1528: } else {
1529: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
1530: }
1531: }
1532: @Override protected int mmdPls (int a) {
1533: a &= XEiJ.BUS_MOTHER_MASK;
1534: if (MainMemory.MMR_USE_BYTE_BUFFER) {
1535: return MainMemory.mmrBuffer.getInt (a);
1536: } else {
1537: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
1538: }
1539: }
1540:
1541: @Override protected byte mmdRbs (int a) throws M68kException {
1542: XEiJ.mpuClockTime += XEiJ.busWaitTime.tvram;
1543: a &= XEiJ.BUS_MOTHER_MASK;
1544: return MainMemory.mmrM8[a];
1545: }
1546: @Override protected int mmdRbz (int a) throws M68kException {
1547: XEiJ.mpuClockTime += XEiJ.busWaitTime.tvram;
1548: a &= XEiJ.BUS_MOTHER_MASK;
1549: return MainMemory.mmrM8[a] & 0xff;
1550: }
1551: @Override protected int mmdRws (int a) throws M68kException {
1552: XEiJ.mpuClockTime += XEiJ.busWaitTime.tvram;
1553: a &= XEiJ.BUS_MOTHER_MASK;
1554: if (MainMemory.MMR_USE_BYTE_BUFFER) {
1555: return MainMemory.mmrBuffer.getShort (a);
1556: } else {
1557: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
1558: }
1559: }
1560: @Override protected int mmdRwz (int a) throws M68kException {
1561: XEiJ.mpuClockTime += XEiJ.busWaitTime.tvram;
1562: a &= XEiJ.BUS_MOTHER_MASK;
1563: if (MainMemory.MMR_USE_BYTE_BUFFER) {
1564: return MainMemory.mmrBuffer.getChar (a);
1565: } else {
1566: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
1567: }
1568: }
1569: @Override protected int mmdRls (int a) throws M68kException {
1570: XEiJ.mpuClockTime += XEiJ.busWaitTime.tvram * 2;
1571: a &= XEiJ.BUS_MOTHER_MASK;
1572: if (MainMemory.MMR_USE_BYTE_BUFFER) {
1573: return MainMemory.mmrBuffer.getInt (a);
1574: } else {
1575: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
1576: }
1577: }
1578:
1579: @Override protected void mmdWb (int a, int d) throws M68kException {
1580: XEiJ.mpuClockTime += XEiJ.busWaitTime.tvram;
1581: a &= XEiJ.BUS_MOTHER_MASK;
1582: int x;
1583: if (CRTC.crtSimAccess) {
1584: a &= 0x00e1ffff;
1585: if (CRTC.crtBitMask) {
1586: d &= ~(x = CRTC.crtR23Mask >> ((~a & 1) << 3));
1587: if (CRTC.crtSimPlane0) {
1588: MainMemory.mmrM8[a ] = (byte) (MainMemory.mmrM8[a ] & x | d);
1589: }
1590: if (CRTC.crtSimPlane1) {
1591: MainMemory.mmrM8[a + 0x00020000] = (byte) (MainMemory.mmrM8[a + 0x00020000] & x | d);
1592: }
1593: if (CRTC.crtSimPlane2) {
1594: MainMemory.mmrM8[a + 0x00040000] = (byte) (MainMemory.mmrM8[a + 0x00040000] & x | d);
1595: }
1596: if (CRTC.crtSimPlane3) {
1597: MainMemory.mmrM8[a + 0x00060000] = (byte) (MainMemory.mmrM8[a + 0x00060000] & x | d);
1598: }
1599: } else {
1600: if (CRTC.crtSimPlane0) {
1601: MainMemory.mmrM8[a ] = (byte) d;
1602: }
1603: if (CRTC.crtSimPlane1) {
1604: MainMemory.mmrM8[a + 0x00020000] = (byte) d;
1605: }
1606: if (CRTC.crtSimPlane2) {
1607: MainMemory.mmrM8[a + 0x00040000] = (byte) d;
1608: }
1609: if (CRTC.crtSimPlane3) {
1610: MainMemory.mmrM8[a + 0x00060000] = (byte) d;
1611: }
1612: }
1613: } else if (CRTC.crtBitMask) {
1614: x = CRTC.crtR23Mask >> ((~a & 1) << 3);
1615: MainMemory.mmrM8[a] = (byte) (MainMemory.mmrM8[a] & x | d & ~x);
1616: } else {
1617: MainMemory.mmrM8[a] = (byte) d;
1618: }
1619:
1620: a = ((a & 0x0001ffff) >> 7) - CRTC.crtR11TxYCurr & 1020;
1621: CRTC.crtRasterStamp[a ] = 0;
1622: CRTC.crtRasterStamp[a + 1] = 0;
1623: CRTC.crtRasterStamp[a + 2] = 0;
1624: CRTC.crtRasterStamp[a + 3] = 0;
1625: }
1626: @Override protected void mmdWw (int a, int d) throws M68kException {
1627: XEiJ.mpuClockTime += XEiJ.busWaitTime.tvram;
1628: a &= XEiJ.BUS_MOTHER_MASK;
1629: int e;
1630: int x;
1631: int y;
1632: if (CRTC.crtSimAccess) {
1633: a &= 0x00e1ffff;
1634: if (CRTC.crtBitMask) {
1635: e = d >> 8 & ~(y = (x = CRTC.crtR23Mask) >> 8);
1636: d &= ~x;
1637: if (CRTC.crtSimPlane0) {
1638: MainMemory.mmrM8[a ] = (byte) (MainMemory.mmrM8[a ] & y | e);
1639: MainMemory.mmrM8[a + 0x00000001] = (byte) (MainMemory.mmrM8[a + 0x00000001] & x | d);
1640: }
1641: if (CRTC.crtSimPlane1) {
1642: MainMemory.mmrM8[a + 0x00020000] = (byte) (MainMemory.mmrM8[a + 0x00020000] & y | e);
1643: MainMemory.mmrM8[a + 0x00020001] = (byte) (MainMemory.mmrM8[a + 0x00020001] & x | d);
1644: }
1645: if (CRTC.crtSimPlane2) {
1646: MainMemory.mmrM8[a + 0x00040000] = (byte) (MainMemory.mmrM8[a + 0x00040000] & y | e);
1647: MainMemory.mmrM8[a + 0x00040001] = (byte) (MainMemory.mmrM8[a + 0x00040001] & x | d);
1648: }
1649: if (CRTC.crtSimPlane3) {
1650: MainMemory.mmrM8[a + 0x00060000] = (byte) (MainMemory.mmrM8[a + 0x00060000] & y | e);
1651: MainMemory.mmrM8[a + 0x00060001] = (byte) (MainMemory.mmrM8[a + 0x00060001] & x | d);
1652: }
1653: } else {
1654: e = d >> 8;
1655: if (CRTC.crtSimPlane0) {
1656: MainMemory.mmrM8[a ] = (byte) e;
1657: MainMemory.mmrM8[a + 0x00000001] = (byte) d;
1658: }
1659: if (CRTC.crtSimPlane1) {
1660: MainMemory.mmrM8[a + 0x00020000] = (byte) e;
1661: MainMemory.mmrM8[a + 0x00020001] = (byte) d;
1662: }
1663: if (CRTC.crtSimPlane2) {
1664: MainMemory.mmrM8[a + 0x00040000] = (byte) e;
1665: MainMemory.mmrM8[a + 0x00040001] = (byte) d;
1666: }
1667: if (CRTC.crtSimPlane3) {
1668: MainMemory.mmrM8[a + 0x00060000] = (byte) e;
1669: MainMemory.mmrM8[a + 0x00060001] = (byte) d;
1670: }
1671: }
1672: } else if (CRTC.crtBitMask) {
1673: y = (x = CRTC.crtR23Mask) >> 8;
1674: MainMemory.mmrM8[a ] = (byte) (MainMemory.mmrM8[a ] & y | (d >> 8) & ~y);
1675: MainMemory.mmrM8[a + 1] = (byte) (MainMemory.mmrM8[a + 1] & x | d & ~x);
1676: } else {
1677: if (MainMemory.MMR_USE_BYTE_BUFFER) {
1678: MainMemory.mmrBuffer.putShort (a, (short) d);
1679: } else {
1680: MainMemory.mmrM8[a ] = (byte) (d >> 8);
1681: MainMemory.mmrM8[a + 1] = (byte) d;
1682: }
1683: }
1684:
1685: a = ((a & 0x0001ffff) >> 7) - CRTC.crtR11TxYCurr & 1020;
1686: CRTC.crtRasterStamp[a ] = 0;
1687: CRTC.crtRasterStamp[a + 1] = 0;
1688: CRTC.crtRasterStamp[a + 2] = 0;
1689: CRTC.crtRasterStamp[a + 3] = 0;
1690: }
1691: @Override protected void mmdWl (int a, int d) throws M68kException {
1692: XEiJ.mpuClockTime += XEiJ.busWaitTime.tvram * 2;
1693: a &= XEiJ.BUS_MOTHER_MASK;
1694: int e;
1695: int f;
1696: int g;
1697: int x;
1698: int y;
1699: if (CRTC.crtSimAccess) {
1700: a &= 0x00e1ffff;
1701: if (CRTC.crtBitMask) {
1702: g = d >> 24 & ~(y = (x = CRTC.crtR23Mask) >> 8);
1703: f = d >> 16 & ~x;
1704: e = d >> 8 & ~y;
1705: d &= ~x;
1706: if (CRTC.crtSimPlane0) {
1707: MainMemory.mmrM8[a ] = (byte) (MainMemory.mmrM8[a ] & y | g);
1708: MainMemory.mmrM8[a + 0x00000001] = (byte) (MainMemory.mmrM8[a + 0x00000001] & x | f);
1709: MainMemory.mmrM8[a + 0x00000002] = (byte) (MainMemory.mmrM8[a + 0x00000002] & y | e);
1710: MainMemory.mmrM8[a + 0x00000003] = (byte) (MainMemory.mmrM8[a + 0x00000003] & x | d);
1711: }
1712: if (CRTC.crtSimPlane1) {
1713: MainMemory.mmrM8[a + 0x00020000] = (byte) (MainMemory.mmrM8[a + 0x00020000] & y | g);
1714: MainMemory.mmrM8[a + 0x00020001] = (byte) (MainMemory.mmrM8[a + 0x00020001] & x | f);
1715: MainMemory.mmrM8[a + 0x00020002] = (byte) (MainMemory.mmrM8[a + 0x00020002] & y | e);
1716: MainMemory.mmrM8[a + 0x00020003] = (byte) (MainMemory.mmrM8[a + 0x00020003] & x | d);
1717: }
1718: if (CRTC.crtSimPlane2) {
1719: MainMemory.mmrM8[a + 0x00040000] = (byte) (MainMemory.mmrM8[a + 0x00040000] & y | g);
1720: MainMemory.mmrM8[a + 0x00040001] = (byte) (MainMemory.mmrM8[a + 0x00040001] & x | f);
1721: MainMemory.mmrM8[a + 0x00040002] = (byte) (MainMemory.mmrM8[a + 0x00040002] & y | e);
1722: MainMemory.mmrM8[a + 0x00040003] = (byte) (MainMemory.mmrM8[a + 0x00040003] & x | d);
1723: }
1724: if (CRTC.crtSimPlane3) {
1725: MainMemory.mmrM8[a + 0x00060000] = (byte) (MainMemory.mmrM8[a + 0x00060000] & y | g);
1726: MainMemory.mmrM8[a + 0x00060001] = (byte) (MainMemory.mmrM8[a + 0x00060001] & x | f);
1727: MainMemory.mmrM8[a + 0x00060002] = (byte) (MainMemory.mmrM8[a + 0x00060002] & y | e);
1728: MainMemory.mmrM8[a + 0x00060003] = (byte) (MainMemory.mmrM8[a + 0x00060003] & x | d);
1729: }
1730: } else {
1731: g = d >> 24;
1732: f = d >> 16;
1733: e = d >> 8;
1734: if (CRTC.crtSimPlane0) {
1735: MainMemory.mmrM8[a ] = (byte) g;
1736: MainMemory.mmrM8[a + 0x00000001] = (byte) f;
1737: MainMemory.mmrM8[a + 0x00000002] = (byte) e;
1738: MainMemory.mmrM8[a + 0x00000003] = (byte) d;
1739: }
1740: if (CRTC.crtSimPlane1) {
1741: MainMemory.mmrM8[a + 0x00020000] = (byte) g;
1742: MainMemory.mmrM8[a + 0x00020001] = (byte) f;
1743: MainMemory.mmrM8[a + 0x00020002] = (byte) e;
1744: MainMemory.mmrM8[a + 0x00020003] = (byte) d;
1745: }
1746: if (CRTC.crtSimPlane2) {
1747: MainMemory.mmrM8[a + 0x00040000] = (byte) g;
1748: MainMemory.mmrM8[a + 0x00040001] = (byte) f;
1749: MainMemory.mmrM8[a + 0x00040002] = (byte) e;
1750: MainMemory.mmrM8[a + 0x00040003] = (byte) d;
1751: }
1752: if (CRTC.crtSimPlane3) {
1753: MainMemory.mmrM8[a + 0x00060000] = (byte) g;
1754: MainMemory.mmrM8[a + 0x00060001] = (byte) f;
1755: MainMemory.mmrM8[a + 0x00060002] = (byte) e;
1756: MainMemory.mmrM8[a + 0x00060003] = (byte) d;
1757: }
1758: }
1759: } else if (CRTC.crtBitMask) {
1760: y = (x = CRTC.crtR23Mask) >> 8;
1761: MainMemory.mmrM8[a ] = (byte) (MainMemory.mmrM8[a ] & y | (d >> 24) & ~y);
1762: MainMemory.mmrM8[a + 1] = (byte) (MainMemory.mmrM8[a + 1] & x | (d >> 16) & ~x);
1763: MainMemory.mmrM8[a + 2] = (byte) (MainMemory.mmrM8[a + 1] & y | (d >> 8) & ~y);
1764: MainMemory.mmrM8[a + 3] = (byte) (MainMemory.mmrM8[a + 1] & x | d & ~x);
1765: } else {
1766: if (MainMemory.MMR_USE_BYTE_BUFFER) {
1767: MainMemory.mmrBuffer.putInt (a, d);
1768: } else {
1769: MainMemory.mmrM8[a ] = (byte) (d >> 24);
1770: MainMemory.mmrM8[a + 1] = (byte) (d >> 16);
1771: MainMemory.mmrM8[a + 2] = (byte) (d >> 8);
1772: MainMemory.mmrM8[a + 3] = (byte) d;
1773: }
1774: }
1775:
1776: int b = ((a & 0x0001ffff) >> 7) - CRTC.crtR11TxYCurr & 1020;
1777: CRTC.crtRasterStamp[b ] = 0;
1778: CRTC.crtRasterStamp[b + 1] = 0;
1779: CRTC.crtRasterStamp[b + 2] = 0;
1780: CRTC.crtRasterStamp[b + 3] = 0;
1781: a = ((a + 2 & 0x0001ffff) >> 7) - CRTC.crtR11TxYCurr & 1020;
1782: if (a != b) {
1783: CRTC.crtRasterStamp[a ] = 0;
1784: CRTC.crtRasterStamp[a + 1] = 0;
1785: CRTC.crtRasterStamp[a + 2] = 0;
1786: CRTC.crtRasterStamp[a + 3] = 0;
1787: }
1788: }
1789: },
1790:
1791:
1792:
1793:
1794:
1795:
1796:
1797:
1798:
1799:
1800:
1801:
1802:
1803: MMD_CRT {
1804: @Override public String toString () {
1805: return Multilingual.mlnJapanese ? "CRT コントローラ" : "CRT Controller";
1806: }
1807:
1808: @Override protected int mmdRbz (int a) throws M68kException {
1809: XEiJ.mpuClockTime += XEiJ.busWaitTime.crtc;
1810: int aa = a & 0x07ff;
1811: if (aa < 0x0400) {
1812: aa &= 0x003f;
1813: switch (aa) {
1814:
1815:
1816:
1817:
1818:
1819:
1820:
1821:
1822:
1823:
1824:
1825:
1826:
1827:
1828:
1829:
1830:
1831:
1832:
1833:
1834:
1835:
1836:
1837:
1838:
1839:
1840:
1841:
1842:
1843:
1844:
1845:
1846:
1847:
1848:
1849:
1850:
1851:
1852:
1853:
1854:
1855:
1856:
1857:
1858:
1859:
1860:
1861:
1862:
1863:
1864:
1865:
1866:
1867:
1868:
1869:
1870:
1871:
1872: case 0x0028:
1873: return (CRTC.crtTextStorage << 4 |
1874: CRTC.crtGraphicStorage << 3 |
1875: CRTC.crtMemoryModePort);
1876: case 0x0029:
1877: return (CRTC.crtHighResoPort << 4 |
1878: CRTC.crtVResoPort << 2 |
1879: CRTC.crtHResoPort);
1880: case 0x002a:
1881: return ((CRTC.crtBitMask ? 0b00000010 : 0) |
1882: (CRTC.crtSimAccess ? 0b00000001 : 0));
1883: case 0x002b:
1884: return ((CRTC.crtSimPlane3 ? 0b10000000 : 0) |
1885: (CRTC.crtSimPlane2 ? 0b01000000 : 0) |
1886: (CRTC.crtSimPlane1 ? 0b00100000 : 0) |
1887: (CRTC.crtSimPlane0 ? 0b00010000 : 0) |
1888: (CRTC.crtCCPlane3 ? 0b00001000 : 0) |
1889: (CRTC.crtCCPlane2 ? 0b00000100 : 0) |
1890: (CRTC.crtCCPlane1 ? 0b00000010 : 0) |
1891: (CRTC.crtCCPlane0 ? 0b00000001 : 0));
1892:
1893:
1894:
1895:
1896:
1897:
1898:
1899:
1900:
1901:
1902:
1903:
1904:
1905:
1906:
1907:
1908:
1909:
1910:
1911:
1912:
1913:
1914:
1915:
1916:
1917:
1918:
1919:
1920:
1921: default:
1922: return 0x00;
1923:
1924:
1925: }
1926: } else {
1927: aa &= 0xff;
1928: if (aa < 0x80) {
1929: return super.mmdRbz (a);
1930: } else {
1931: aa &= 0x01;
1932: if (aa == 0) {
1933: return 0;
1934: } else {
1935: return ((CRTC.crtRasterCopyOn ? 8 : 0) |
1936: (CRTC.crtClearStandby || CRTC.crtClearFrames != 0 ? 2 : 0));
1937: }
1938: }
1939: }
1940: }
1941: @Override protected int mmdRwz (int a) throws M68kException {
1942: XEiJ.mpuClockTime += XEiJ.busWaitTime.crtc;
1943: int aa = a & 0x07ff;
1944: if (aa < 0x0400) {
1945: aa &= 0x003f;
1946: switch (aa) {
1947:
1948:
1949:
1950:
1951:
1952:
1953:
1954:
1955:
1956:
1957:
1958:
1959:
1960:
1961:
1962:
1963:
1964:
1965:
1966:
1967:
1968:
1969:
1970:
1971:
1972:
1973:
1974:
1975:
1976:
1977:
1978:
1979:
1980:
1981: case 0x0028:
1982: return (CRTC.crtTextStorage << 12 |
1983: CRTC.crtGraphicStorage << 11 |
1984: CRTC.crtMemoryModePort << 8 |
1985: CRTC.crtHighResoPort << 4 |
1986: CRTC.crtVResoPort << 2 |
1987: CRTC.crtHResoPort);
1988: case 0x002a:
1989: return ((CRTC.crtBitMask ? 0b00000010_00000000 : 0) |
1990: (CRTC.crtSimAccess ? 0b00000001_00000000 : 0) |
1991: (CRTC.crtSimPlane3 ? 0b00000000_10000000 : 0) |
1992: (CRTC.crtSimPlane2 ? 0b00000000_01000000 : 0) |
1993: (CRTC.crtSimPlane1 ? 0b00000000_00100000 : 0) |
1994: (CRTC.crtSimPlane0 ? 0b00000000_00010000 : 0) |
1995: (CRTC.crtCCPlane3 ? 0b00000000_00001000 : 0) |
1996: (CRTC.crtCCPlane2 ? 0b00000000_00000100 : 0) |
1997: (CRTC.crtCCPlane1 ? 0b00000000_00000010 : 0) |
1998: (CRTC.crtCCPlane0 ? 0b00000000_00000001 : 0));
1999:
2000:
2001:
2002:
2003:
2004:
2005:
2006:
2007:
2008:
2009:
2010:
2011: default:
2012: return 0x0000;
2013: }
2014: } else {
2015: aa &= 0xff;
2016: if (aa < 0x80) {
2017: return super.mmdRbz (a);
2018: } else {
2019: return ((CRTC.crtRasterCopyOn ? 8 : 0) |
2020: (CRTC.crtClearStandby || CRTC.crtClearFrames != 0 ? 2 : 0));
2021: }
2022: }
2023: }
2024: @Override protected int mmdRls (int a) throws M68kException {
2025: return mmdRwz (a) << 16 | mmdRwz (a + 2);
2026: }
2027:
2028: @Override protected void mmdWb (int a, int d) throws M68kException {
2029: XEiJ.mpuClockTime += XEiJ.busWaitTime.crtc;
2030: int aa = a & 0x07ff;
2031: if (aa < 0x0400) {
2032: aa &= 0x003f;
2033: switch (aa) {
2034: case 0x0001:
2035: CRTC.crtR00HFrontEndPort = (d & 0xff) | (CRTC.crtR00Bit0Zero ? 0x00 : 0x01);
2036: {
2037: int curr = CRTC.crtR00HFrontEndMask == 0 ? CRTC.crtR00HFrontEndPort : CRTC.crtR00HFrontEndTest;
2038: if (CRTC.crtR00HFrontEndCurr != curr) {
2039: CRTC.crtR00HFrontEndCurr = curr;
2040: CRTC.crtRestart ();
2041: }
2042: }
2043: return;
2044: case 0x0003:
2045: CRTC.crtR01HSyncEndPort = d & 0xff;
2046: {
2047: int curr = CRTC.crtR01HSyncEndMask == 0 ? CRTC.crtR01HSyncEndPort : CRTC.crtR01HSyncEndTest;
2048: if (CRTC.crtR01HSyncEndCurr != curr) {
2049: CRTC.crtR01HSyncEndCurr = curr;
2050: CRTC.crtRestart ();
2051: }
2052: }
2053: return;
2054: case 0x0005:
2055: CRTC.crtR02HBackEndPort = d & 0xff;
2056: {
2057: int curr = CRTC.crtR02HBackEndMask == 0 ? CRTC.crtR02HBackEndPort : CRTC.crtR02HBackEndTest;
2058: if (CRTC.crtR02HBackEndCurr != curr) {
2059: CRTC.crtR02HBackEndCurr = curr;
2060: CRTC.crtRestart ();
2061: }
2062: }
2063: return;
2064: case 0x0007:
2065: CRTC.crtR03HDispEndPort = d & 0xff;
2066: {
2067: int curr = CRTC.crtR03HDispEndMask == 0 ? CRTC.crtR03HDispEndPort : CRTC.crtR03HDispEndTest;
2068: if (CRTC.crtR03HDispEndCurr != curr) {
2069: CRTC.crtR03HDispEndCurr = curr;
2070: CRTC.crtRestart ();
2071: }
2072: }
2073: return;
2074: case 0x0008:
2075: CRTC.crtR04VFrontEndPort = (d & (CRTC.crtVerticalMask >> 8)) << 8 | (CRTC.crtR04VFrontEndPort & 0xff);
2076: {
2077: int curr = CRTC.crtR04VFrontEndMask == 0 ? CRTC.crtR04VFrontEndPort : CRTC.crtR04VFrontEndTest;
2078: if (CRTC.crtR04VFrontEndCurr != curr) {
2079: CRTC.crtR04VFrontEndCurr = curr;
2080: if (CRTC.CRT_RASTER_HASH_ON) {
2081: CRTC.crtUpdateRasterHash ();
2082: }
2083: CRTC.crtRestart ();
2084: }
2085: }
2086: return;
2087: case 0x0009:
2088: CRTC.crtR04VFrontEndPort = (CRTC.crtR04VFrontEndPort & ~0xff) | (d & 0xff);
2089: {
2090: int curr = CRTC.crtR04VFrontEndMask == 0 ? CRTC.crtR04VFrontEndPort : CRTC.crtR04VFrontEndTest;
2091: if (CRTC.crtR04VFrontEndCurr != curr) {
2092: CRTC.crtR04VFrontEndCurr = curr;
2093: if (CRTC.CRT_RASTER_HASH_ON) {
2094: CRTC.crtUpdateRasterHash ();
2095: }
2096: CRTC.crtRestart ();
2097: }
2098: }
2099: return;
2100: case 0x000a:
2101: CRTC.crtR05VSyncEndPort = (d & (CRTC.crtVerticalMask >> 8)) << 8 | (CRTC.crtR05VSyncEndPort & 0xff);
2102: {
2103: int curr = CRTC.crtR05VSyncEndMask == 0 ? CRTC.crtR05VSyncEndPort : CRTC.crtR05VSyncEndTest;
2104: if (CRTC.crtR05VSyncEndCurr != curr) {
2105: CRTC.crtR05VSyncEndCurr = curr;
2106: CRTC.crtRestart ();
2107: }
2108: }
2109: return;
2110: case 0x000b:
2111: CRTC.crtR05VSyncEndPort = (CRTC.crtR05VSyncEndPort & ~0xff) | (d & 0xff);
2112: {
2113: int curr = CRTC.crtR05VSyncEndMask == 0 ? CRTC.crtR05VSyncEndPort : CRTC.crtR05VSyncEndTest;
2114: if (CRTC.crtR05VSyncEndCurr != curr) {
2115: CRTC.crtR05VSyncEndCurr = curr;
2116: CRTC.crtRestart ();
2117: }
2118: }
2119: return;
2120: case 0x000c:
2121: CRTC.crtR06VBackEndPort = (d & (CRTC.crtVerticalMask >> 8)) << 8 | (CRTC.crtR06VBackEndPort & 0xff);
2122: {
2123: int curr = CRTC.crtR06VBackEndMask == 0 ? CRTC.crtR06VBackEndPort : CRTC.crtR06VBackEndTest;
2124: if (CRTC.crtR06VBackEndCurr != curr) {
2125: CRTC.crtR06VBackEndCurr = curr;
2126: CRTC.crtVDispStart = curr + 1;
2127: if (CRTC.CRT_RASTER_HASH_ON) {
2128: CRTC.crtUpdateRasterHash ();
2129: }
2130: CRTC.crtRestart ();
2131: }
2132: }
2133: return;
2134: case 0x000d:
2135: CRTC.crtR06VBackEndPort = (CRTC.crtR06VBackEndPort & ~0xff) | (d & 0xff);
2136: {
2137: int curr = CRTC.crtR06VBackEndMask == 0 ? CRTC.crtR06VBackEndPort : CRTC.crtR06VBackEndTest;
2138: if (CRTC.crtR06VBackEndCurr != curr) {
2139: CRTC.crtR06VBackEndCurr = curr;
2140: CRTC.crtVDispStart = curr + 1;
2141: if (CRTC.CRT_RASTER_HASH_ON) {
2142: CRTC.crtUpdateRasterHash ();
2143: }
2144: CRTC.crtRestart ();
2145: }
2146: }
2147: return;
2148: case 0x000e:
2149: CRTC.crtR07VDispEndPort = (d & (CRTC.crtVerticalMask >> 8)) << 8 | (CRTC.crtR07VDispEndPort & 0xff);
2150: {
2151: int curr = CRTC.crtR07VDispEndMask == 0 ? CRTC.crtR07VDispEndPort : CRTC.crtR07VDispEndTest;
2152: if (CRTC.crtR07VDispEndCurr != curr) {
2153: CRTC.crtR07VDispEndCurr = curr;
2154: CRTC.crtVIdleStart = curr + 1;
2155: if (CRTC.CRT_RASTER_HASH_ON) {
2156: CRTC.crtUpdateRasterHash ();
2157: }
2158: CRTC.crtRestart ();
2159: }
2160: }
2161: return;
2162: case 0x000f:
2163: CRTC.crtR07VDispEndPort = (CRTC.crtR07VDispEndPort & ~0xff) | (d & 0xff);
2164: {
2165: int curr = CRTC.crtR07VDispEndMask == 0 ? CRTC.crtR07VDispEndPort : CRTC.crtR07VDispEndTest;
2166: if (CRTC.crtR07VDispEndCurr != curr) {
2167: CRTC.crtR07VDispEndCurr = curr;
2168: CRTC.crtVIdleStart = curr + 1;
2169: if (CRTC.CRT_RASTER_HASH_ON) {
2170: CRTC.crtUpdateRasterHash ();
2171: }
2172: CRTC.crtRestart ();
2173: }
2174: }
2175: return;
2176: case 0x0011:
2177: d &= 0xff;
2178: if (CRTC.crtR08Adjust != d) {
2179: CRTC.crtR08Adjust = d;
2180: CRTC.crtRestart ();
2181: }
2182: return;
2183: case 0x0012:
2184: CRTC.crtR09IRQRasterPort = (d & (CRTC.crtVerticalMask >> 8)) << 8 | (CRTC.crtR09IRQRasterPort & 0xff);
2185: {
2186: int curr = CRTC.crtR09IRQRasterMask == 0 ? CRTC.crtR09IRQRasterPort : CRTC.crtR09IRQRasterTest;
2187: if (CRTC.crtR09IRQRasterCurr != curr) {
2188: CRTC.crtR09IRQRasterCurr = curr;
2189: if (CRTC.CRT_RASTER_HASH_ON) {
2190: CRTC.crtUpdateRasterHash ();
2191: }
2192: if (RasterBreakPoint.RBP_ON) {
2193: RasterBreakPoint.rbpCheckIRQ ();
2194: }
2195: }
2196: }
2197: return;
2198: case 0x0013:
2199: CRTC.crtR09IRQRasterPort = (CRTC.crtR09IRQRasterPort & ~0xff) | (d & 0xff);
2200: {
2201: int curr = CRTC.crtR09IRQRasterMask == 0 ? CRTC.crtR09IRQRasterPort : CRTC.crtR09IRQRasterTest;
2202: if (CRTC.crtR09IRQRasterCurr != curr) {
2203: CRTC.crtR09IRQRasterCurr = curr;
2204: if (CRTC.CRT_RASTER_HASH_ON) {
2205: CRTC.crtUpdateRasterHash ();
2206: }
2207: if (RasterBreakPoint.RBP_ON) {
2208: RasterBreakPoint.rbpCheckIRQ ();
2209: }
2210: }
2211: }
2212: return;
2213: case 0x0014:
2214: CRTC.crtR10TxXPort = (d & 0x03) << 8 | (CRTC.crtR10TxXPort & 0xff);
2215: {
2216: int curr = CRTC.crtR10TxXMask == 0 ? CRTC.crtR10TxXPort : CRTC.crtR10TxXTest;
2217: if (CRTC.crtR10TxXCurr != curr) {
2218: CRTC.crtR10TxXCurr = curr;
2219: CRTC.crtAllStamp += 2;
2220: }
2221: }
2222: return;
2223: case 0x0015:
2224: CRTC.crtR10TxXPort = (CRTC.crtR10TxXPort & ~0xff) | (d & 0xff);
2225: {
2226: int curr = CRTC.crtR10TxXMask == 0 ? CRTC.crtR10TxXPort : CRTC.crtR10TxXTest;
2227: if (CRTC.crtR10TxXCurr != curr) {
2228: CRTC.crtR10TxXCurr = curr;
2229: CRTC.crtAllStamp += 2;
2230: }
2231: }
2232: return;
2233: case 0x0016:
2234: CRTC.crtR11TxYPort = (d & 0x03) << 8 | (CRTC.crtR11TxYPort & 0xff);
2235: {
2236: int curr = CRTC.crtR11TxYMask == 0 ? CRTC.crtR11TxYPort : CRTC.crtR11TxYTest;
2237: if (CRTC.crtR11TxYCurr != curr) {
2238: CRTC.crtR11TxYCurr = curr;
2239:
2240: }
2241: }
2242: return;
2243: case 0x0017:
2244: CRTC.crtR11TxYPort = (CRTC.crtR11TxYPort & ~0xff) | (d & 0xff);
2245: {
2246: int curr = CRTC.crtR11TxYMask == 0 ? CRTC.crtR11TxYPort : CRTC.crtR11TxYTest;
2247: if (CRTC.crtR11TxYCurr != curr) {
2248: CRTC.crtR11TxYCurr = curr;
2249:
2250: }
2251: }
2252: return;
2253: case 0x0018:
2254: case 0x001c:
2255: case 0x0020:
2256: case 0x0024:
2257: {
2258: int p = (aa - 0x0018) >> 2;
2259: CRTC.crtR12GrXPort[p] = (d & (p == 0 ? 0x03 : 0x01)) << 8 | (CRTC.crtR12GrXPort[p] & 0xff);
2260: int curr = CRTC.crtR12GrXMask[p] == 0 ? CRTC.crtR12GrXPort[p] : CRTC.crtR12GrXTest[p];
2261: if (CRTC.crtR12GrXCurr[p] != curr) {
2262: CRTC.crtR12GrXCurr[p] = curr;
2263: CRTC.crtAllStamp += 2;
2264: }
2265: }
2266: return;
2267: case 0x0019:
2268: case 0x001d:
2269: case 0x0021:
2270: case 0x0025:
2271: {
2272: int p = (aa - 0x0018) >> 2;
2273: CRTC.crtR12GrXPort[p] = (CRTC.crtR12GrXPort[p] & ~0xff) | (d & 0xff);
2274: int curr = CRTC.crtR12GrXMask[p] == 0 ? CRTC.crtR12GrXPort[p] : CRTC.crtR12GrXTest[p];
2275: if (CRTC.crtR12GrXCurr[p] != curr) {
2276: CRTC.crtR12GrXCurr[p] = curr;
2277: CRTC.crtAllStamp += 2;
2278: }
2279: }
2280: return;
2281: case 0x001a:
2282: case 0x001e:
2283: case 0x0022:
2284: case 0x0026:
2285: {
2286: int p = (aa - 0x0018) >> 2;
2287: CRTC.crtR13GrYPort[p] = (d & (p == 0 ? 0x03 : 0x01)) << 8 | (CRTC.crtR13GrYPort[p] & 0xff);
2288: int curr = CRTC.crtR13GrYMask[p] == 0 ? CRTC.crtR13GrYPort[p] : CRTC.crtR13GrYTest[p];
2289: if (CRTC.crtR13GrYCurr[p] != curr) {
2290: CRTC.crtR13GrYCurr[p] = curr;
2291:
2292: }
2293: }
2294: return;
2295: case 0x001b:
2296: case 0x001f:
2297: case 0x0023:
2298: case 0x0027:
2299: {
2300: int p = (aa - 0x0018) >> 2;
2301: CRTC.crtR13GrYPort[p] = (CRTC.crtR13GrYPort[p] & ~0xff) | (d & 0xff);
2302: int curr = CRTC.crtR13GrYMask[p] == 0 ? CRTC.crtR13GrYPort[p] : CRTC.crtR13GrYTest[p];
2303: if (CRTC.crtR13GrYCurr[p] != curr) {
2304: CRTC.crtR13GrYCurr[p] = curr;
2305:
2306: }
2307: }
2308: return;
2309: case 0x0028:
2310: CRTC.crtSetMemoryMode (d >> 4, d >> 3, d);
2311: return;
2312: case 0x0029:
2313: CRTC.crtHighResoPort = d >>> 4 & 1;
2314: CRTC.crtVResoPort = d >>> 2 & 3;
2315: CRTC.crtHResoPort = d & 3;
2316: SpriteScreen.sprAccessible = (d & 0b10010) != 0b10010;
2317: int highResoCurr = CRTC.crtHighResoMask == 0 ? CRTC.crtHighResoPort : CRTC.crtHighResoTest;
2318: int vResoCurr = CRTC.crtVResoMask == 0 ? CRTC.crtVResoPort : CRTC.crtVResoTest;
2319: int hResoCurr = CRTC.crtHResoMask == 0 ? CRTC.crtHResoPort : CRTC.crtHResoTest;
2320: if (CRTC.crtHighResoCurr != highResoCurr ||
2321: CRTC.crtVResoCurr != vResoCurr ||
2322: CRTC.crtHResoCurr != hResoCurr) {
2323: CRTC.crtHighResoCurr = highResoCurr;
2324: CRTC.crtVResoCurr = vResoCurr;
2325: CRTC.crtHResoCurr = hResoCurr;
2326: CRTC.crtRestart ();
2327: }
2328: return;
2329: case 0x002a:
2330: CRTC.crtBitMask = XEiJ.TEST_BIT_1_SHIFT ? d << 31 - 1 < 0 : (d & 2) != 0;
2331: CRTC.crtSimAccess = XEiJ.TEST_BIT_0_SHIFT ? d << 31 - 0 < 0 : (d & 1) != 0;
2332: return;
2333: case 0x002b:
2334: CRTC.crtSimPlane3 = (byte) d < 0;
2335: CRTC.crtSimPlane2 = d << 25 < 0;
2336: CRTC.crtSimPlane1 = d << 26 < 0;
2337: CRTC.crtSimPlane0 = d << 27 < 0;
2338: CRTC.crtCCPlane3 = XEiJ.TEST_BIT_3_SHIFT ? d << 31 - 3 < 0 : (d & 8) != 0;
2339: CRTC.crtCCPlane2 = XEiJ.TEST_BIT_2_SHIFT ? d << 31 - 2 < 0 : (d & 4) != 0;
2340: CRTC.crtCCPlane1 = XEiJ.TEST_BIT_1_SHIFT ? d << 31 - 1 < 0 : (d & 2) != 0;
2341: CRTC.crtCCPlane0 = XEiJ.TEST_BIT_0_SHIFT ? d << 31 - 0 < 0 : (d & 1) != 0;
2342: return;
2343: case 0x002c:
2344: CRTC.crtR22SrcBlock = d & 0xff;
2345: return;
2346: case 0x002d:
2347: CRTC.crtR22DstBlock = d & 0xff;
2348: return;
2349: case 0x002e:
2350: CRTC.crtR23Mask = (d & 0xff) << 8 | (CRTC.crtR23Mask & 0xff);
2351: return;
2352: case 0x002f:
2353: CRTC.crtR23Mask = (CRTC.crtR23Mask & ~0xff) | (d & 0xff);
2354: return;
2355:
2356:
2357:
2358:
2359:
2360:
2361:
2362:
2363:
2364:
2365:
2366:
2367:
2368:
2369:
2370:
2371:
2372:
2373:
2374:
2375:
2376: default:
2377: return;
2378: }
2379: } else {
2380: aa &= 0xff;
2381: if (aa < 0x80) {
2382: super.mmdWb (a, d);
2383: } else {
2384: aa &= 0x01;
2385: if (aa == 0) {
2386: return;
2387: } else {
2388: boolean rasterCopyOn = (d & 8) != 0;
2389: if (CRTC.crtRasterCopyOn != rasterCopyOn) {
2390: CRTC.crtRasterCopyOn = rasterCopyOn;
2391: if (CRTC.CRT_RASTER_HASH_ON) {
2392: CRTC.crtUpdateRasterHash ();
2393: }
2394: }
2395: CRTC.crtClearStandby = (d & 2) != 0;
2396: return;
2397: }
2398: }
2399: }
2400: }
2401: @Override protected void mmdWw (int a, int d) throws M68kException {
2402: XEiJ.mpuClockTime += XEiJ.busWaitTime.crtc;
2403: int aa = a & 0x07ff;
2404: if (aa < 0x0400) {
2405: aa &= 0x003f;
2406: switch (aa) {
2407: case 0x0000:
2408: CRTC.crtR00HFrontEndPort = (d & 0xff) | (CRTC.crtR00Bit0Zero ? 0x00 : 0x01);
2409: {
2410: int curr = CRTC.crtR00HFrontEndMask == 0 ? CRTC.crtR00HFrontEndPort : CRTC.crtR00HFrontEndTest;
2411: if (CRTC.crtR00HFrontEndCurr != curr) {
2412: CRTC.crtR00HFrontEndCurr = curr;
2413: CRTC.crtRestart ();
2414: }
2415: }
2416: return;
2417: case 0x0002:
2418: CRTC.crtR01HSyncEndPort = d & 0xff;
2419: {
2420: int curr = CRTC.crtR01HSyncEndMask == 0 ? CRTC.crtR01HSyncEndPort : CRTC.crtR01HSyncEndTest;
2421: if (CRTC.crtR01HSyncEndCurr != curr) {
2422: CRTC.crtR01HSyncEndCurr = curr;
2423: CRTC.crtRestart ();
2424: }
2425: }
2426: return;
2427: case 0x0004:
2428: CRTC.crtR02HBackEndPort = d & 0xff;
2429: {
2430: int curr = CRTC.crtR02HBackEndMask == 0 ? CRTC.crtR02HBackEndPort : CRTC.crtR02HBackEndTest;
2431: if (CRTC.crtR02HBackEndCurr != curr) {
2432: CRTC.crtR02HBackEndCurr = curr;
2433: CRTC.crtRestart ();
2434: }
2435: }
2436: return;
2437: case 0x0006:
2438: CRTC.crtR03HDispEndPort = d & 0xff;
2439: {
2440: int curr = CRTC.crtR03HDispEndMask == 0 ? CRTC.crtR03HDispEndPort : CRTC.crtR03HDispEndTest;
2441: if (CRTC.crtR03HDispEndCurr != curr) {
2442: CRTC.crtR03HDispEndCurr = curr;
2443: CRTC.crtRestart ();
2444: }
2445: }
2446: return;
2447: case 0x0008:
2448: CRTC.crtR04VFrontEndPort = d & CRTC.crtVerticalMask;
2449: {
2450: int curr = CRTC.crtR04VFrontEndMask == 0 ? CRTC.crtR04VFrontEndPort : CRTC.crtR04VFrontEndTest;
2451: if (CRTC.crtR04VFrontEndCurr != curr) {
2452: CRTC.crtR04VFrontEndCurr = curr;
2453: if (CRTC.CRT_RASTER_HASH_ON) {
2454: CRTC.crtUpdateRasterHash ();
2455: }
2456: CRTC.crtRestart ();
2457: }
2458: }
2459: return;
2460: case 0x000a:
2461: CRTC.crtR05VSyncEndPort = d & CRTC.crtVerticalMask;
2462: {
2463: int curr = CRTC.crtR05VSyncEndMask == 0 ? CRTC.crtR05VSyncEndPort : CRTC.crtR05VSyncEndTest;
2464: if (CRTC.crtR05VSyncEndCurr != curr) {
2465: CRTC.crtR05VSyncEndCurr = curr;
2466: CRTC.crtRestart ();
2467: }
2468: }
2469: return;
2470: case 0x000c:
2471: CRTC.crtR06VBackEndPort = d & CRTC.crtVerticalMask;
2472: {
2473: int curr = CRTC.crtR06VBackEndMask == 0 ? CRTC.crtR06VBackEndPort : CRTC.crtR06VBackEndTest;
2474: if (CRTC.crtR06VBackEndCurr != curr) {
2475: CRTC.crtR06VBackEndCurr = curr;
2476: CRTC.crtVDispStart = curr + 1;
2477: if (CRTC.CRT_RASTER_HASH_ON) {
2478: CRTC.crtUpdateRasterHash ();
2479: }
2480: CRTC.crtRestart ();
2481: }
2482: }
2483: return;
2484: case 0x000e:
2485: CRTC.crtR07VDispEndPort = d & CRTC.crtVerticalMask;
2486: {
2487: int curr = CRTC.crtR07VDispEndMask == 0 ? CRTC.crtR07VDispEndPort : CRTC.crtR07VDispEndTest;
2488: if (CRTC.crtR07VDispEndCurr != curr) {
2489: CRTC.crtR07VDispEndCurr = curr;
2490: CRTC.crtVIdleStart = curr + 1;
2491: if (CRTC.CRT_RASTER_HASH_ON) {
2492: CRTC.crtUpdateRasterHash ();
2493: }
2494: CRTC.crtRestart ();
2495: }
2496: }
2497: return;
2498: case 0x0010:
2499: d &= 0xff;
2500: if (CRTC.crtR08Adjust != d) {
2501: CRTC.crtR08Adjust = d;
2502: CRTC.crtRestart ();
2503: }
2504: return;
2505: case 0x0012:
2506: CRTC.crtR09IRQRasterPort = d & CRTC.crtVerticalMask;
2507: {
2508: int curr = CRTC.crtR09IRQRasterMask == 0 ? CRTC.crtR09IRQRasterPort : CRTC.crtR09IRQRasterTest;
2509: if (CRTC.crtR09IRQRasterCurr != curr) {
2510: CRTC.crtR09IRQRasterCurr = curr;
2511: if (CRTC.CRT_RASTER_HASH_ON) {
2512: CRTC.crtUpdateRasterHash ();
2513: }
2514: if (RasterBreakPoint.RBP_ON) {
2515: RasterBreakPoint.rbpCheckIRQ ();
2516: }
2517: }
2518: }
2519: return;
2520: case 0x0014:
2521: CRTC.crtR10TxXPort = d & 0x03ff;
2522: {
2523: int curr = CRTC.crtR10TxXMask == 0 ? CRTC.crtR10TxXPort : CRTC.crtR10TxXTest;
2524: if (CRTC.crtR10TxXCurr != curr) {
2525: CRTC.crtR10TxXCurr = curr;
2526: CRTC.crtAllStamp += 2;
2527: }
2528: }
2529: return;
2530: case 0x0016:
2531: CRTC.crtR11TxYPort = d & 0x03ff;
2532: {
2533: int curr = CRTC.crtR11TxYMask == 0 ? CRTC.crtR11TxYPort : CRTC.crtR11TxYTest;
2534: if (CRTC.crtR11TxYCurr != curr) {
2535: CRTC.crtR11TxYCurr = curr;
2536:
2537: }
2538: }
2539: return;
2540: case 0x0018:
2541: case 0x001c:
2542: case 0x0020:
2543: case 0x0024:
2544: {
2545: int p = (aa - 0x0018) >> 2;
2546: CRTC.crtR12GrXPort[p] = d & (p == 0 ? 0x03ff : 0x01ff);
2547: int curr = CRTC.crtR12GrXMask[p] == 0 ? CRTC.crtR12GrXPort[p] : CRTC.crtR12GrXTest[p];
2548: if (CRTC.crtR12GrXCurr[p] != curr) {
2549: CRTC.crtR12GrXCurr[p] = curr;
2550: CRTC.crtAllStamp += 2;
2551: }
2552: }
2553: return;
2554: case 0x001a:
2555: case 0x001e:
2556: case 0x0022:
2557: case 0x0026:
2558: {
2559: int p = (aa - 0x0018) >> 2;
2560: CRTC.crtR13GrYPort[p] = d & (p == 0 ? 0x03ff : 0x01ff);
2561: int curr = CRTC.crtR13GrYMask[p] == 0 ? CRTC.crtR13GrYPort[p] : CRTC.crtR13GrYTest[p];
2562: if (CRTC.crtR13GrYCurr[p] != curr) {
2563: CRTC.crtR13GrYCurr[p] = curr;
2564:
2565: }
2566: }
2567: return;
2568: case 0x0028:
2569: CRTC.crtSetMemoryMode (d >> 12, d >> 11, d >> 8);
2570: CRTC.crtHighResoPort = d >>> 4 & 1;
2571: CRTC.crtVResoPort = d >>> 2 & 3;
2572: CRTC.crtHResoPort = d & 3;
2573: SpriteScreen.sprAccessible = (d & 0b10010) != 0b10010;
2574: int highResoCurr = CRTC.crtHighResoMask == 0 ? CRTC.crtHighResoPort : CRTC.crtHighResoTest;
2575: int vResoCurr = CRTC.crtVResoMask == 0 ? CRTC.crtVResoPort : CRTC.crtVResoTest;
2576: int hResoCurr = CRTC.crtHResoMask == 0 ? CRTC.crtHResoPort : CRTC.crtHResoTest;
2577: if (CRTC.crtHighResoCurr != highResoCurr ||
2578: CRTC.crtVResoCurr != vResoCurr ||
2579: CRTC.crtHResoCurr != hResoCurr) {
2580: CRTC.crtHighResoCurr = highResoCurr;
2581: CRTC.crtVResoCurr = vResoCurr;
2582: CRTC.crtHResoCurr = hResoCurr;
2583: CRTC.crtRestart ();
2584: }
2585: return;
2586: case 0x002a:
2587: CRTC.crtBitMask = d << 22 < 0;
2588: CRTC.crtSimAccess = d << 23 < 0;
2589: CRTC.crtSimPlane3 = (byte) d < 0;
2590: CRTC.crtSimPlane2 = d << 25 < 0;
2591: CRTC.crtSimPlane1 = d << 26 < 0;
2592: CRTC.crtSimPlane0 = d << 27 < 0;
2593: CRTC.crtCCPlane3 = XEiJ.TEST_BIT_3_SHIFT ? d << 31 - 3 < 0 : (d & 8) != 0;
2594: CRTC.crtCCPlane2 = XEiJ.TEST_BIT_2_SHIFT ? d << 31 - 2 < 0 : (d & 4) != 0;
2595: CRTC.crtCCPlane1 = XEiJ.TEST_BIT_1_SHIFT ? d << 31 - 1 < 0 : (d & 2) != 0;
2596: CRTC.crtCCPlane0 = XEiJ.TEST_BIT_0_SHIFT ? d << 31 - 0 < 0 : (d & 1) != 0;
2597: return;
2598: case 0x002c:
2599: CRTC.crtR22SrcBlock = d >> 8 & 0xff;
2600: CRTC.crtR22DstBlock = d & 0xff;
2601: return;
2602: case 0x002e:
2603: CRTC.crtR23Mask = (char) d;
2604: return;
2605:
2606:
2607:
2608:
2609:
2610:
2611:
2612:
2613: default:
2614: return;
2615: }
2616: } else {
2617: aa &= 0xff;
2618: if (aa < 0x80) {
2619: super.mmdWw (a, d);
2620: } else {
2621: boolean rasterCopyOn = (d & 8) != 0;
2622: if (CRTC.crtRasterCopyOn != rasterCopyOn) {
2623: CRTC.crtRasterCopyOn = rasterCopyOn;
2624: if (CRTC.CRT_RASTER_HASH_ON) {
2625: CRTC.crtUpdateRasterHash ();
2626: }
2627: }
2628: CRTC.crtClearStandby = (d & 2) != 0;
2629: return;
2630: }
2631: }
2632: }
2633: @Override protected void mmdWl (int a, int d) throws M68kException {
2634: mmdWw (a , d >> 16);
2635: mmdWw (a + 2, d );
2636: }
2637: },
2638:
2639:
2640:
2641:
2642:
2643:
2644:
2645:
2646:
2647:
2648:
2649:
2650:
2651:
2652:
2653: MMD_VCN {
2654: @Override public String toString () {
2655: return Multilingual.mlnJapanese ? "ビデオコントローラ" : "Video Controller";
2656: }
2657:
2658: @Override protected int mmdRbz (int a) throws M68kException {
2659: int aa = a & 0x1fff;
2660: if (aa < 0x0400) {
2661: XEiJ.mpuClockTime += XEiJ.busWaitTime.palet;
2662: int d = (aa < 0x0200 ? VideoController.vcnPal16G8[aa >> 1] :
2663: VideoController.vcnPal16TS[(aa - 0x0200) >> 1]);
2664: return (aa & 1) == 0 ? d >> 8 : d & 0xff;
2665: } else {
2666: XEiJ.mpuClockTime += XEiJ.busWaitTime.vicon;
2667: int d = (aa < 0x0500 ? VideoController.vcnReg1Port :
2668: aa < 0x0600 ? VideoController.vcnReg2Port :
2669: aa < 0x0700 ? VideoController.vcnReg3Port :
2670: 0);
2671: return (aa & 1) == 0 ? d >> 8 : d & 0xff;
2672: }
2673: }
2674: @Override protected int mmdRwz (int a) throws M68kException {
2675: int aa = a & 0x1fff;
2676: if (aa < 0x0400) {
2677: XEiJ.mpuClockTime += XEiJ.busWaitTime.palet;
2678: return (aa < 0x0200 ? VideoController.vcnPal16G8[aa >> 1] :
2679: VideoController.vcnPal16TS[(aa - 0x0200) >> 1]);
2680: } else {
2681: XEiJ.mpuClockTime += XEiJ.busWaitTime.vicon;
2682: return (aa < 0x0500 ? VideoController.vcnReg1Port :
2683: aa < 0x0600 ? VideoController.vcnReg2Port :
2684: aa < 0x0700 ? VideoController.vcnReg3Port :
2685: 0);
2686: }
2687: }
2688: @Override protected int mmdRls (int a) throws M68kException {
2689: return mmdRwz (a) << 16 | mmdRwz (a + 2);
2690: }
2691:
2692: @Override protected void mmdWb (int a, int d) throws M68kException {
2693: int aa = a & 0x1fff;
2694: if (aa < 0x0200) {
2695: XEiJ.mpuClockTime += XEiJ.busWaitTime.palet;
2696: d &= 0xff;
2697: int n = aa >> 1;
2698: if ((aa & 1) == 0) {
2699: VideoController.vcnPal32G8[n] = VideoController.vcnPalTbl[
2700: VideoController.vcnPal16G8[n] = d << 8 | (VideoController.vcnPal16G8[n] & 0xff)
2701: ];
2702: if ((n & 1) == 0) {
2703: VideoController.vcnPal8G16L[n] = d;
2704: } else {
2705: VideoController.vcnPal8G16H[n - 1] = d << 8;
2706: }
2707: } else {
2708: VideoController.vcnPal32G8[n] = VideoController.vcnPalTbl[
2709: VideoController.vcnPal16G8[n] = (VideoController.vcnPal16G8[n] & ~0xff) | d
2710: ];
2711: if ((n & 1) == 0) {
2712: VideoController.vcnPal8G16L[n + 1] = d;
2713: } else {
2714: VideoController.vcnPal8G16H[n] = d << 8;
2715: }
2716: }
2717: if ((VideoController.vcnReg3Curr & 0x001f) != 0) {
2718: CRTC.crtAllStamp += 2;
2719: }
2720: } else if (aa < 0x0400) {
2721: XEiJ.mpuClockTime += XEiJ.busWaitTime.palet;
2722: d &= 0xff;
2723: int n = (aa - 0x0200) >> 1;
2724: VideoController.vcnPal32TS[n] = VideoController.vcnPalTbl[
2725: VideoController.vcnPal16TS[n] = ((aa & 1) == 0 ?
2726: d << 8 | (VideoController.vcnPal16TS[n] & 0xff) :
2727: (VideoController.vcnPal16TS[n] & ~0xff) | d)
2728: ];
2729: if ((VideoController.vcnReg3Curr << 31 - 6 < 0 && SpriteScreen.sprReg4BgCtrlCurr << 31 - 9 < 0) ||
2730: (VideoController.vcnReg3Curr << 31 - 5 < 0 && n < 16)) {
2731: CRTC.crtAllStamp += 2;
2732: }
2733: } else if (aa < 0x0500) {
2734: XEiJ.mpuClockTime += XEiJ.busWaitTime.vicon;
2735: d = (aa & 1) == 0 ? 0x00 : d & 0x07;
2736: if (VideoController.vcnReg1Port != d) {
2737: VideoController.vcnReg1Port = d;
2738: VideoController.vcnReg1Curr = ((VideoController.vcnReg1Port & ~VideoController.vcnReg1Mask) |
2739: (VideoController.vcnReg1Test & VideoController.vcnReg1Mask));
2740: VideoController.vcnUpdateMode ();
2741: }
2742: } else if (aa < 0x0600) {
2743: XEiJ.mpuClockTime += XEiJ.busWaitTime.vicon;
2744: d = ((aa & 1) == 0 ?
2745: (d & 0x3f) << 8 | (VideoController.vcnReg2Port & 0xff) :
2746: (VideoController.vcnReg2Port & ~0xff) | (d & 0xff));
2747: if (VideoController.vcnReg2Port != d) {
2748: VideoController.vcnReg2Port = d;
2749: VideoController.vcnReg2Curr = ((VideoController.vcnReg2Port & ~VideoController.vcnReg2Mask) |
2750: (VideoController.vcnReg2Test & VideoController.vcnReg2Mask));
2751: VideoController.vcnUpdateMode ();
2752: }
2753: } else if (aa < 0x0700) {
2754: XEiJ.mpuClockTime += XEiJ.busWaitTime.vicon;
2755: d = ((aa & 1) == 0 ?
2756: (d & 0xff) << 8 | (VideoController.vcnReg3Port & 0xff) :
2757: (VideoController.vcnReg3Port & ~0xff) | (d & 0xff));
2758: if (VideoController.vcnReg3Port != d) {
2759: VideoController.vcnReg3Port = d;
2760: VideoController.vcnReg3Curr = ((VideoController.vcnReg3Port & ~VideoController.vcnReg3Mask) |
2761: (VideoController.vcnReg3Test & VideoController.vcnReg3Mask));
2762: VideoController.vcnUpdateMode ();
2763: }
2764: } else {
2765: XEiJ.mpuClockTime += XEiJ.busWaitTime.vicon;
2766: }
2767: }
2768: @Override protected void mmdWw (int a, int d) throws M68kException {
2769: int aa = a & 0x1fff;
2770: if (aa < 0x0200) {
2771: XEiJ.mpuClockTime += XEiJ.busWaitTime.palet;
2772: int n = aa >> 1;
2773: VideoController.vcnPal32G8[n] = VideoController.vcnPalTbl[
2774: VideoController.vcnPal16G8[n] = (char) d
2775: ];
2776: if ((n & 1) == 0) {
2777: VideoController.vcnPal8G16L[n] = d >> 8 & 0xff;
2778: VideoController.vcnPal8G16L[n + 1] = d & 0xff;
2779: } else {
2780: VideoController.vcnPal8G16H[n - 1] = d & 0xff00;
2781: VideoController.vcnPal8G16H[n] = (d & 0xff) << 8;
2782: }
2783: if ((VideoController.vcnReg3Curr & 0x001f) != 0) {
2784: CRTC.crtAllStamp += 2;
2785: }
2786: } else if (aa < 0x0400) {
2787: XEiJ.mpuClockTime += XEiJ.busWaitTime.palet;
2788: int n = (aa - 0x0200) >> 1;
2789: VideoController.vcnPal32TS[n] = VideoController.vcnPalTbl[
2790: VideoController.vcnPal16TS[n] = (char) d
2791: ];
2792: if ((VideoController.vcnReg3Curr << 31 - 6 < 0 && SpriteScreen.sprReg4BgCtrlCurr << 31 - 9 < 0) ||
2793: (VideoController.vcnReg3Curr << 31 - 5 < 0 && n < 16)) {
2794: CRTC.crtAllStamp += 2;
2795: }
2796: } else if (aa < 0x0500) {
2797: XEiJ.mpuClockTime += XEiJ.busWaitTime.vicon;
2798: d &= 0x0007;
2799: if (VideoController.vcnReg1Port != d) {
2800: VideoController.vcnReg1Port = d;
2801: VideoController.vcnReg1Curr = ((VideoController.vcnReg1Port & ~VideoController.vcnReg1Mask) |
2802: (VideoController.vcnReg1Test & VideoController.vcnReg1Mask));
2803: VideoController.vcnUpdateMode ();
2804: }
2805: } else if (aa < 0x0600) {
2806: XEiJ.mpuClockTime += XEiJ.busWaitTime.vicon;
2807: d &= 0x3fff;
2808: if (VideoController.vcnReg2Port != d) {
2809: VideoController.vcnReg2Port = d;
2810: VideoController.vcnReg2Curr = ((VideoController.vcnReg2Port & ~VideoController.vcnReg2Mask) |
2811: (VideoController.vcnReg2Test & VideoController.vcnReg2Mask));
2812: VideoController.vcnUpdateMode ();
2813: }
2814: } else if (aa < 0x0700) {
2815: XEiJ.mpuClockTime += XEiJ.busWaitTime.vicon;
2816: d &= 0xffff;
2817: if (VideoController.vcnReg3Port != d) {
2818: VideoController.vcnReg3Port = d;
2819: VideoController.vcnReg3Curr = ((VideoController.vcnReg3Port & ~VideoController.vcnReg3Mask) |
2820: (VideoController.vcnReg3Test & VideoController.vcnReg3Mask));
2821: VideoController.vcnUpdateMode ();
2822: }
2823: } else {
2824: XEiJ.mpuClockTime += XEiJ.busWaitTime.vicon;
2825: }
2826: }
2827: @Override protected void mmdWl (int a, int d) throws M68kException {
2828: mmdWw (a , d >> 16);
2829: mmdWw (a + 2, d );
2830: }
2831: },
2832:
2833:
2834:
2835:
2836:
2837:
2838:
2839:
2840:
2841:
2842: MMD_DMA {
2843: @Override public String toString () {
2844: return Multilingual.mlnJapanese ? "DMA コントローラ" : "DMA Controller";
2845: }
2846:
2847: @Override protected int mmdRbz (int a) throws M68kException {
2848: XEiJ.mpuClockTime += XEiJ.busWaitTime.dmac;
2849: return HD63450.dmaReadByte (a);
2850: }
2851: @Override protected int mmdRwz (int a) throws M68kException {
2852: XEiJ.mpuClockTime += XEiJ.busWaitTime.dmac;
2853: return HD63450.dmaReadWord (a);
2854: }
2855: @Override protected int mmdRls (int a) throws M68kException {
2856: XEiJ.mpuClockTime += XEiJ.busWaitTime.dmac * 2;
2857: return HD63450.dmaReadLong (a);
2858: }
2859:
2860: @Override protected void mmdWb (int a, int d) throws M68kException {
2861: XEiJ.mpuClockTime += XEiJ.busWaitTime.dmac;
2862: HD63450.dmaWriteByte (a, d);
2863: return;
2864: }
2865: @Override protected void mmdWw (int a, int d) throws M68kException {
2866: XEiJ.mpuClockTime += XEiJ.busWaitTime.dmac;
2867: HD63450.dmaWriteWord (a, d);
2868: return;
2869: }
2870: @Override protected void mmdWl (int a, int d) throws M68kException {
2871: XEiJ.mpuClockTime += XEiJ.busWaitTime.dmac * 2;
2872: HD63450.dmaWriteLong (a, d);
2873: return;
2874: }
2875: },
2876:
2877:
2878:
2879:
2880:
2881:
2882:
2883:
2884: MMD_SVS {
2885: @Override public String toString () {
2886: return Multilingual.mlnJapanese ? "スーパーバイザ領域設定" : "Supervisor Area Setting";
2887: }
2888:
2889: @Override protected void mmdWb (int a, int d) throws M68kException {
2890: if ((a & 1) == 0) {
2891: super.mmdWb (a, d);
2892: } else {
2893: XEiJ.mpuClockTime += XEiJ.busWaitTime.sysport;
2894: MainMemory.mmrSetSupervisorArea (d);
2895: }
2896: }
2897: @Override protected void mmdWw (int a, int d) throws M68kException {
2898: mmdWb (a + 1, d);
2899: }
2900: @Override protected void mmdWl (int a, int d) throws M68kException {
2901: mmdWw (a, d >> 16);
2902: mmdWw (a + 2, d);
2903: }
2904: },
2905:
2906:
2907:
2908:
2909:
2910:
2911:
2912:
2913: MMD_MFP {
2914: @Override public String toString () {
2915: return Multilingual.mlnJapanese ? "MFP" : "MFP";
2916: }
2917:
2918: @Override protected int mmdPbz (int a) {
2919: return MC68901.mfpPeekByte (a);
2920: }
2921:
2922: @Override protected int mmdRbz (int a) throws M68kException {
2923: return MC68901.mfpReadByte (a);
2924: }
2925: @Override protected int mmdRwz (int a) throws M68kException {
2926: return 0xff00 | mmdRbz (a + 1);
2927: }
2928: @Override protected int mmdRls (int a) throws M68kException {
2929: return mmdRwz (a) << 16 | mmdRwz (a + 2);
2930: }
2931:
2932: @Override protected void mmdWb (int a, int d) throws M68kException {
2933: MC68901.mfpWriteByte (a, d);
2934: }
2935: @Override protected void mmdWw (int a, int d) throws M68kException {
2936: mmdWb (a + 1, d);
2937: }
2938: @Override protected void mmdWl (int a, int d) throws M68kException {
2939: mmdWw (a, d >> 16);
2940: mmdWw (a + 2, d);
2941: }
2942: },
2943:
2944:
2945:
2946:
2947:
2948:
2949:
2950:
2951: MMD_RTC_FIRST {
2952: @Override public String toString () {
2953: return Multilingual.mlnJapanese ? "RTC" : "RTC";
2954: }
2955:
2956: @Override protected byte mmdPbs (int a) {
2957: return (byte) RP5C15.rtcPeekByte (a);
2958: }
2959: @Override protected int mmdPbz (int a) {
2960: return RP5C15.rtcPeekByte (a);
2961: }
2962: @Override protected int mmdPws (int a) {
2963: return RP5C15.rtcPeekByte (a + 1);
2964: }
2965: @Override protected int mmdPwz (int a) {
2966: return RP5C15.rtcPeekByte (a + 1);
2967: }
2968: @Override protected int mmdPls (int a) {
2969: return (RP5C15.rtcPeekByte (a + 1) << 16 |
2970: RP5C15.rtcPeekByte (a + 3));
2971: }
2972:
2973: @Override protected byte mmdRbs (int a) throws M68kException {
2974: if ((a & 1) == 0 &&
2975: !XEiJ.currentIsSecond) {
2976: return super.mmdRbs (a);
2977: }
2978: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
2979: XEiJ.busSuper (MemoryMappedDevice.MMD_RTC_NEXT, 0x00e8a000, 0x00e8c000);
2980: RP5C15.rtcUpdate ();
2981: return (byte) RP5C15.rtcReadByte (a);
2982: }
2983: @Override protected int mmdRbz (int a) throws M68kException {
2984: if ((a & 1) == 0 &&
2985: !XEiJ.currentIsSecond) {
2986: return super.mmdRbz (a);
2987: }
2988: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
2989: XEiJ.busSuper (MemoryMappedDevice.MMD_RTC_NEXT, 0x00e8a000, 0x00e8c000);
2990: RP5C15.rtcUpdate ();
2991: return RP5C15.rtcReadByte (a);
2992: }
2993: @Override protected int mmdRws (int a) throws M68kException {
2994: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
2995: XEiJ.busSuper (MemoryMappedDevice.MMD_RTC_NEXT, 0x00e8a000, 0x00e8c000);
2996: RP5C15.rtcUpdate ();
2997: return RP5C15.rtcReadByte (a + 1);
2998: }
2999: @Override protected int mmdRwz (int a) throws M68kException {
3000: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3001: XEiJ.busSuper (MemoryMappedDevice.MMD_RTC_NEXT, 0x00e8a000, 0x00e8c000);
3002: RP5C15.rtcUpdate ();
3003: return RP5C15.rtcReadByte (a + 1);
3004: }
3005: @Override protected int mmdRls (int a) throws M68kException {
3006: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc * 2;
3007: XEiJ.busSuper (MemoryMappedDevice.MMD_RTC_NEXT, 0x00e8a000, 0x00e8c000);
3008: RP5C15.rtcUpdate ();
3009: return (RP5C15.rtcReadByte (a + 1) << 16 |
3010: RP5C15.rtcReadByte (a + 3));
3011: }
3012:
3013: @Override protected void mmdWb (int a, int d) throws M68kException {
3014: if ((a & 1) == 0 &&
3015: !XEiJ.currentIsSecond) {
3016: super.mmdWb (a, d);
3017: }
3018: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3019: XEiJ.busSuper (MemoryMappedDevice.MMD_RTC_NEXT, 0x00e8a000, 0x00e8c000);
3020: RP5C15.rtcUpdate ();
3021: RP5C15.rtcWriteByte (a, d);
3022: }
3023: @Override protected void mmdWw (int a, int d) throws M68kException {
3024: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3025: XEiJ.busSuper (MemoryMappedDevice.MMD_RTC_NEXT, 0x00e8a000, 0x00e8c000);
3026: RP5C15.rtcUpdate ();
3027: RP5C15.rtcWriteByte (a + 1, d);
3028: }
3029: @Override protected void mmdWl (int a, int d) throws M68kException {
3030: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc * 2;
3031: XEiJ.busSuper (MemoryMappedDevice.MMD_RTC_NEXT, 0x00e8a000, 0x00e8c000);
3032: RP5C15.rtcUpdate ();
3033: RP5C15.rtcWriteByte (a + 1, d >> 16);
3034: RP5C15.rtcWriteByte (a + 3, d);
3035: }
3036: },
3037:
3038:
3039:
3040: MMD_RTC_NEXT {
3041: @Override public String toString () {
3042: return Multilingual.mlnJapanese ? "RTC" : "RTC";
3043: }
3044:
3045: @Override protected byte mmdPbs (int a) {
3046: return (byte) RP5C15.rtcPeekByte (a);
3047: }
3048: @Override protected int mmdPbz (int a) {
3049: return RP5C15.rtcPeekByte (a);
3050: }
3051: @Override protected int mmdPws (int a) {
3052: return RP5C15.rtcPeekByte (a + 1);
3053: }
3054: @Override protected int mmdPwz (int a) {
3055: return RP5C15.rtcPeekByte (a + 1);
3056: }
3057: @Override protected int mmdPls (int a) {
3058: return (RP5C15.rtcPeekByte (a + 1) << 16 |
3059: RP5C15.rtcPeekByte (a + 3));
3060: }
3061:
3062: @Override protected byte mmdRbs (int a) throws M68kException {
3063: if ((a & 1) == 0 &&
3064: !XEiJ.currentIsSecond) {
3065: return super.mmdRbs (a);
3066: }
3067: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3068: return (byte) RP5C15.rtcReadByte (a);
3069: }
3070: @Override protected int mmdRbz (int a) throws M68kException {
3071: if ((a & 1) == 0 &&
3072: !XEiJ.currentIsSecond) {
3073: return super.mmdRbz (a);
3074: }
3075: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3076: return RP5C15.rtcReadByte (a);
3077: }
3078: @Override protected int mmdRws (int a) throws M68kException {
3079: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3080: return RP5C15.rtcReadByte (a + 1);
3081: }
3082: @Override protected int mmdRwz (int a) throws M68kException {
3083: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3084: return RP5C15.rtcReadByte (a + 1);
3085: }
3086: @Override protected int mmdRls (int a) throws M68kException {
3087: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc * 2;
3088: return (RP5C15.rtcReadByte (a + 1) << 16 |
3089: RP5C15.rtcReadByte (a + 3));
3090: }
3091:
3092: @Override protected void mmdWb (int a, int d) throws M68kException {
3093: if ((a & 1) == 0 &&
3094: !XEiJ.currentIsSecond) {
3095: super.mmdWb (a, d);
3096: }
3097: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3098: RP5C15.rtcWriteByte (a, d);
3099: }
3100: @Override protected void mmdWw (int a, int d) throws M68kException {
3101: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3102: RP5C15.rtcWriteByte (a + 1, d);
3103: }
3104: @Override protected void mmdWl (int a, int d) throws M68kException {
3105: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc * 2;
3106: RP5C15.rtcWriteByte (a + 1, d >> 16);
3107: RP5C15.rtcWriteByte (a + 3, d);
3108: }
3109: },
3110:
3111:
3112:
3113: MMD_RTC_TEST {
3114: @Override public String toString () {
3115: return Multilingual.mlnJapanese ? "RTC テスト" : "RTC test";
3116: }
3117:
3118: @Override protected byte mmdPbs (int a) {
3119: return (byte) RP5C15.rtcPeekByte (a);
3120: }
3121: @Override protected int mmdPbz (int a) {
3122: return RP5C15.rtcPeekByte (a);
3123: }
3124: @Override protected int mmdPws (int a) {
3125: return RP5C15.rtcPeekByte (a + 1);
3126: }
3127: @Override protected int mmdPwz (int a) {
3128: return RP5C15.rtcPeekByte (a + 1);
3129: }
3130: @Override protected int mmdPls (int a) {
3131: return (RP5C15.rtcPeekByte (a + 1) << 16 |
3132: RP5C15.rtcPeekByte (a + 3));
3133: }
3134:
3135: @Override protected byte mmdRbs (int a) throws M68kException {
3136: if ((a & 1) == 0 &&
3137: !XEiJ.currentIsSecond) {
3138: return super.mmdRbs (a);
3139: }
3140: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3141: RP5C15.rtcTestUpdate ();
3142: return (byte) RP5C15.rtcReadByte (a);
3143: }
3144: @Override protected int mmdRbz (int a) throws M68kException {
3145: if ((a & 1) == 0 &&
3146: !XEiJ.currentIsSecond) {
3147: return super.mmdRbz (a);
3148: }
3149: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3150: RP5C15.rtcTestUpdate ();
3151: return RP5C15.rtcReadByte (a);
3152: }
3153: @Override protected int mmdRws (int a) throws M68kException {
3154: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3155: RP5C15.rtcTestUpdate ();
3156: return RP5C15.rtcReadByte (a + 1);
3157: }
3158: @Override protected int mmdRwz (int a) throws M68kException {
3159: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3160: RP5C15.rtcTestUpdate ();
3161: return RP5C15.rtcReadByte (a + 1);
3162: }
3163: @Override protected int mmdRls (int a) throws M68kException {
3164: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc * 2;
3165: RP5C15.rtcTestUpdate ();
3166: return (RP5C15.rtcReadByte (a + 1) << 16 |
3167: RP5C15.rtcReadByte (a + 3));
3168: }
3169:
3170: @Override protected void mmdWb (int a, int d) throws M68kException {
3171: if ((a & 1) == 0 &&
3172: !XEiJ.currentIsSecond) {
3173: super.mmdWb (a, d);
3174: }
3175: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3176: RP5C15.rtcTestUpdate ();
3177: RP5C15.rtcWriteByte (a, d);
3178: }
3179: @Override protected void mmdWw (int a, int d) throws M68kException {
3180: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc;
3181: RP5C15.rtcTestUpdate ();
3182: RP5C15.rtcWriteByte (a + 1, d);
3183: }
3184: @Override protected void mmdWl (int a, int d) throws M68kException {
3185: XEiJ.mpuClockTime += XEiJ.busWaitTime.rtc * 2;
3186: RP5C15.rtcTestUpdate ();
3187: RP5C15.rtcWriteByte (a + 1, d >> 16);
3188: RP5C15.rtcWriteByte (a + 3, d);
3189: }
3190: },
3191:
3192:
3193:
3194:
3195:
3196:
3197:
3198:
3199: MMD_PRN {
3200: @Override public String toString () {
3201: return Multilingual.mlnJapanese ? "プリンタポート" : "Printer Port";
3202: }
3203:
3204: @Override protected int mmdRbz (int a) throws M68kException {
3205: XEiJ.mpuClockTime += XEiJ.busWaitTime.prnport;
3206: a &= 3;
3207: return (a == (PrinterPort.PRN_DATA & 3) ? PrinterPort.prnReadData () :
3208: a == (PrinterPort.PRN_STROBE & 3) ? PrinterPort.prnReadStrobe () :
3209: 0xff);
3210: }
3211: @Override protected int mmdRwz (int a) throws M68kException {
3212: return 0xff00 | mmdRbz (a + 1);
3213: }
3214: @Override protected int mmdRls (int a) throws M68kException {
3215: return 0xff00ff00 | mmdRbz (a + 1) << 16 | mmdRbz (a + 3);
3216: }
3217:
3218: @Override protected void mmdWb (int a, int d) throws M68kException {
3219: XEiJ.mpuClockTime += XEiJ.busWaitTime.prnport;
3220: a &= 3;
3221: if (a == (PrinterPort.PRN_DATA & 3)) {
3222: PrinterPort.prnWriteData (d);
3223: } else if (a == (PrinterPort.PRN_STROBE & 3)) {
3224: PrinterPort.prnWriteStrobe (d);
3225: }
3226: }
3227: @Override protected void mmdWw (int a, int d) throws M68kException {
3228: mmdWb (a + 1, d);
3229: }
3230: @Override protected void mmdWl (int a, int d) throws M68kException {
3231: mmdWb (a + 1, d >> 16);
3232: mmdWb (a + 3, d);
3233: }
3234: },
3235:
3236:
3237:
3238:
3239:
3240:
3241:
3242:
3243: MMD_SYS {
3244: @Override public String toString () {
3245: return Multilingual.mlnJapanese ? "システムポート" : "System Port";
3246: }
3247:
3248: @Override protected int mmdRbz (int a) throws M68kException {
3249: XEiJ.mpuClockTime += XEiJ.busWaitTime.sysport;
3250: switch (a & 15) {
3251: case 0x01:
3252: return 0b11110000 | VideoController.vcnTargetContrastPort;
3253: case 0x03:
3254: return 0b11111000 | XEiJ.pnlStereoscopicShutter;
3255: case 0x07:
3256: return 0b11110100 | (Keyboard.kbdOn ? 8 : 0) | CRTC.crtHRLPort << 1;
3257: case 0x0b:
3258: return (XEiJ.currentModel.isX68030 () ? 0xdc :
3259: XEiJ.currentMPU < Model.MPU_MC68020 ?
3260: XEiJ.mpuClockMHz <= 10.0 ? 0xff : 0xfe :
3261: XEiJ.mpuClockMHz <= 20.0 ? 0xff : 0xfe);
3262: }
3263: return 0xff;
3264: }
3265: @Override protected int mmdRwz (int a) throws M68kException {
3266: return 0xff00 | mmdRbz (a + 1);
3267: }
3268: @Override protected int mmdRls (int a) throws M68kException {
3269: return 0xff00ff00 | mmdRbz (a + 1) << 16 | mmdRbz (a + 3);
3270: }
3271:
3272: @Override protected void mmdWb (int a, int d) throws M68kException {
3273: d &= 0xff;
3274: switch (a & 15) {
3275: case 0x01:
3276: VideoController.vcnTargetContrastPort = d & 15;
3277: {
3278: int curr = VideoController.vcnTargetContrastMask == 0 ? VideoController.vcnTargetContrastPort : VideoController.vcnTargetContrastTest;
3279: if (VideoController.vcnTargetContrastCurr != curr) {
3280: VideoController.vcnTargetContrastCurr = curr;
3281: VideoController.vcnTargetScaledContrast = VideoController.VCN_CONTRAST_SCALE * VideoController.vcnTargetContrastCurr;
3282: CRTC.crtContrastClock = XEiJ.mpuClockTime;
3283: CRTC.crtFrameTaskClock = Math.min (CRTC.crtContrastClock, CRTC.crtCaptureClock);
3284: }
3285: }
3286: return;
3287: case 0x03:
3288: XEiJ.pnlStereoscopicShutter = d & 3;
3289: break;
3290: case 0x07:
3291: {
3292: CRTC.crtHRLPort = d >> 1 & 1;
3293: int curr = CRTC.crtHRLMask == 0 ? CRTC.crtHRLPort : CRTC.crtHRLTest;
3294: if (CRTC.crtHRLCurr != curr) {
3295: CRTC.crtHRLCurr = curr;
3296: CRTC.crtRestart ();
3297: }
3298: if ((d & 1 << 2) != 0) {
3299: XEiJ.sysResetNMI ();
3300: }
3301: }
3302: return;
3303: case 0x09:
3304: if (XEiJ.currentModel.isX68030 ()) {
3305:
3306:
3307:
3308:
3309:
3310:
3311:
3312:
3313:
3314:
3315:
3316: if (XEiJ.currentModel.isX68030 ()) {
3317: XEiJ.mpuROMWaitCycles = (d >> 4 & 15) + 2;
3318: XEiJ.mpuRAMWaitCycles = (d & 15) == 0 ? 0 : (d & 15) + 2;
3319: XEiJ.mpuSetWait ();
3320: }
3321: }
3322: return;
3323: case 0x0d:
3324: SRAM.smrWriteEnableOn = d == 0x31;
3325: return;
3326: }
3327: }
3328: @Override protected void mmdWw (int a, int d) throws M68kException {
3329: mmdWb (a + 1, d);
3330: }
3331: @Override protected void mmdWl (int a, int d) throws M68kException {
3332: mmdWb (a + 1, d >> 16);
3333: mmdWb (a + 3, d);
3334: }
3335: },
3336:
3337:
3338:
3339:
3340:
3341:
3342:
3343:
3344:
3345:
3346: MMD_OPM {
3347: @Override public String toString () {
3348: return Multilingual.mlnJapanese ? "FM 音源" : "FM Sound Generator";
3349: }
3350:
3351: @Override protected int mmdRbz (int a) throws M68kException {
3352: if ((a & 1) == 0 &&
3353: !XEiJ.currentIsSecond) {
3354: return super.mmdRbz (a);
3355: }
3356: XEiJ.mpuClockTime += XEiJ.busWaitTime.opm;
3357: return (a & 3) == 3 ? OPM.opmYM2151.readStatus () : 0xff;
3358: }
3359: @Override protected int mmdRwz (int a) throws M68kException {
3360: return 0xff00 | mmdRbz (a + 1);
3361: }
3362: @Override protected int mmdRls (int a) throws M68kException {
3363: return 0xff00ff00 | mmdRbz (a + 1) << 16 | mmdRbz (a + 3);
3364: }
3365:
3366: @Override protected void mmdWb (int a, int d) throws M68kException {
3367: if ((a & 1) == 0 &&
3368: !XEiJ.currentIsSecond) {
3369: super.mmdWb (a, d);
3370: }
3371: XEiJ.mpuClockTime += XEiJ.busWaitTime.opm;
3372: a &= XEiJ.BUS_MOTHER_MASK;
3373: a &= 3;
3374: d &= 0xff;
3375: if (a == 3) {
3376: OPM.opmYM2151.generate (SoundSource.SND_CHANNELS *
3377: (OPM.OPM_BLOCK_SAMPLES - Math.max (0, (int) ((double) (SoundSource.sndBlockClock - XEiJ.mpuClockTime) /
3378: (double) OPM.OPM_SAMPLE_TIME))));
3379: OPM.opmYM2151.writeData (d);
3380: } else if (a == 1) {
3381: OPM.opmYM2151.writeAddress (d);
3382: }
3383: }
3384: @Override protected void mmdWw (int a, int d) throws M68kException {
3385: mmdWb (a + 1, d);
3386: }
3387: @Override protected void mmdWl (int a, int d) throws M68kException {
3388: mmdWb (a + 1, d >> 16);
3389: mmdWb (a + 3, d);
3390: }
3391: },
3392:
3393:
3394:
3395:
3396:
3397:
3398:
3399:
3400: MMD_PCM {
3401: @Override public String toString () {
3402: return Multilingual.mlnJapanese ? "ADPCM 音源" : "ADPCM Sound Generator";
3403: }
3404:
3405: @Override protected int mmdRbz (int a) throws M68kException {
3406: if ((a & 1) == 0 &&
3407: !XEiJ.currentIsSecond) {
3408: return super.mmdRbz (a);
3409: }
3410: XEiJ.mpuClockTime += XEiJ.busWaitTime.adpcm;
3411: return (a & 3) == 1 ? (ADPCM.pcmActive ? 0b10000000 : 0) | 0x40 : 0xff;
3412: }
3413: @Override protected int mmdRwz (int a) throws M68kException {
3414: return 0xff00 | mmdRbz (a + 1);
3415: }
3416: @Override protected int mmdRls (int a) throws M68kException {
3417: return 0xff00ff00 | mmdRbz (a + 1) << 16 | mmdRbz (a + 3);
3418: }
3419:
3420: @Override protected void mmdWb (int a, int d) throws M68kException {
3421: if ((a & 1) == 0 &&
3422: !XEiJ.currentIsSecond) {
3423: super.mmdWb (a, d);
3424: }
3425: XEiJ.mpuClockTime += XEiJ.busWaitTime.adpcm;
3426: a &= XEiJ.BUS_MOTHER_MASK;
3427: a &= 3;
3428: if (a == 1) {
3429: if ((d & 0b00000001) != 0) {
3430: if (ADPCM.pcmActive) {
3431: ADPCM.pcmClock = XEiJ.FAR_FUTURE;
3432: TickerQueue.tkqRemove (SoundSource.sndPcmTicker);
3433: ADPCM.pcmActive = false;
3434: ADPCM.pcmEncodedData = -1;
3435: ADPCM.pcmDecoderPointer = 0;
3436: HD63450.dmaRisePCL (3);
3437: }
3438: } else if ((d & 0b00000010) != 0) {
3439: if (!ADPCM.pcmActive) {
3440:
3441: int remainingSamples = Math.max (0, (int) ((double) (SoundSource.sndBlockClock - XEiJ.mpuClockTime) / (double) ADPCM.PCM_SAMPLE_TIME));
3442: ADPCM.pcmClock = SoundSource.sndBlockClock - ADPCM.PCM_SAMPLE_TIME * (long) remainingSamples;
3443: TickerQueue.tkqAdd (SoundSource.sndPcmTicker, ADPCM.pcmClock);
3444: ADPCM.pcmActive = true;
3445: int newPointer = SoundSource.SND_CHANNELS * (ADPCM.PCM_BLOCK_SAMPLES - remainingSamples);
3446: if (ADPCM.pcmPointer < newPointer) {
3447: ADPCM.pcmFillBuffer (newPointer);
3448: } else {
3449: ADPCM.pcmPointer = newPointer;
3450: }
3451:
3452: HD63450.dmaFallPCL (3);
3453: }
3454:
3455:
3456: }
3457: } else if (a == 3) {
3458: if (ADPCM.pcmActive) {
3459: ADPCM.pcmEncodedData = d & 0xff;
3460: HD63450.dmaRisePCL (3);
3461: }
3462: }
3463: }
3464: @Override protected void mmdWw (int a, int d) throws M68kException {
3465: mmdWb (a + 1, d);
3466: }
3467: @Override protected void mmdWl (int a, int d) throws M68kException {
3468: mmdWb (a + 1, d >> 16);
3469: mmdWb (a + 3, d);
3470: }
3471: },
3472:
3473:
3474:
3475:
3476:
3477:
3478:
3479:
3480: MMD_FDC {
3481: @Override public String toString () {
3482: return Multilingual.mlnJapanese ? "FD コントローラ" : "FD Controller";
3483: }
3484:
3485: @Override protected byte mmdPbs (int a) {
3486: return (byte) mmdPbz (a);
3487: }
3488: @Override protected int mmdPbz (int a) {
3489: a &= XEiJ.BUS_MOTHER_MASK;
3490: switch (a) {
3491: case FDC.FDC_STATUS_PORT:
3492: return FDC.fdcPeekStatus ();
3493: case FDC.FDC_DATA_PORT:
3494: return FDC.fdcPeekData ();
3495: case FDC.FDC_DRIVE_STATUS:
3496: return FDC.fdcPeekDriveStatus ();
3497: }
3498: return 0xff;
3499: }
3500: @Override protected int mmdPws (int a) {
3501: return (short) (mmdPbz (a) << 8 | mmdPbz (a + 1));
3502: }
3503: @Override protected int mmdPwz (int a) {
3504: return mmdPbz (a) << 8 | mmdPbz (a + 1);
3505: }
3506: @Override protected int mmdPls (int a) {
3507: return mmdPwz (a) << 16 | mmdPwz (a + 2);
3508: }
3509:
3510: @Override protected int mmdRbz (int a) throws M68kException {
3511: if ((a & 1) == 0 &&
3512: !XEiJ.currentIsSecond) {
3513: return super.mmdRbz (a);
3514: }
3515: XEiJ.mpuClockTime += XEiJ.busWaitTime.fdc;
3516: a &= XEiJ.BUS_MOTHER_MASK;
3517: switch (a) {
3518: case FDC.FDC_STATUS_PORT:
3519: return FDC.fdcReadStatus ();
3520: case FDC.FDC_DATA_PORT:
3521: return FDC.fdcReadData ();
3522: case FDC.FDC_DRIVE_STATUS:
3523: return FDC.fdcReadDriveStatus ();
3524: }
3525: return 0xff;
3526: }
3527: @Override protected int mmdRwz (int a) throws M68kException {
3528: return 0xff00 | mmdRbz (a + 1);
3529: }
3530: @Override protected int mmdRls (int a) throws M68kException {
3531: return 0xff00ff00 | mmdRbz (a + 1) << 16 | mmdRbz (a + 3);
3532: }
3533:
3534: @Override protected void mmdWb (int a, int d) throws M68kException {
3535: if ((a & 1) == 0 &&
3536: !XEiJ.currentIsSecond) {
3537: super.mmdWb (a, d);
3538: }
3539: XEiJ.mpuClockTime += XEiJ.busWaitTime.fdc;
3540: a &= XEiJ.BUS_MOTHER_MASK;
3541: switch (a) {
3542: case FDC.FDC_STATUS_PORT:
3543: FDC.fdcWriteCommand (d);
3544: break;
3545: case FDC.FDC_DATA_PORT:
3546: FDC.fdcWriteData (d);
3547: break;
3548: case FDC.FDC_DRIVE_STATUS:
3549: FDC.fdcWriteDriveControl (d);
3550: break;
3551: case FDC.FDC_DRIVE_SELECT:
3552: FDC.fdcWriteDriveSelect (d);
3553: break;
3554: }
3555: }
3556: @Override protected void mmdWw (int a, int d) throws M68kException {
3557: mmdWb (a + 1, d);
3558: }
3559: @Override protected void mmdWl (int a, int d) throws M68kException {
3560: mmdWb (a + 1, d >> 16);
3561: mmdWb (a + 3, d);
3562: }
3563: },
3564:
3565:
3566:
3567:
3568:
3569:
3570:
3571:
3572:
3573: MMD_HDC {
3574: @Override public String toString () {
3575: return Multilingual.mlnJapanese ? "内蔵 SASI/SCSI ポート" : "Internal SASI/SCSI Port";
3576: }
3577:
3578: @Override protected int mmdPbz (int a) {
3579: if ((a & 0x01) == 0) {
3580: return 0xff;
3581: } else {
3582: if (SPC.spcSCSIINOn) {
3583: if ((a & 0x20) == 0) {
3584: return ((a & 0x02) == 0 ? 0x00 : 0xff);
3585: } else {
3586: if (SUK.SUK_ON && SUK.sukOn && !SUK.sukExpansion) {
3587: return SUK.sukPeek (a);
3588: }
3589: return SPC.spcSCSIINChip.spiPeek (a);
3590: }
3591: } else {
3592: switch (a & 0x3f) {
3593: case HDC.HDC_DATA_PORT & 0x3f:
3594: return HDC.hdcPeekData ();
3595: case HDC.HDC_STATUS_PORT & 0x3f:
3596: return HDC.hdcPeekStatus ();
3597: case HDC.HDC_RESET_PORT & 0x3f:
3598: return 0xff;
3599: case HDC.HDC_SELECTION_PORT & 0x3f:
3600: return 0xff;
3601: default:
3602: return 0xff;
3603: }
3604: }
3605: }
3606: }
3607: @Override protected int mmdPwz (int a) {
3608: return 0xff00 | mmdPbz (a + 1);
3609: }
3610: @Override protected int mmdPls (int a) {
3611: return 0xff00ff00 | mmdPbz (a + 1) << 16 | mmdPbz (a + 3);
3612: }
3613:
3614: @Override protected int mmdRbz (int a) throws M68kException {
3615: XEiJ.mpuClockTime += XEiJ.busWaitTime.hdc;
3616: if ((a & 0x01) == 0) {
3617: if (XEiJ.currentIsSecond) {
3618: return 0xff;
3619: }
3620: return super.mmdRbz (a);
3621: } else {
3622: if (SPC.spcSCSIINOn) {
3623: if ((a & 0x20) == 0) {
3624: return ((a & 0x02) == 0 ? 0x00 : 0xff);
3625: } else {
3626: if (SUK.SUK_ON && SUK.sukOn && !SUK.sukExpansion) {
3627: return SUK.sukRead (a);
3628: }
3629: return SPC.spcSCSIINChip.spiRead (a);
3630: }
3631: } else {
3632: switch (a & 0x3f) {
3633: case HDC.HDC_DATA_PORT & 0x3f:
3634: return HDC.hdcReadData ();
3635: case HDC.HDC_STATUS_PORT & 0x3f:
3636: return HDC.hdcReadStatus ();
3637: case HDC.HDC_RESET_PORT & 0x3f:
3638: return 0xff;
3639: case HDC.HDC_SELECTION_PORT & 0x3f:
3640: return 0xff;
3641: default:
3642: return 0xff;
3643: }
3644: }
3645: }
3646: }
3647: @Override protected int mmdRwz (int a) throws M68kException {
3648: return 0xff00 | mmdRbz (a + 1);
3649: }
3650: @Override protected int mmdRls (int a) throws M68kException {
3651: return 0xff00ff00 | mmdRbz (a + 1) << 16 | mmdRbz (a + 3);
3652: }
3653:
3654: @Override protected void mmdWb (int a, int d) throws M68kException {
3655: XEiJ.mpuClockTime += XEiJ.busWaitTime.hdc;
3656: if ((a & 0x01) == 0) {
3657: if (XEiJ.currentIsSecond) {
3658: return;
3659: }
3660: super.mmdWb (a, d);
3661: } else {
3662: if (SPC.spcSCSIINOn) {
3663: if ((a & 0x20) == 0) {
3664: return;
3665: } else {
3666: if (SUK.SUK_ON && SUK.sukOn && !SUK.sukExpansion) {
3667: SUK.sukWrite (a, d);
3668: return;
3669: }
3670: SPC.spcSCSIINChip.spiWrite (a, d);
3671: return;
3672: }
3673: } else {
3674: switch (a & 0x3f) {
3675: case HDC.HDC_DATA_PORT & 0x3f:
3676: HDC.hdcWriteData (d);
3677: return;
3678: case HDC.HDC_STATUS_PORT & 0x3f:
3679: HDC.hdcWriteCommand (d);
3680: return;
3681: case HDC.HDC_RESET_PORT & 0x3f:
3682: HDC.hdcWriteReset (d);
3683: return;
3684: case HDC.HDC_SELECTION_PORT & 0x3f:
3685: HDC.hdcWriteSelect (d);
3686: return;
3687: default:
3688: return;
3689: }
3690: }
3691: }
3692: }
3693: @Override protected void mmdWw (int a, int d) throws M68kException {
3694: mmdWb (a + 1, d);
3695: }
3696: @Override protected void mmdWl (int a, int d) throws M68kException {
3697: mmdWb (a + 1, d >> 16);
3698: mmdWb (a + 3, d);
3699: }
3700: },
3701:
3702:
3703:
3704:
3705:
3706:
3707:
3708:
3709: MMD_SCC {
3710: @Override public String toString () {
3711: return Multilingual.mlnJapanese ? "SCC" : "SCC";
3712: }
3713:
3714: @Override protected int mmdPbz (int a) {
3715: return Z8530.sccReadByte (a, true);
3716: }
3717: @Override protected int mmdPwz (int a) {
3718: return 0xff00 | mmdPbz (a + 1);
3719: }
3720: @Override protected int mmdPls (int a) {
3721: return 0xff00ff00 | mmdPbz (a + 1) << 16 | mmdPbz (a + 3);
3722: }
3723:
3724: @Override protected int mmdRbz (int a) throws M68kException {
3725: if ((a & 1) == 0 &&
3726: !XEiJ.currentIsSecond) {
3727: return super.mmdRbz (a);
3728: }
3729: return Z8530.sccReadByte (a, false);
3730: }
3731: @Override protected int mmdRwz (int a) throws M68kException {
3732: return 0xff00 | mmdRbz (a + 1);
3733: }
3734: @Override protected int mmdRls (int a) throws M68kException {
3735: return 0xff00ff00 | mmdRbz (a + 1) << 16 | mmdRbz (a + 3);
3736: }
3737:
3738: @Override protected void mmdWb (int a, int d) throws M68kException {
3739: if ((a & 1) == 0 &&
3740: !XEiJ.currentIsSecond) {
3741: super.mmdWb (a, d);
3742: }
3743: Z8530.sccWriteByte (a, d);
3744: }
3745: @Override protected void mmdWw (int a, int d) throws M68kException {
3746: mmdWb (a + 1, d);
3747: }
3748: @Override protected void mmdWl (int a, int d) throws M68kException {
3749: mmdWb (a + 1, d >> 16);
3750: mmdWb (a + 3, d);
3751: }
3752: },
3753:
3754:
3755:
3756:
3757:
3758:
3759:
3760:
3761: MMD_PPI {
3762: @Override public String toString () {
3763: return Multilingual.mlnJapanese ? "PPI" : "PPI";
3764: }
3765:
3766: @Override protected int mmdRbz (int a) throws M68kException {
3767: if ((a & 1) == 0 &&
3768: !XEiJ.currentIsSecond) {
3769: return super.mmdRbz (a);
3770: }
3771: XEiJ.mpuClockTime += XEiJ.busWaitTime.ppi;
3772: return PPI.ppiReadByte (a);
3773: }
3774: @Override protected int mmdRwz (int a) throws M68kException {
3775: return 0xff00 | mmdRbz (a + 1);
3776: }
3777: @Override protected int mmdRls (int a) throws M68kException {
3778: return 0xff00ff00 | mmdRbz (a + 1) << 16 | mmdRbz (a + 3);
3779: }
3780:
3781: @Override protected void mmdWb (int a, int d) throws M68kException {
3782: if ((a & 1) == 0 &&
3783: !XEiJ.currentIsSecond) {
3784: super.mmdWb (a, d);
3785: }
3786: XEiJ.mpuClockTime += XEiJ.busWaitTime.ppi;
3787: PPI.ppiWriteByte (a, d);
3788: }
3789: @Override protected void mmdWw (int a, int d) throws M68kException {
3790: mmdWb (a + 1, d);
3791: }
3792: @Override protected void mmdWl (int a, int d) throws M68kException {
3793: mmdWb (a + 1, d >> 16);
3794: mmdWb (a + 3, d);
3795: }
3796: },
3797:
3798:
3799:
3800:
3801:
3802:
3803:
3804:
3805: MMD_IOI {
3806: @Override public String toString () {
3807: return Multilingual.mlnJapanese ? "I/O 割り込み" : "I/O Interrupt";
3808: }
3809:
3810: @Override protected int mmdRbz (int a) throws M68kException {
3811: if ((a & 1) == 0 &&
3812: !XEiJ.currentIsSecond) {
3813: return super.mmdRbz (a);
3814: }
3815: XEiJ.mpuClockTime += XEiJ.busWaitTime.ioi;
3816: a &= XEiJ.BUS_MOTHER_MASK;
3817: if (a == IOInterrupt.IOI_STATUS) {
3818: return IOInterrupt.ioiReadStatus ();
3819: } else if (a == IOInterrupt.IOI_VECTOR) {
3820:
3821: return 0xff;
3822: } else {
3823: return super.mmdRbz (a);
3824: }
3825: }
3826: @Override protected int mmdRwz (int a) throws M68kException {
3827: return 0xff00 | mmdRbz (a + 1);
3828: }
3829: @Override protected int mmdRls (int a) throws M68kException {
3830: return 0xff00ff00 | mmdRbz (a + 1) << 16 | mmdRbz (a + 3);
3831: }
3832:
3833: @Override protected void mmdWb (int a, int d) throws M68kException {
3834: if ((a & 1) == 0 &&
3835: !XEiJ.currentIsSecond) {
3836: super.mmdWb (a, d);
3837: }
3838: XEiJ.mpuClockTime += XEiJ.busWaitTime.ioi;
3839: a &= XEiJ.BUS_MOTHER_MASK;
3840: if (a == IOInterrupt.IOI_STATUS) {
3841: IOInterrupt.ioiWriteEnable (d);
3842: } else if (a == IOInterrupt.IOI_VECTOR) {
3843: IOInterrupt.ioiWriteVector (d);
3844: } else {
3845: super.mmdWb (a, d);
3846: }
3847: }
3848: @Override protected void mmdWw (int a, int d) throws M68kException {
3849: mmdWb (a + 1, d);
3850: }
3851: @Override protected void mmdWl (int a, int d) throws M68kException {
3852: mmdWb (a + 1, d >> 16);
3853: mmdWb (a + 3, d);
3854: }
3855: },
3856:
3857:
3858:
3859: MMD_XB1 {
3860: @Override public String toString () {
3861: return Multilingual.mlnJapanese ? "拡張ボード領域 1" : "Expansion Board Area 1";
3862: }
3863:
3864: @Override protected int mmdPbz (int a) {
3865: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3866: return XEiJ.fpuCoproboard1.cirPeekByteZero (a);
3867: }
3868: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3869: return XEiJ.fpuCoproboard2.cirPeekByteZero (a);
3870: }
3871: if ((a & (XEiJ.BUS_MOTHER_MASK & -HFS.HFS_ROM_SIZE)) == HFS.HFS_ADDRESS) {
3872: a &= XEiJ.BUS_MOTHER_MASK;
3873: return MainMemory.mmrM8[a] & 0xff;
3874: }
3875: if (Keyboard.KBD_ZKEY_ON &&
3876: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3877: return Keyboard.kbdZKeyIOReadByte (a);
3878: }
3879: return 0xff;
3880: }
3881: @Override protected int mmdPwz (int a) {
3882: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3883: return XEiJ.fpuCoproboard1.cirPeekWordZero (a);
3884: }
3885: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3886: return XEiJ.fpuCoproboard2.cirPeekWordZero (a);
3887: }
3888: if ((a & (XEiJ.BUS_MOTHER_MASK & -HFS.HFS_ROM_SIZE)) == HFS.HFS_ADDRESS) {
3889: a &= XEiJ.BUS_MOTHER_MASK;
3890: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
3891: }
3892: if (Keyboard.KBD_ZKEY_ON &&
3893: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3894: return Keyboard.kbdZKeyIOReadWord (a);
3895: }
3896: return 0xffff;
3897: }
3898: @Override protected int mmdPls (int a) {
3899: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3900: return XEiJ.fpuCoproboard1.cirPeekLong (a);
3901: }
3902: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3903: return XEiJ.fpuCoproboard2.cirPeekLong (a);
3904: }
3905: if ((a & (XEiJ.BUS_MOTHER_MASK & -HFS.HFS_ROM_SIZE)) == HFS.HFS_ADDRESS) {
3906: a &= XEiJ.BUS_MOTHER_MASK;
3907: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
3908: }
3909: if (Keyboard.KBD_ZKEY_ON &&
3910: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3911: return Keyboard.kbdZKeyIOReadLong (a);
3912: }
3913: return -1;
3914: }
3915:
3916: @Override protected int mmdRbz (int a) throws M68kException {
3917: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3918: return XEiJ.fpuCoproboard1.cirReadByteZero (a);
3919: }
3920: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3921: return XEiJ.fpuCoproboard2.cirReadByteZero (a);
3922: }
3923: if ((a & (XEiJ.BUS_MOTHER_MASK & -HFS.HFS_ROM_SIZE)) == HFS.HFS_ADDRESS) {
3924: a &= XEiJ.BUS_MOTHER_MASK;
3925: return MainMemory.mmrM8[a] & 0xff;
3926: }
3927: if (Keyboard.KBD_ZKEY_ON &&
3928: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3929: return Keyboard.kbdZKeyIOReadByte (a);
3930: }
3931: return super.mmdRbz (a);
3932: }
3933: @Override protected int mmdRwz (int a) throws M68kException {
3934: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3935: return XEiJ.fpuCoproboard1.cirReadWordZero (a);
3936: }
3937: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3938: return XEiJ.fpuCoproboard2.cirReadWordZero (a);
3939: }
3940: if ((a & (XEiJ.BUS_MOTHER_MASK & -HFS.HFS_ROM_SIZE)) == HFS.HFS_ADDRESS) {
3941: a &= XEiJ.BUS_MOTHER_MASK;
3942: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
3943: }
3944: if (Keyboard.KBD_ZKEY_ON &&
3945: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3946: return Keyboard.kbdZKeyIOReadWord (a);
3947: }
3948: return super.mmdRwz (a);
3949: }
3950: @Override protected int mmdRls (int a) throws M68kException {
3951: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3952: return XEiJ.fpuCoproboard1.cirReadLong (a);
3953: }
3954: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3955: return XEiJ.fpuCoproboard2.cirReadLong (a);
3956: }
3957: if ((a & (XEiJ.BUS_MOTHER_MASK & -HFS.HFS_ROM_SIZE)) == HFS.HFS_ADDRESS) {
3958: a &= XEiJ.BUS_MOTHER_MASK;
3959: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
3960: }
3961: if (Keyboard.KBD_ZKEY_ON &&
3962: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3963: return Keyboard.kbdZKeyIOReadLong (a);
3964: }
3965: return super.mmdRls (a);
3966: }
3967:
3968: @Override protected void mmdWb (int a, int d) throws M68kException {
3969: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3970: XEiJ.fpuCoproboard1.cirWriteByte (a, d);
3971: return;
3972: }
3973: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3974: XEiJ.fpuCoproboard2.cirWriteByte (a, d);
3975: return;
3976: }
3977: if (Keyboard.KBD_ZKEY_ON &&
3978: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3979: Keyboard.kbdZKeyIOWriteByte (a, d);
3980: return;
3981: }
3982: super.mmdWb (a, d);
3983: }
3984: @Override protected void mmdWw (int a, int d) throws M68kException {
3985: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3986: XEiJ.fpuCoproboard1.cirWriteWord (a, d);
3987: return;
3988: }
3989: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3990: XEiJ.fpuCoproboard2.cirWriteWord (a, d);
3991: return;
3992: }
3993: if (Keyboard.KBD_ZKEY_ON &&
3994: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3995: Keyboard.kbdZKeyIOWriteWord (a, d);
3996: return;
3997: }
3998: super.mmdWw (a, d);
3999: }
4000: @Override protected void mmdWl (int a, int d) throws M68kException {
4001: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
4002: XEiJ.fpuCoproboard1.cirWriteLong (a, d);
4003: return;
4004: }
4005: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
4006: XEiJ.fpuCoproboard2.cirWriteLong (a, d);
4007: return;
4008: }
4009: if (Keyboard.KBD_ZKEY_ON &&
4010: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
4011: Keyboard.kbdZKeyIOWriteLong (a, d);
4012: return;
4013: }
4014: super.mmdWl (a, d);
4015: }
4016: },
4017:
4018:
4019:
4020:
4021:
4022:
4023: MMD_EXS {
4024: @Override public String toString () {
4025: return Multilingual.mlnJapanese ? "拡張 SCSI ポート" : "Expansion SCSI Port";
4026: }
4027:
4028: @Override protected int mmdPbz (int a) {
4029: if ((a & (-32 & XEiJ.BUS_MOTHER_MASK)) == SPC.SPC_BASE_EX) {
4030: if ((a & 0x01) == 0) {
4031: return 0xff;
4032: } else {
4033: if (SUK.SUK_ON && SUK.sukOn && SUK.sukExpansion) {
4034: return SUK.sukPeek (a);
4035: }
4036: return SPC.spcSCSIEXChip.spiPeek (a);
4037: }
4038: } else {
4039: return 0xff & MainMemory.mmrM8[a];
4040: }
4041: }
4042: @Override protected int mmdPwz (int a) {
4043: XEiJ.mpuClockTime += XEiJ.busWaitTime.hdc;
4044: if ((a & (-32 & XEiJ.BUS_MOTHER_MASK)) == SPC.SPC_BASE_EX) {
4045: if (SUK.SUK_ON && SUK.sukOn && SUK.sukExpansion) {
4046: return 0xff00 | SUK.sukPeek (a + 1);
4047: }
4048: return 0xff00 | SPC.spcSCSIEXChip.spiPeek (a + 1);
4049: } else {
4050: return (0xff & MainMemory.mmrM8[a]) << 8 | (0xff & MainMemory.mmrM8[a + 1]);
4051: }
4052: }
4053: @Override protected int mmdPls (int a) {
4054: return mmdPwz (a) << 16 | mmdPwz (a + 2);
4055: }
4056:
4057: @Override protected int mmdRbz (int a) throws M68kException {
4058: XEiJ.mpuClockTime += XEiJ.busWaitTime.hdc;
4059: if ((a & (-32 & XEiJ.BUS_MOTHER_MASK)) == SPC.SPC_BASE_EX) {
4060: if ((a & 0x01) == 0) {
4061: if (XEiJ.currentIsSecond) {
4062: return 0xff;
4063: }
4064: return super.mmdRbz (a);
4065: } else {
4066: if (SUK.SUK_ON && SUK.sukOn && SUK.sukExpansion) {
4067: return SUK.sukRead (a);
4068: }
4069: return SPC.spcSCSIEXChip.spiRead (a);
4070: }
4071: } else {
4072: return 0xff & MainMemory.mmrM8[a];
4073: }
4074: }
4075: @Override protected int mmdRwz (int a) throws M68kException {
4076: XEiJ.mpuClockTime += XEiJ.busWaitTime.hdc;
4077: if ((a & (-32 & XEiJ.BUS_MOTHER_MASK)) == SPC.SPC_BASE_EX) {
4078: if (SUK.SUK_ON && SUK.sukOn && SUK.sukExpansion) {
4079: return 0xff00 | SUK.sukRead (a + 1);
4080: }
4081: return 0xff00 | SPC.spcSCSIEXChip.spiRead (a + 1);
4082: } else {
4083: return (0xff & MainMemory.mmrM8[a]) << 8 | (0xff & MainMemory.mmrM8[a + 1]);
4084: }
4085: }
4086: @Override protected int mmdRls (int a) throws M68kException {
4087: return mmdRwz (a) << 16 | mmdRwz (a + 2);
4088: }
4089:
4090: @Override protected void mmdWb (int a, int d) throws M68kException {
4091: XEiJ.mpuClockTime += XEiJ.busWaitTime.hdc;
4092: if ((a & (-32 & XEiJ.BUS_MOTHER_MASK)) == SPC.SPC_BASE_EX) {
4093: if ((a & 1) == 0) {
4094: if (XEiJ.currentIsSecond) {
4095: return;
4096: }
4097: super.mmdWb (a, d);
4098: } else {
4099: if (SUK.SUK_ON && SUK.sukOn && SUK.sukExpansion) {
4100: SUK.sukWrite (a, d);
4101: return;
4102: }
4103: SPC.spcSCSIEXChip.spiWrite (a, d);
4104: return;
4105: }
4106: } else {
4107: super.mmdWb (a, d);
4108: }
4109: }
4110: @Override protected void mmdWw (int a, int d) throws M68kException {
4111: XEiJ.mpuClockTime += XEiJ.busWaitTime.hdc;
4112: if ((a & (-32 & XEiJ.BUS_MOTHER_MASK)) == SPC.SPC_BASE_EX) {
4113: if (SUK.SUK_ON && SUK.sukOn && SUK.sukExpansion) {
4114: SUK.sukWrite (a + 1, d);
4115: return;
4116: }
4117: SPC.spcSCSIEXChip.spiWrite (a + 1, d);
4118: return;
4119: } else {
4120: super.mmdWw (a, d);
4121: }
4122: }
4123: @Override protected void mmdWl (int a, int d) throws M68kException {
4124: mmdWw (a, d >> 16);
4125: mmdWw (a + 2, d);
4126: }
4127: },
4128:
4129:
4130:
4131:
4132:
4133:
4134:
4135:
4136:
4137:
4138:
4139:
4140:
4141:
4142:
4143:
4144:
4145:
4146:
4147:
4148: MMD_XB2 {
4149: @Override public String toString () {
4150: return Multilingual.mlnJapanese ? "拡張ボード領域 2" : "Expansion Board Area 2";
4151: }
4152:
4153: @Override protected int mmdRbz (int a) throws M68kException {
4154: a &= XEiJ.BUS_MOTHER_MASK;
4155: if (0x00eaff81 <= a && a <= 0x00eaff89 && (a & 1) != 0) {
4156: return MainMemory.mmrM8[a] & 0xff;
4157: }
4158: if (XEiJ.bnkOn && a == 0x00eaff7f) {
4159: return XEiJ.bnkPageStart >> 17;
4160: }
4161: return super.mmdRbz (a);
4162: }
4163:
4164: @Override protected void mmdWb (int a, int d) throws M68kException {
4165: a &= XEiJ.BUS_MOTHER_MASK;
4166: if (0x00eaff81 <= a && a <= 0x00eaff89 && (a & 1) != 0) {
4167: MainMemory.mmrM8[a] = (byte) d;
4168: a = (a & 14) + 2 << 20;
4169: for (int m = 1; m <= 128; m <<= 1) {
4170: if ((d & m) == 0) {
4171: XEiJ.busUser ( MemoryMappedDevice.MMD_MMR, a, a + 0x00040000);
4172: } else {
4173: XEiJ.busSuper (MemoryMappedDevice.MMD_MMR, a, a + 0x00040000);
4174: }
4175: a += 0x00040000;
4176: }
4177: return;
4178: }
4179: if (XEiJ.bnkOn && a == 0x00eaff7f) {
4180: XEiJ.bnkPageStart = (d & 0xff) << 17;
4181: return;
4182: }
4183: super.mmdWb (a, d);
4184: }
4185: },
4186:
4187:
4188:
4189:
4190:
4191:
4192:
4193:
4194:
4195:
4196:
4197:
4198:
4199:
4200:
4201:
4202:
4203:
4204:
4205:
4206:
4207: MMD_SPR {
4208: @Override public String toString () {
4209: return Multilingual.mlnJapanese ? "スプライト画面" : "Sprite Screen";
4210: }
4211:
4212: @Override protected byte mmdRbs (int a) throws M68kException {
4213: a &= XEiJ.BUS_MOTHER_MASK;
4214: return (a & 1) == 0 ? (byte) (mmdRwz (a) >> 8) : (byte) mmdRwz (a - 1);
4215: }
4216: @Override protected int mmdRbz (int a) throws M68kException {
4217: a &= XEiJ.BUS_MOTHER_MASK;
4218: return (a & 1) == 0 ? mmdRwz (a) >> 8 : mmdRwz (a - 1) & 0xff;
4219: }
4220: @Override protected int mmdRws (int a) throws M68kException {
4221: a &= XEiJ.BUS_MOTHER_MASK;
4222: return (short) mmdRwz (a);
4223: }
4224: @Override protected int mmdRwz (int a) throws M68kException {
4225: XEiJ.mpuClockTime += XEiJ.busWaitTime.sprc;
4226: a &= XEiJ.BUS_MOTHER_MASK;
4227: if (a < 0x00eb0800) {
4228: if (!SpriteScreen.sprAccessible) {
4229: return super.mmdRwz (a);
4230: }
4231: int n = (a >> 3) & 0xff;
4232: if (SpriteScreen.sprNumberOfSprites <= n) {
4233: return 0xffff;
4234: }
4235: switch (a & 0x06) {
4236: case 0:
4237: return SpriteScreen.sprX[n];
4238: case 2:
4239: return SpriteScreen.sprY[n];
4240: case 4:
4241: return (SpriteScreen.sprV[n] ? 0x8000 : 0) | (SpriteScreen.sprH[n] ? 0x4000 : 0) | SpriteScreen.sprColPort[n] << 4 | SpriteScreen.sprNum[n];
4242: case 6:
4243: return SpriteScreen.sprPrw[n];
4244: }
4245: } else if (a < 0x00eb8000) {
4246: switch (a) {
4247: case SpriteScreen.SPR_REG0_BG0_X:
4248: return SpriteScreen.sprReg0Bg0XPort;
4249: case SpriteScreen.SPR_REG1_BG0_Y:
4250: return SpriteScreen.sprReg1Bg0YPort;
4251: case SpriteScreen.SPR_REG2_BG1_X:
4252: return SpriteScreen.sprReg2Bg1XPort;
4253: case SpriteScreen.SPR_REG3_BG1_Y:
4254: return SpriteScreen.sprReg3Bg1YPort;
4255: case SpriteScreen.SPR_REG4_BG_CTRL:
4256: return SpriteScreen.sprReg4BgCtrlPort;
4257: case SpriteScreen.SPR_REG5_H_FRONT_END:
4258: return SpriteScreen.sprReg5HFrontEndPort;
4259: case SpriteScreen.SPR_REG6_H_BACK_END:
4260: return SpriteScreen.sprReg6HBackEndPort;
4261: case SpriteScreen.SPR_REG7_V_BACK_END:
4262: return SpriteScreen.sprReg7VBackEndPort;
4263: case SpriteScreen.SPR_REG8_RESO:
4264: return SpriteScreen.sprReg8ResoPort;
4265: }
4266: return 0xffff;
4267: } else {
4268: if (!SpriteScreen.sprAccessible) {
4269: return super.mmdRwz (a);
4270: }
4271: int t = a >> 2 & 0x1fff;
4272: return (a & 0x02) == 0 ? SpriteScreen.sprPatPort[t] >>> 16 : (char) SpriteScreen.sprPatPort[t];
4273: }
4274: return 0;
4275: }
4276: @Override protected int mmdRls (int a) throws M68kException {
4277: a &= XEiJ.BUS_MOTHER_MASK;
4278: return mmdRwz (a) << 16 | mmdRwz (a + 2);
4279: }
4280:
4281: @Override protected void mmdWb (int a, int d) throws M68kException {
4282: a &= XEiJ.BUS_MOTHER_MASK;
4283: if (a < 0x00eb0800 || 0x00eb8000 <= a) {
4284: mmdWw (a & ~1, d << 8 | (d & 0xff));
4285: } else {
4286: if ((a & 1) == 0) {
4287: mmdWw (a, d << 8 | (mmdRwz (a) & 0xff));
4288: } else {
4289: mmdWw (a - 1, (mmdRwz (a - 1) & ~0xff) | (d & 0xff));
4290: }
4291: }
4292: }
4293: @Override protected void mmdWw (int a, int d) throws M68kException {
4294: XEiJ.mpuClockTime += XEiJ.busWaitTime.sprc;
4295: a &= XEiJ.BUS_MOTHER_MASK;
4296: if (a < 0x00eb0800) {
4297: if (!SpriteScreen.sprAccessible) {
4298: super.mmdWw (a, d);
4299: }
4300: int n = (a >> 3) & 0xff;
4301: if (SpriteScreen.sprNumberOfSprites <= n) {
4302: return;
4303: }
4304: switch (a & 0x06) {
4305: case 0:
4306: SpriteScreen.sprX[n] = (short) (d & 1023);
4307: break;
4308: case 2:
4309: d &= 1023;
4310: if (SpriteScreen.sprY[n] != d) {
4311: int y = SpriteScreen.sprY[n];
4312: SpriteScreen.sprY[n] = (short) d;
4313: if (SpriteScreen.sprPrw[n] != 0) {
4314: int mask = ~(0x80000000 >>> n);
4315: int i = y << 3 | n >> 5;
4316: SpriteScreen.sprRRmap[i ] &= mask;
4317: SpriteScreen.sprRRmap[i + ( 1 << 3)] &= mask;
4318: SpriteScreen.sprRRmap[i + ( 2 << 3)] &= mask;
4319: SpriteScreen.sprRRmap[i + ( 3 << 3)] &= mask;
4320: SpriteScreen.sprRRmap[i + ( 4 << 3)] &= mask;
4321: SpriteScreen.sprRRmap[i + ( 5 << 3)] &= mask;
4322: SpriteScreen.sprRRmap[i + ( 6 << 3)] &= mask;
4323: SpriteScreen.sprRRmap[i + ( 7 << 3)] &= mask;
4324: SpriteScreen.sprRRmap[i + ( 8 << 3)] &= mask;
4325: SpriteScreen.sprRRmap[i + ( 9 << 3)] &= mask;
4326: SpriteScreen.sprRRmap[i + (10 << 3)] &= mask;
4327: SpriteScreen.sprRRmap[i + (11 << 3)] &= mask;
4328: SpriteScreen.sprRRmap[i + (12 << 3)] &= mask;
4329: SpriteScreen.sprRRmap[i + (13 << 3)] &= mask;
4330: SpriteScreen.sprRRmap[i + (14 << 3)] &= mask;
4331: SpriteScreen.sprRRmap[i + (15 << 3)] &= mask;
4332: mask = ~mask;
4333: i = d << 3 | n >> 5;
4334: SpriteScreen.sprRRmap[i ] |= mask;
4335: SpriteScreen.sprRRmap[i + ( 1 << 3)] |= mask;
4336: SpriteScreen.sprRRmap[i + ( 2 << 3)] |= mask;
4337: SpriteScreen.sprRRmap[i + ( 3 << 3)] |= mask;
4338: SpriteScreen.sprRRmap[i + ( 4 << 3)] |= mask;
4339: SpriteScreen.sprRRmap[i + ( 5 << 3)] |= mask;
4340: SpriteScreen.sprRRmap[i + ( 6 << 3)] |= mask;
4341: SpriteScreen.sprRRmap[i + ( 7 << 3)] |= mask;
4342: SpriteScreen.sprRRmap[i + ( 8 << 3)] |= mask;
4343: SpriteScreen.sprRRmap[i + ( 9 << 3)] |= mask;
4344: SpriteScreen.sprRRmap[i + (10 << 3)] |= mask;
4345: SpriteScreen.sprRRmap[i + (11 << 3)] |= mask;
4346: SpriteScreen.sprRRmap[i + (12 << 3)] |= mask;
4347: SpriteScreen.sprRRmap[i + (13 << 3)] |= mask;
4348: SpriteScreen.sprRRmap[i + (14 << 3)] |= mask;
4349: SpriteScreen.sprRRmap[i + (15 << 3)] |= mask;
4350: }
4351: }
4352: break;
4353: case 4:
4354: {
4355: int num = SpriteScreen.sprNum[n];
4356: SpriteScreen.sprNum[n] = (short) (d & 0xff);
4357: SpriteScreen.sprColPort[n] = (short) (d >> 4 & 0x0f << 4);
4358: SpriteScreen.sprH[n] = (short) (d << 1) < 0;
4359: SpriteScreen.sprV[n] = (short) d < 0;
4360: if (SpriteScreen.sprPrw[n] != 0) {
4361: int mask = 0x80000000 >>> n;
4362: SpriteScreen.sprPPmap[num << 3 | n >> 5] &= ~mask;
4363: SpriteScreen.sprPPmap[(d & 0xff) << 3 | n >> 5] |= mask;
4364: }
4365: }
4366: break;
4367: case 6:
4368: d &= 0x0003;
4369: int prw = SpriteScreen.sprPrw[n];
4370: SpriteScreen.sprPrw[n] = (byte) d;
4371: if (prw != d) {
4372: if (prw == 0) {
4373: int y = SpriteScreen.sprY[n];
4374: int mask = 0x80000000 >>> n;
4375: int i = y << 3 | n >> 5;
4376: SpriteScreen.sprRRmap[i ] |= mask;
4377: SpriteScreen.sprRRmap[i + ( 1 << 3)] |= mask;
4378: SpriteScreen.sprRRmap[i + ( 2 << 3)] |= mask;
4379: SpriteScreen.sprRRmap[i + ( 3 << 3)] |= mask;
4380: SpriteScreen.sprRRmap[i + ( 4 << 3)] |= mask;
4381: SpriteScreen.sprRRmap[i + ( 5 << 3)] |= mask;
4382: SpriteScreen.sprRRmap[i + ( 6 << 3)] |= mask;
4383: SpriteScreen.sprRRmap[i + ( 7 << 3)] |= mask;
4384: SpriteScreen.sprRRmap[i + ( 8 << 3)] |= mask;
4385: SpriteScreen.sprRRmap[i + ( 9 << 3)] |= mask;
4386: SpriteScreen.sprRRmap[i + (10 << 3)] |= mask;
4387: SpriteScreen.sprRRmap[i + (11 << 3)] |= mask;
4388: SpriteScreen.sprRRmap[i + (12 << 3)] |= mask;
4389: SpriteScreen.sprRRmap[i + (13 << 3)] |= mask;
4390: SpriteScreen.sprRRmap[i + (14 << 3)] |= mask;
4391: SpriteScreen.sprRRmap[i + (15 << 3)] |= mask;
4392: SpriteScreen.sprPPmap[SpriteScreen.sprNum[n] << 3 | n >> 5] |= mask;
4393: } else if (d == 0) {
4394: int y = SpriteScreen.sprY[n];
4395: int mask = ~(0x80000000 >>> n);
4396: int i = y << 3 | n >> 5;
4397: SpriteScreen.sprRRmap[i ] &= mask;
4398: SpriteScreen.sprRRmap[i + ( 1 << 3)] &= mask;
4399: SpriteScreen.sprRRmap[i + ( 2 << 3)] &= mask;
4400: SpriteScreen.sprRRmap[i + ( 3 << 3)] &= mask;
4401: SpriteScreen.sprRRmap[i + ( 4 << 3)] &= mask;
4402: SpriteScreen.sprRRmap[i + ( 5 << 3)] &= mask;
4403: SpriteScreen.sprRRmap[i + ( 6 << 3)] &= mask;
4404: SpriteScreen.sprRRmap[i + ( 7 << 3)] &= mask;
4405: SpriteScreen.sprRRmap[i + ( 8 << 3)] &= mask;
4406: SpriteScreen.sprRRmap[i + ( 9 << 3)] &= mask;
4407: SpriteScreen.sprRRmap[i + (10 << 3)] &= mask;
4408: SpriteScreen.sprRRmap[i + (11 << 3)] &= mask;
4409: SpriteScreen.sprRRmap[i + (12 << 3)] &= mask;
4410: SpriteScreen.sprRRmap[i + (13 << 3)] &= mask;
4411: SpriteScreen.sprRRmap[i + (14 << 3)] &= mask;
4412: SpriteScreen.sprRRmap[i + (15 << 3)] &= mask;
4413: SpriteScreen.sprPPmap[SpriteScreen.sprNum[n] << 3 | n >> 5] &= mask;
4414: }
4415: }
4416: break;
4417: }
4418: return;
4419: } else if (a < 0x00eb8000) {
4420: switch (a) {
4421: case SpriteScreen.SPR_REG0_BG0_X:
4422: SpriteScreen.sprReg0Bg0XPort = d & 1023;
4423: {
4424: int curr = SpriteScreen.sprReg0Bg0XMask == 0 ? SpriteScreen.sprReg0Bg0XPort : SpriteScreen.sprReg0Bg0XTest;
4425: if (SpriteScreen.sprReg0Bg0XCurr != curr) {
4426: SpriteScreen.sprReg0Bg0XCurr = curr;
4427: }
4428: }
4429: return;
4430: case SpriteScreen.SPR_REG1_BG0_Y:
4431: SpriteScreen.sprReg1Bg0YPort = d & 1023;
4432: {
4433: int curr = SpriteScreen.sprReg1Bg0YMask == 0 ? SpriteScreen.sprReg1Bg0YPort : SpriteScreen.sprReg1Bg0YTest;
4434: if (SpriteScreen.sprReg1Bg0YCurr != curr) {
4435: SpriteScreen.sprReg1Bg0YCurr = curr;
4436: }
4437: }
4438: return;
4439: case SpriteScreen.SPR_REG2_BG1_X:
4440: SpriteScreen.sprReg2Bg1XPort = d & 1023;
4441: {
4442: int curr = SpriteScreen.sprReg2Bg1XMask == 0 ? SpriteScreen.sprReg2Bg1XPort : SpriteScreen.sprReg2Bg1XTest;
4443: if (SpriteScreen.sprReg2Bg1XCurr != curr) {
4444: SpriteScreen.sprReg2Bg1XCurr = curr;
4445: }
4446: }
4447: return;
4448: case SpriteScreen.SPR_REG3_BG1_Y:
4449: SpriteScreen.sprReg3Bg1YPort = d & 1023;
4450: {
4451: int curr = SpriteScreen.sprReg3Bg1YMask == 0 ? SpriteScreen.sprReg3Bg1YPort : SpriteScreen.sprReg3Bg1YTest;
4452: if (SpriteScreen.sprReg3Bg1YCurr != curr) {
4453: SpriteScreen.sprReg3Bg1YCurr = curr;
4454: }
4455: }
4456: return;
4457: case SpriteScreen.SPR_REG4_BG_CTRL:
4458: SpriteScreen.sprReg4BgCtrlPort = d & 2047;
4459: {
4460: int curr = SpriteScreen.sprReg4BgCtrlPort & ~SpriteScreen.sprReg4BgCtrlMask | SpriteScreen.sprReg4BgCtrlTest & SpriteScreen.sprReg4BgCtrlMask;
4461: if (SpriteScreen.sprReg4BgCtrlCurr != curr) {
4462: SpriteScreen.sprReg4BgCtrlCurr = curr;
4463: }
4464: }
4465: return;
4466: case SpriteScreen.SPR_REG5_H_FRONT_END:
4467: SpriteScreen.sprReg5HFrontEndPort = d & 0xff;
4468: {
4469: int curr = SpriteScreen.sprReg5HFrontEndMask == 0 ? SpriteScreen.sprReg5HFrontEndPort : SpriteScreen.sprReg5HFrontEndTest;
4470: if (SpriteScreen.sprReg5HFrontEndCurr != curr) {
4471: SpriteScreen.sprReg5HFrontEndCurr = curr;
4472: }
4473: }
4474: return;
4475: case SpriteScreen.SPR_REG6_H_BACK_END:
4476: SpriteScreen.sprReg6HBackEndPort = d & 63;
4477: {
4478: int curr = SpriteScreen.sprReg6HBackEndMask == 0 ? SpriteScreen.sprReg6HBackEndPort : SpriteScreen.sprReg6HBackEndTest;
4479: if (SpriteScreen.sprReg6HBackEndCurr != curr) {
4480: SpriteScreen.sprReg6HBackEndCurr = curr;
4481: }
4482: }
4483: return;
4484: case SpriteScreen.SPR_REG7_V_BACK_END:
4485: SpriteScreen.sprReg7VBackEndPort = d & 0xff;
4486: {
4487: int curr = SpriteScreen.sprReg7VBackEndMask == 0 ? SpriteScreen.sprReg7VBackEndPort : SpriteScreen.sprReg7VBackEndTest;
4488: if (SpriteScreen.sprReg7VBackEndCurr != curr) {
4489: SpriteScreen.sprReg7VBackEndCurr = curr;
4490: }
4491: }
4492: return;
4493: case SpriteScreen.SPR_REG8_RESO:
4494: SpriteScreen.sprReg8ResoPort = d & 31;
4495: {
4496: int curr = SpriteScreen.sprReg8ResoPort & ~SpriteScreen.sprReg8ResoMask | SpriteScreen.sprReg8ResoTest & SpriteScreen.sprReg8ResoMask;
4497: if (SpriteScreen.sprReg8ResoCurr != curr) {
4498: SpriteScreen.sprReg8ResoCurr = curr;
4499: CRTC.crtRestart ();
4500: }
4501: }
4502: return;
4503: }
4504: return;
4505: } else {
4506: if (!SpriteScreen.sprAccessible) {
4507: super.mmdWw (a, d);
4508: }
4509: if (0x00ebe000 <= a) {
4510: int n = a >> 1 & 0x0fff;
4511: SpriteScreen.sprT1Num[n] = (short) ((d & 0xff) << 3);
4512: SpriteScreen.sprT1ColPort[n] = (short) ((d & 0x0f00) >> 4);
4513: SpriteScreen.sprT1H[n] = (short) (d << 1) < 0;
4514: SpriteScreen.sprT1V[n] = (short) d < 0;
4515: } else if (0x00ebc000 <= a) {
4516: int n = a >> 1 & 0x0fff;
4517: SpriteScreen.sprT0Num[n] = (short) ((d & 0xff) << 3);
4518: SpriteScreen.sprT0ColPort[n] = (short) ((d & 0x0f00) >> 4);
4519: SpriteScreen.sprT0H[n] = (short) (d << 1) < 0;
4520: SpriteScreen.sprT0V[n] = (short) d < 0;
4521: }
4522: int t = a >> 2 & 0x1fff;
4523: SpriteScreen.sprPatPort[t] = (a & 0x02) == 0 ? d << 16 | (char) SpriteScreen.sprPatPort[t] : (SpriteScreen.sprPatPort[t] & ~0xffff) | (char) d;
4524: }
4525: }
4526: @Override protected void mmdWl (int a, int d) throws M68kException {
4527: a &= XEiJ.BUS_MOTHER_MASK;
4528: mmdWw (a , d >> 16);
4529: mmdWw (a + 2, d );
4530: }
4531: },
4532:
4533:
4534:
4535:
4536:
4537:
4538:
4539:
4540:
4541:
4542: MMD_XB3 {
4543: @Override public String toString () {
4544: return Multilingual.mlnJapanese ? "拡張ボード領域 3" : "Expansion Board Area 3";
4545: }
4546:
4547: @Override protected int mmdRbz (int a) throws M68kException {
4548: a &= XEiJ.BUS_MOTHER_MASK;
4549: if (XEiJ.currentAccelerator == XEiJ.ACCELERATOR_XELLENT30 &&
4550: XEiJ.xt3PortAddress <= a && a < XEiJ.xt3PortAddress + 0x4000) {
4551: return (a & 1) == 0 ? 0 : XEiJ.xt3PortRead ();
4552: }
4553: return super.mmdRbz (a);
4554: }
4555: @Override protected int mmdRwz (int a) throws M68kException {
4556: a &= XEiJ.BUS_MOTHER_MASK;
4557: if (XEiJ.currentAccelerator == XEiJ.ACCELERATOR_XELLENT30 &&
4558: XEiJ.xt3PortAddress <= a && a < XEiJ.xt3PortAddress + 0x4000) {
4559: return XEiJ.xt3PortRead ();
4560: }
4561: return super.mmdRwz (a);
4562: }
4563: @Override protected int mmdRls (int a) throws M68kException {
4564: a &= XEiJ.BUS_MOTHER_MASK;
4565: if (XEiJ.currentAccelerator == XEiJ.ACCELERATOR_XELLENT30 &&
4566: XEiJ.xt3PortAddress <= a && a < XEiJ.xt3PortAddress + 0x4000) {
4567: return XEiJ.xt3PortRead () << 16 | XEiJ.xt3PortRead ();
4568: }
4569: return super.mmdRls (a);
4570: }
4571: @Override protected void mmdWb (int a, int d) throws M68kException {
4572: a &= XEiJ.BUS_MOTHER_MASK;
4573: if (XEiJ.currentAccelerator == XEiJ.ACCELERATOR_XELLENT30 &&
4574: XEiJ.xt3PortAddress <= a && a < XEiJ.xt3PortAddress + 0x4000) {
4575: if ((a & 1) == 0) {
4576: } else {
4577: XEiJ.xt3PortWrite (d);
4578: }
4579: return;
4580: }
4581: super.mmdWb (a, d);
4582: }
4583: @Override protected void mmdWw (int a, int d) throws M68kException {
4584: a &= XEiJ.BUS_MOTHER_MASK;
4585: if (XEiJ.currentAccelerator == XEiJ.ACCELERATOR_XELLENT30 &&
4586: XEiJ.xt3PortAddress <= a && a < XEiJ.xt3PortAddress + 0x4000) {
4587: XEiJ.xt3PortWrite (d);
4588: return;
4589: }
4590: super.mmdWw (a, d);
4591: }
4592: @Override protected void mmdWl (int a, int d) throws M68kException {
4593: a &= XEiJ.BUS_MOTHER_MASK;
4594: if (XEiJ.currentAccelerator == XEiJ.ACCELERATOR_XELLENT30 &&
4595: XEiJ.xt3PortAddress <= a && a < XEiJ.xt3PortAddress + 0x4000) {
4596: XEiJ.xt3PortWrite (d >> 16);
4597: XEiJ.xt3PortWrite (d);
4598: return;
4599: }
4600: super.mmdWl (a, d);
4601: }
4602: },
4603:
4604:
4605:
4606: MMD_XTM {
4607: @Override public String toString () {
4608: return Multilingual.mlnJapanese ? "Xellent30 の SRAM" : "SRAM on Xellent30";
4609: }
4610:
4611: @Override protected byte mmdPbs (int a) {
4612: a -= XEiJ.xt3MemoryPosition;
4613: return XEiJ.xt3MemoryArray[a];
4614: }
4615: @Override protected int mmdPbz (int a) {
4616: a -= XEiJ.xt3MemoryPosition;
4617: return XEiJ.xt3MemoryArray[a] & 0xff;
4618: }
4619: @Override protected int mmdPws (int a) {
4620: a -= XEiJ.xt3MemoryPosition;
4621: return XEiJ.xt3MemoryArray[a] << 8 | (XEiJ.xt3MemoryArray[a + 1] & 0xff);
4622: }
4623: @Override protected int mmdPwz (int a) {
4624: a -= XEiJ.xt3MemoryPosition;
4625: return (char) (XEiJ.xt3MemoryArray[a] << 8 | (XEiJ.xt3MemoryArray[a + 1] & 0xff));
4626: }
4627: @Override protected int mmdPls (int a) {
4628: a -= XEiJ.xt3MemoryPosition;
4629: return XEiJ.xt3MemoryArray[a] << 24 | (XEiJ.xt3MemoryArray[a + 1] & 0xff) << 16 | (char) (XEiJ.xt3MemoryArray[a + 2] << 8 | (XEiJ.xt3MemoryArray[a + 3] & 0xff));
4630: }
4631:
4632: @Override protected byte mmdRbs (int a) throws M68kException {
4633: a -= XEiJ.xt3MemoryPosition;
4634: return XEiJ.xt3MemoryArray[a];
4635: }
4636: @Override protected int mmdRbz (int a) throws M68kException {
4637: a -= XEiJ.xt3MemoryPosition;
4638: return XEiJ.xt3MemoryArray[a] & 0xff;
4639: }
4640: @Override protected int mmdRws (int a) throws M68kException {
4641: a -= XEiJ.xt3MemoryPosition;
4642: return XEiJ.xt3MemoryArray[a] << 8 | (XEiJ.xt3MemoryArray[a + 1] & 0xff);
4643: }
4644: @Override protected int mmdRwz (int a) throws M68kException {
4645: a -= XEiJ.xt3MemoryPosition;
4646: return (char) (XEiJ.xt3MemoryArray[a] << 8 | (XEiJ.xt3MemoryArray[a + 1] & 0xff));
4647: }
4648: @Override protected int mmdRls (int a) throws M68kException {
4649: a -= XEiJ.xt3MemoryPosition;
4650: return XEiJ.xt3MemoryArray[a] << 24 | (XEiJ.xt3MemoryArray[a + 1] & 0xff) << 16 | (char) (XEiJ.xt3MemoryArray[a + 2] << 8 | (XEiJ.xt3MemoryArray[a + 3] & 0xff));
4651: }
4652:
4653: @Override protected void mmdWb (int a, int d) throws M68kException {
4654: a -= XEiJ.xt3MemoryPosition;
4655: XEiJ.xt3MemoryArray[a ] = (byte) d;
4656: }
4657: @Override protected void mmdWw (int a, int d) throws M68kException {
4658: a -= XEiJ.xt3MemoryPosition;
4659: XEiJ.xt3MemoryArray[a ] = (byte) (d >> 8);
4660: XEiJ.xt3MemoryArray[a + 1] = (byte) d;
4661: }
4662: @Override protected void mmdWl (int a, int d) throws M68kException {
4663: a -= XEiJ.xt3MemoryPosition;
4664: XEiJ.xt3MemoryArray[a ] = (byte) (d >> 24);
4665: XEiJ.xt3MemoryArray[a + 1] = (byte) (d >> 16);
4666: XEiJ.xt3MemoryArray[a + 2] = (byte) (d >> 8);
4667: XEiJ.xt3MemoryArray[a + 3] = (byte) d;
4668: }
4669: },
4670:
4671:
4672:
4673: MMD_SMR {
4674: @Override public String toString () {
4675: return Multilingual.mlnJapanese ? "SRAM" : "SRAM";
4676: }
4677:
4678: @Override protected byte mmdPbs (int a) {
4679: a &= XEiJ.BUS_MOTHER_MASK;
4680: return MainMemory.mmrM8[a];
4681: }
4682: @Override protected int mmdPbz (int a) {
4683: a &= XEiJ.BUS_MOTHER_MASK;
4684: return MainMemory.mmrM8[a] & 0xff;
4685: }
4686: @Override protected int mmdPws (int a) {
4687: a &= XEiJ.BUS_MOTHER_MASK;
4688: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4689: return MainMemory.mmrBuffer.getShort (a);
4690: } else {
4691: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
4692: }
4693: }
4694: @Override protected int mmdPwz (int a) {
4695: a &= XEiJ.BUS_MOTHER_MASK;
4696: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4697: return MainMemory.mmrBuffer.getChar (a);
4698: } else {
4699: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
4700: }
4701: }
4702: @Override protected int mmdPls (int a) {
4703: a &= XEiJ.BUS_MOTHER_MASK;
4704: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4705: return MainMemory.mmrBuffer.getInt (a);
4706: } else {
4707: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
4708: }
4709: }
4710:
4711: @Override protected byte mmdRbs (int a) throws M68kException {
4712: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4713: a &= XEiJ.BUS_MOTHER_MASK;
4714: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4715: return MainMemory.mmrM8[a];
4716: }
4717: @Override protected int mmdRbz (int a) throws M68kException {
4718: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4719: a &= XEiJ.BUS_MOTHER_MASK;
4720: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4721: return MainMemory.mmrM8[a] & 0xff;
4722: }
4723: @Override protected int mmdRws (int a) throws M68kException {
4724: return (short) mmdRwz (a);
4725: }
4726: @Override protected int mmdRwz (int a) throws M68kException {
4727: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4728: a &= XEiJ.BUS_MOTHER_MASK;
4729: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4730: int d;
4731: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4732: d = MainMemory.mmrBuffer.getChar (a);
4733: } else {
4734: d = (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
4735: }
4736: return d;
4737: }
4738: @Override protected int mmdRls (int a) throws M68kException {
4739: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram * 2;
4740: a &= XEiJ.BUS_MOTHER_MASK;
4741: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram * 2;
4742: int d;
4743: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4744: d = MainMemory.mmrBuffer.getInt (a);
4745: } else {
4746: d = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
4747: }
4748: return d;
4749: }
4750:
4751: @Override protected void mmdWb (int a, int d) throws M68kException {
4752: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4753: if (SRAM.smrWriteEnableOn) {
4754: a &= XEiJ.BUS_MOTHER_MASK;
4755: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4756: MainMemory.mmrM8[a] = (byte) d;
4757: if (a == 0x00ed002b || a == 0x00ed0059) {
4758: Keyboard.kbdRepaint ();
4759: } else if (a == 0x00ed005a) {
4760: if (0x00fe0000 <= XEiJ.regPC0 && XEiJ.regPC0 <= 0x00ffffff) {
4761: SRAM.smrOverride ();
4762: }
4763: }
4764: } else {
4765: System.out.printf ("%08X writing $%02X to $%08X in a write-protected state\n", XEiJ.regPC0, d & 0xff, a);
4766: if (SRAM.smrSRAMBusErrorOn) {
4767: super.mmdWb (a, d);
4768: }
4769: }
4770: }
4771: @Override protected void mmdWw (int a, int d) throws M68kException {
4772: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4773: if (SRAM.smrWriteEnableOn) {
4774: a &= XEiJ.BUS_MOTHER_MASK;
4775: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4776: MainMemory.mmrM8[a ] = (byte) (d >> 8);
4777: MainMemory.mmrM8[a + 1] = (byte) d;
4778: if (a == (0x00ed002b & -2) || a == (0x00ed0059 & -2)) {
4779: Keyboard.kbdRepaint ();
4780: }
4781: } else {
4782: System.out.printf ("%08X writing $%04X to $%08X in a write-protected state\n", XEiJ.regPC0, d & 0xffff, a);
4783: if (SRAM.smrSRAMBusErrorOn) {
4784: super.mmdWw (a, d);
4785: }
4786: }
4787: }
4788: @Override protected void mmdWl (int a, int d) throws M68kException {
4789: if (SRAM.smrWriteEnableOn) {
4790: mmdWw (a , d >> 16);
4791: mmdWw (a + 2, d );
4792: } else {
4793: System.out.printf ("%08X writing $%08X to $%08X in a write-protected state\n", XEiJ.regPC0, d, a);
4794: if (SRAM.smrSRAMBusErrorOn) {
4795: super.mmdWl (a, d);
4796: }
4797: }
4798: }
4799: },
4800:
4801:
4802:
4803:
4804: MMD_XB4 {
4805: @Override public String toString () {
4806: return Multilingual.mlnJapanese ? "拡張ボード領域 4" : "Expansion Board Area 4";
4807: }
4808:
4809: @Override protected byte mmdRbs (int a) throws M68kException {
4810: if (XEiJ.bnkOn) {
4811: a &= XEiJ.BUS_MOTHER_MASK;
4812: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4813: return XEiJ.bnkMemory[a];
4814: }
4815: return super.mmdRbs (a);
4816: }
4817: @Override protected int mmdRbz (int a) throws M68kException {
4818: if (XEiJ.bnkOn) {
4819: a &= XEiJ.BUS_MOTHER_MASK;
4820: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4821: return XEiJ.bnkMemory[a] & 0xff;
4822: }
4823: return super.mmdRbz (a);
4824: }
4825: @Override protected int mmdRws (int a) throws M68kException {
4826: if (XEiJ.bnkOn) {
4827: a &= XEiJ.BUS_MOTHER_MASK;
4828: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4829: return ((XEiJ.bnkMemory[a ] ) << 8 |
4830: (XEiJ.bnkMemory[a + 1] & 0xff));
4831: }
4832: return super.mmdRws (a);
4833: }
4834: @Override protected int mmdRwz (int a) throws M68kException {
4835: if (XEiJ.bnkOn) {
4836: a &= XEiJ.BUS_MOTHER_MASK;
4837: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4838: return ((XEiJ.bnkMemory[a ] & 0xff) << 8 |
4839: (XEiJ.bnkMemory[a + 1] & 0xff));
4840: }
4841: return super.mmdRwz (a);
4842: }
4843: @Override protected int mmdRls (int a) throws M68kException {
4844: if (XEiJ.bnkOn) {
4845: a &= XEiJ.BUS_MOTHER_MASK;
4846: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4847: return ((XEiJ.bnkMemory[a ] ) << 24 |
4848: (XEiJ.bnkMemory[a + 1] & 0xff) << 16 |
4849: (XEiJ.bnkMemory[a + 2] & 0xff) << 8 |
4850: (XEiJ.bnkMemory[a + 3] & 0xff));
4851: }
4852: return super.mmdRls (a);
4853: }
4854:
4855: @Override protected void mmdWb (int a, int d) throws M68kException {
4856: if (XEiJ.bnkOn) {
4857: a &= XEiJ.BUS_MOTHER_MASK;
4858: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4859: XEiJ.bnkMemory[a] = (byte) d;
4860: return;
4861: }
4862: super.mmdWb (a, d);
4863: }
4864: @Override protected void mmdWw (int a, int d) throws M68kException {
4865: if (XEiJ.bnkOn) {
4866: a &= XEiJ.BUS_MOTHER_MASK;
4867: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4868: XEiJ.bnkMemory[a ] = (byte) (d >> 8);
4869: XEiJ.bnkMemory[a + 1] = (byte) d;
4870: return;
4871: }
4872: super.mmdWw (a, d);
4873: }
4874: @Override protected void mmdWl (int a, int d) throws M68kException {
4875: if (XEiJ.bnkOn) {
4876: a &= XEiJ.BUS_MOTHER_MASK;
4877: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4878: XEiJ.bnkMemory[a ] = (byte) (d >> 24);
4879: XEiJ.bnkMemory[a + 1] = (byte) (d >> 16);
4880: XEiJ.bnkMemory[a + 2] = (byte) (d >> 8);
4881: XEiJ.bnkMemory[a + 3] = (byte) d;
4882: return;
4883: }
4884: super.mmdWl (a, d);
4885: }
4886: },
4887:
4888:
4889:
4890: MMD_CG1 {
4891: @Override public String toString () {
4892: return Multilingual.mlnJapanese ? "CGROM" : "CGROM";
4893: }
4894:
4895: @Override protected byte mmdPbs (int a) {
4896: a &= XEiJ.BUS_MOTHER_MASK;
4897: return MainMemory.mmrM8[a];
4898: }
4899: @Override protected int mmdPbz (int a) {
4900: a &= XEiJ.BUS_MOTHER_MASK;
4901: return MainMemory.mmrM8[a] & 0xff;
4902: }
4903: @Override protected int mmdPws (int a) {
4904: a &= XEiJ.BUS_MOTHER_MASK;
4905: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4906: return MainMemory.mmrBuffer.getShort (a);
4907: } else {
4908: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
4909: }
4910: }
4911: @Override protected int mmdPwz (int a) {
4912: a &= XEiJ.BUS_MOTHER_MASK;
4913: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4914: return MainMemory.mmrBuffer.getChar (a);
4915: } else {
4916: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
4917: }
4918: }
4919: @Override protected int mmdPls (int a) {
4920: a &= XEiJ.BUS_MOTHER_MASK;
4921: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4922: return MainMemory.mmrBuffer.getInt (a);
4923: } else {
4924: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
4925: }
4926: }
4927:
4928: @Override protected byte mmdRbs (int a) throws M68kException {
4929: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
4930: a &= XEiJ.BUS_MOTHER_MASK;
4931: return MainMemory.mmrM8[a];
4932: }
4933: @Override protected int mmdRbz (int a) throws M68kException {
4934: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
4935: a &= XEiJ.BUS_MOTHER_MASK;
4936: return MainMemory.mmrM8[a] & 0xff;
4937: }
4938: @Override protected int mmdRws (int a) throws M68kException {
4939: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
4940: a &= XEiJ.BUS_MOTHER_MASK;
4941: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4942: return MainMemory.mmrBuffer.getShort (a);
4943: } else {
4944: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
4945: }
4946: }
4947: @Override protected int mmdRwz (int a) throws M68kException {
4948: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
4949: a &= XEiJ.BUS_MOTHER_MASK;
4950: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4951: return MainMemory.mmrBuffer.getChar (a);
4952: } else {
4953: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
4954: }
4955: }
4956: @Override protected int mmdRls (int a) throws M68kException {
4957: XEiJ.mpuClockTime += XEiJ.busWaitTime.romlong;
4958: a &= XEiJ.BUS_MOTHER_MASK;
4959: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4960: return MainMemory.mmrBuffer.getInt (a);
4961: } else {
4962: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
4963: }
4964: }
4965: },
4966:
4967:
4968:
4969: MMD_CG2 {
4970: @Override public String toString () {
4971: return Multilingual.mlnJapanese ? "CGROM" : "CGROM";
4972: }
4973:
4974: @Override protected byte mmdPbs (int a) {
4975: a &= XEiJ.BUS_MOTHER_MASK;
4976: return MainMemory.mmrM8[a];
4977: }
4978: @Override protected int mmdPbz (int a) {
4979: a &= XEiJ.BUS_MOTHER_MASK;
4980: return MainMemory.mmrM8[a] & 0xff;
4981: }
4982: @Override protected int mmdPws (int a) {
4983: a &= XEiJ.BUS_MOTHER_MASK;
4984: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4985: return MainMemory.mmrBuffer.getShort (a);
4986: } else {
4987: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
4988: }
4989: }
4990: @Override protected int mmdPwz (int a) {
4991: a &= XEiJ.BUS_MOTHER_MASK;
4992: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4993: return MainMemory.mmrBuffer.getChar (a);
4994: } else {
4995: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
4996: }
4997: }
4998: @Override protected int mmdPls (int a) {
4999: a &= XEiJ.BUS_MOTHER_MASK;
5000: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5001: return MainMemory.mmrBuffer.getInt (a);
5002: } else {
5003: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
5004: }
5005: }
5006:
5007: @Override protected byte mmdRbs (int a) throws M68kException {
5008: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
5009: a &= XEiJ.BUS_MOTHER_MASK;
5010: return MainMemory.mmrM8[a];
5011: }
5012: @Override protected int mmdRbz (int a) throws M68kException {
5013: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
5014: a &= XEiJ.BUS_MOTHER_MASK;
5015: return MainMemory.mmrM8[a] & 0xff;
5016: }
5017: @Override protected int mmdRws (int a) throws M68kException {
5018: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
5019: a &= XEiJ.BUS_MOTHER_MASK;
5020: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5021: return MainMemory.mmrBuffer.getShort (a);
5022: } else {
5023: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
5024: }
5025: }
5026: @Override protected int mmdRwz (int a) throws M68kException {
5027: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
5028: a &= XEiJ.BUS_MOTHER_MASK;
5029: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5030: return MainMemory.mmrBuffer.getChar (a);
5031: } else {
5032: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
5033: }
5034: }
5035: @Override protected int mmdRls (int a) throws M68kException {
5036: XEiJ.mpuClockTime += XEiJ.busWaitTime.romlong;
5037: a &= XEiJ.BUS_MOTHER_MASK;
5038: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5039: return MainMemory.mmrBuffer.getInt (a);
5040: } else {
5041: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
5042: }
5043: }
5044: },
5045:
5046:
5047:
5048: MMD_ROM {
5049: @Override public String toString () {
5050: return Multilingual.mlnJapanese ? "ROM" : "ROM";
5051: }
5052:
5053: @Override protected byte mmdPbs (int a) {
5054: a &= XEiJ.BUS_MOTHER_MASK;
5055: return MainMemory.mmrM8[a];
5056: }
5057: @Override protected int mmdPbz (int a) {
5058: a &= XEiJ.BUS_MOTHER_MASK;
5059: return MainMemory.mmrM8[a] & 0xff;
5060: }
5061: @Override protected int mmdPws (int a) {
5062: a &= XEiJ.BUS_MOTHER_MASK;
5063: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5064: return MainMemory.mmrBuffer.getShort (a);
5065: } else {
5066: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
5067: }
5068: }
5069: @Override protected int mmdPwz (int a) {
5070: a &= XEiJ.BUS_MOTHER_MASK;
5071: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5072: return MainMemory.mmrBuffer.getChar (a);
5073: } else {
5074: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
5075: }
5076: }
5077: @Override protected int mmdPls (int a) {
5078: a &= XEiJ.BUS_MOTHER_MASK;
5079: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5080: return MainMemory.mmrBuffer.getInt (a);
5081: } else {
5082: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
5083: }
5084: }
5085:
5086: @Override protected byte mmdRbs (int a) throws M68kException {
5087: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
5088: a &= XEiJ.BUS_MOTHER_MASK;
5089: return MainMemory.mmrM8[a];
5090: }
5091: @Override protected int mmdRbz (int a) throws M68kException {
5092: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
5093: a &= XEiJ.BUS_MOTHER_MASK;
5094: return MainMemory.mmrM8[a] & 0xff;
5095: }
5096: @Override protected int mmdRws (int a) throws M68kException {
5097: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
5098: a &= XEiJ.BUS_MOTHER_MASK;
5099: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5100: return MainMemory.mmrBuffer.getShort (a);
5101: } else {
5102: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
5103: }
5104: }
5105: @Override protected int mmdRwz (int a) throws M68kException {
5106: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
5107: a &= XEiJ.BUS_MOTHER_MASK;
5108: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5109: return MainMemory.mmrBuffer.getChar (a);
5110: } else {
5111: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
5112: }
5113: }
5114: @Override protected int mmdRls (int a) throws M68kException {
5115: XEiJ.mpuClockTime += XEiJ.busWaitTime.romlong;
5116: a &= XEiJ.BUS_MOTHER_MASK;
5117: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5118: return MainMemory.mmrBuffer.getInt (a);
5119: } else {
5120: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
5121: }
5122: }
5123: },
5124:
5125:
5126:
5127: MMD_IBP {
5128: @Override public String toString () {
5129: return Multilingual.mlnJapanese ? "命令ブレークポイント" : "Instruction Break Point";
5130: }
5131: @Override protected int mmdRwz (int a) throws M68kException {
5132: if (InstructionBreakPoint.IBP_ON) {
5133: InstructionBreakPoint.InstructionBreakRecord[] hashTable = InstructionBreakPoint.ibpHashTable;
5134: for (InstructionBreakPoint.InstructionBreakRecord r = hashTable[a >> 1 & InstructionBreakPoint.IBP_HASH_MASK];
5135: r != null;
5136: r = r.ibrNext) {
5137: if (r.ibrPhysicalAddress == a) {
5138: if (r.ibrValue == r.ibrTarget) {
5139: if (r.ibrThreshold < 0) {
5140: InstructionBreakPoint.ibpRemove (r.ibrLogicalAddress, XEiJ.regSRS);
5141: XEiJ.mpuContinue = true;
5142: } else if (r.ibrTarget < r.ibrThreshold) {
5143: r.ibrTarget = r.ibrThreshold;
5144: XEiJ.mpuContinue = true;
5145: } else {
5146: if (r.ibrScriptElement != null &&
5147: r.ibrScriptElement.exlEval (ExpressionEvaluator.EVM_EXPRESSION).exlFloatValue.iszero ()) {
5148: break;
5149: }
5150: r.ibrTarget++;
5151: XEiJ.mpuContinue = false;
5152: }
5153: M68kException.m6eNumber = M68kException.M6E_INSTRUCTION_BREAK_POINT;
5154: throw M68kException.m6eSignal;
5155: } else {
5156: if (r.ibrWaitInstruction != null) {
5157: WaitInstruction.instruction = r.ibrWaitInstruction;
5158: return XEiJ.EMX_OPCODE_EMXWAIT;
5159: }
5160: r.ibrValue++;
5161: break;
5162: }
5163: }
5164: }
5165: }
5166: if (DataBreakPoint.DBP_ON) {
5167: return DataBreakPoint.dbpMemoryMap[a >>> XEiJ.BUS_PAGE_BITS].mmdRwz (a);
5168: } else {
5169: return XEiJ.busMemoryMap[a >>> XEiJ.BUS_PAGE_BITS].mmdRwz (a);
5170: }
5171: }
5172: },
5173:
5174:
5175:
5176: MMD_DBP {
5177: @Override public String toString () {
5178: return Multilingual.mlnJapanese ? "データブレークポイント" : "Data Break Point";
5179: }
5180:
5181: @Override protected byte mmdPbs (int a) {
5182: return (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdPbs (a);
5183: }
5184: @Override protected int mmdPbz (int a) {
5185: return (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdPbz (a);
5186: }
5187: @Override protected int mmdPws (int a) {
5188: return (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdPws (a);
5189: }
5190: @Override protected int mmdPwz (int a) {
5191: return (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdPwz (a);
5192: }
5193: @Override protected int mmdPls (int a) {
5194: return (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdPls (a);
5195: }
5196:
5197: @Override protected byte mmdRbs (int a) throws M68kException {
5198: int d = (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdRbs (a);
5199: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_BYTE, a, d);
5200: return (byte) d;
5201: }
5202: @Override protected int mmdRbz (int a) throws M68kException {
5203: int d = (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdRbz (a);
5204: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_BYTE, a, d);
5205: return d;
5206: }
5207: @Override protected int mmdRws (int a) throws M68kException {
5208: int d = (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdRws (a);
5209: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_WORD, a, d);
5210: return d;
5211: }
5212: @Override protected int mmdRwz (int a) throws M68kException {
5213: int d = (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdRwz (a);
5214: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_WORD, a, d);
5215: return d;
5216: }
5217: @Override protected int mmdRls (int a) throws M68kException {
5218: int d = (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdRls (a);
5219: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_LONG, a, d);
5220: return d;
5221: }
5222:
5223: @Override protected void mmdWb (int a, int d) throws M68kException {
5224: (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdWb (a, d);
5225: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_BYTE, a, d);
5226: }
5227: @Override protected void mmdWw (int a, int d) throws M68kException {
5228: (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdWw (a, d);
5229: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_WORD, a, d);
5230: }
5231: @Override protected void mmdWl (int a, int d) throws M68kException {
5232: (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdWl (a, d);
5233: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_LONG, a, d);
5234: }
5235: },
5236:
5237:
5238:
5239: MMD_NUL {
5240: @Override public String toString () {
5241: return Multilingual.mlnJapanese ? "ヌルデバイス" : "Null Device";
5242: }
5243: };
5244:
5245:
5246:
5247:
5248:
5249:
5250: protected byte mmdPbs (int a) {
5251: return (byte) mmdPbz (a);
5252: }
5253: protected int mmdPbz (int a) {
5254: try {
5255: return mmdRbz (a);
5256: } catch (M68kException e) {
5257: }
5258: return 0xff;
5259: }
5260: protected int mmdPws (int a) {
5261: return (short) mmdPwz (a);
5262: }
5263: protected int mmdPwz (int a) {
5264: try {
5265: return mmdRwz (a);
5266: } catch (M68kException e) {
5267: }
5268: return 0xffff;
5269: }
5270: protected int mmdPls (int a) {
5271: try {
5272: return mmdRls (a);
5273: } catch (M68kException e) {
5274: }
5275: return -1;
5276: }
5277:
5278:
5279:
5280: protected byte mmdRbs (int a) throws M68kException {
5281: return (byte) mmdRbz (a);
5282: }
5283: protected int mmdRbz (int a) throws M68kException {
5284: M68kException.m6eFSLW |= M68kException.M6E_FSLW_BUS_ERROR_ON_READ;
5285: M68kException.m6eNumber = M68kException.M6E_ACCESS_FAULT;
5286: M68kException.m6eAddress = a;
5287: M68kException.m6eDirection = XEiJ.MPU_WR_READ;
5288: M68kException.m6eSize = XEiJ.MPU_SS_BYTE;
5289: throw M68kException.m6eSignal;
5290: }
5291: protected int mmdRws (int a) throws M68kException {
5292: return (short) mmdRwz (a);
5293: }
5294: protected int mmdRwz (int a) throws M68kException {
5295: M68kException.m6eFSLW |= M68kException.M6E_FSLW_BUS_ERROR_ON_READ;
5296: M68kException.m6eNumber = M68kException.M6E_ACCESS_FAULT;
5297: M68kException.m6eAddress = a;
5298: M68kException.m6eDirection = XEiJ.MPU_WR_READ;
5299: M68kException.m6eSize = XEiJ.MPU_SS_WORD;
5300: throw M68kException.m6eSignal;
5301: }
5302: protected int mmdRls (int a) throws M68kException {
5303: M68kException.m6eFSLW |= M68kException.M6E_FSLW_BUS_ERROR_ON_READ;
5304: M68kException.m6eNumber = M68kException.M6E_ACCESS_FAULT;
5305: M68kException.m6eAddress = a;
5306: M68kException.m6eDirection = XEiJ.MPU_WR_READ;
5307: M68kException.m6eSize = XEiJ.MPU_SS_LONG;
5308: throw M68kException.m6eSignal;
5309: }
5310:
5311:
5312:
5313: protected void mmdVb (int a, int d) {
5314: try {
5315: mmdWb (a, d);
5316: } catch (M68kException e) {
5317: }
5318: }
5319: protected void mmdVw (int a, int d) {
5320: try {
5321: mmdWw (a, d);
5322: } catch (M68kException e) {
5323: }
5324: }
5325: protected void mmdVl (int a, int d) {
5326: try {
5327: mmdWl (a, d);
5328: } catch (M68kException e) {
5329: }
5330: }
5331:
5332:
5333: protected void mmdWb (int a, int d) throws M68kException {
5334: M68kException.m6eFSLW |= M68kException.M6E_FSLW_BUS_ERROR_ON_WRITE;
5335: M68kException.m6eNumber = M68kException.M6E_ACCESS_FAULT;
5336: M68kException.m6eAddress = a;
5337: M68kException.m6eDirection = XEiJ.MPU_WR_WRITE;
5338: M68kException.m6eSize = XEiJ.MPU_SS_BYTE;
5339: throw M68kException.m6eSignal;
5340: }
5341: protected void mmdWw (int a, int d) throws M68kException {
5342: M68kException.m6eFSLW |= M68kException.M6E_FSLW_BUS_ERROR_ON_WRITE;
5343: M68kException.m6eNumber = M68kException.M6E_ACCESS_FAULT;
5344: M68kException.m6eAddress = a;
5345: M68kException.m6eDirection = XEiJ.MPU_WR_WRITE;
5346: M68kException.m6eSize = XEiJ.MPU_SS_WORD;
5347: throw M68kException.m6eSignal;
5348: }
5349: protected void mmdWl (int a, int d) throws M68kException {
5350: M68kException.m6eFSLW |= M68kException.M6E_FSLW_BUS_ERROR_ON_WRITE;
5351: M68kException.m6eNumber = M68kException.M6E_ACCESS_FAULT;
5352: M68kException.m6eAddress = a;
5353: M68kException.m6eDirection = XEiJ.MPU_WR_WRITE;
5354: M68kException.m6eSize = XEiJ.MPU_SS_LONG;
5355: throw M68kException.m6eSignal;
5356: }
5357: }
5358:
5359:
5360: