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: a &= XEiJ.BUS_MOTHER_MASK;
3580: if ((a & 0x01) == 0) {
3581: return 0xff;
3582: } else {
3583: if (SPC.spcSCSIINOn) {
3584: if ((a & 0x20) == 0) {
3585: return ((a & 0x02) == 0 ? 0x00 : 0xff);
3586: } else {
3587: if (SUK.SUK_ON) {
3588: if (SUK.sukOn) {
3589: return SUK.sukPeek (a);
3590: }
3591: }
3592: return SPC.spcSCSIINChip.spiPeek (a);
3593: }
3594: } else {
3595: switch (a & 0x3f) {
3596: case HDC.HDC_DATA_PORT & 0x3f:
3597: return HDC.hdcPeekData ();
3598: case HDC.HDC_STATUS_PORT & 0x3f:
3599: return HDC.hdcPeekStatus ();
3600: case HDC.HDC_RESET_PORT & 0x3f:
3601: return 0xff;
3602: case HDC.HDC_SELECTION_PORT & 0x3f:
3603: return 0xff;
3604: default:
3605: return 0xff;
3606: }
3607: }
3608: }
3609: }
3610: @Override protected int mmdPwz (int a) {
3611: a &= XEiJ.BUS_MOTHER_MASK;
3612: return 0xff00 | mmdPbz (a + 1);
3613: }
3614: @Override protected int mmdPls (int a) {
3615: a &= XEiJ.BUS_MOTHER_MASK;
3616: return 0xff00ff00 | mmdPbz (a + 1) << 16 | mmdPbz (a + 3);
3617: }
3618:
3619: @Override protected int mmdRbz (int a) throws M68kException {
3620: if ((a & 1) == 0 &&
3621: !XEiJ.currentIsSecond) {
3622: return super.mmdRbz (a);
3623: }
3624: XEiJ.mpuClockTime += XEiJ.busWaitTime.hdc;
3625: a &= XEiJ.BUS_MOTHER_MASK;
3626: if ((a & 0x01) == 0) {
3627: return super.mmdRbz (a);
3628: } else {
3629: if (SPC.spcSCSIINOn) {
3630: if ((a & 0x20) == 0) {
3631: return ((a & 0x02) == 0 ? 0x00 : 0xff);
3632: } else {
3633: if (SUK.SUK_ON) {
3634: if (SUK.sukOn) {
3635: return SUK.sukRead (a);
3636: }
3637: }
3638: return SPC.spcSCSIINChip.spiRead (a);
3639: }
3640: } else {
3641: switch (a & 0x3f) {
3642: case HDC.HDC_DATA_PORT & 0x3f:
3643: return HDC.hdcReadData ();
3644: case HDC.HDC_STATUS_PORT & 0x3f:
3645: return HDC.hdcReadStatus ();
3646: case HDC.HDC_RESET_PORT & 0x3f:
3647: return 0xff;
3648: case HDC.HDC_SELECTION_PORT & 0x3f:
3649: return 0xff;
3650: default:
3651: return 0xff;
3652: }
3653: }
3654: }
3655: }
3656: @Override protected int mmdRwz (int a) throws M68kException {
3657: return 0xff00 | mmdRbz (a + 1);
3658: }
3659: @Override protected int mmdRls (int a) throws M68kException {
3660: return 0xff00ff00 | mmdRbz (a + 1) << 16 | mmdRbz (a + 3);
3661: }
3662:
3663: @Override protected void mmdWb (int a, int d) throws M68kException {
3664: if ((a & 1) == 0 &&
3665: !XEiJ.currentIsSecond) {
3666: super.mmdWb (a, d);
3667: }
3668: XEiJ.mpuClockTime += XEiJ.busWaitTime.hdc;
3669: a &= XEiJ.BUS_MOTHER_MASK;
3670: if ((a & 0x01) == 0) {
3671: super.mmdWb (a, d);
3672: } else {
3673: if (SPC.spcSCSIINOn) {
3674: if ((a & 0x20) == 0) {
3675: return;
3676: } else {
3677: if (SUK.SUK_ON) {
3678: if (SUK.sukOn) {
3679: SUK.sukWrite (a, d);
3680: return;
3681: }
3682: }
3683: SPC.spcSCSIINChip.spiWrite (a, d);
3684: return;
3685: }
3686: } else {
3687: switch (a & 0x3f) {
3688: case HDC.HDC_DATA_PORT & 0x3f:
3689: HDC.hdcWriteData (d);
3690: return;
3691: case HDC.HDC_STATUS_PORT & 0x3f:
3692: HDC.hdcWriteCommand (d);
3693: return;
3694: case HDC.HDC_RESET_PORT & 0x3f:
3695: HDC.hdcWriteReset (d);
3696: return;
3697: case HDC.HDC_SELECTION_PORT & 0x3f:
3698: HDC.hdcWriteSelect (d);
3699: return;
3700: default:
3701: return;
3702: }
3703: }
3704: }
3705: }
3706: @Override protected void mmdWw (int a, int d) throws M68kException {
3707: mmdWb (a + 1, d);
3708: }
3709: @Override protected void mmdWl (int a, int d) throws M68kException {
3710: mmdWb (a + 1, d >> 16);
3711: mmdWb (a + 3, d);
3712: }
3713: },
3714:
3715:
3716:
3717:
3718:
3719:
3720:
3721:
3722: MMD_SCC {
3723: @Override public String toString () {
3724: return Multilingual.mlnJapanese ? "SCC" : "SCC";
3725: }
3726:
3727: @Override protected int mmdPbz (int a) {
3728: return Z8530.sccReadByte (a, true);
3729: }
3730: @Override protected int mmdPwz (int a) {
3731: return 0xff00 | mmdPbz (a + 1);
3732: }
3733: @Override protected int mmdPls (int a) {
3734: return 0xff00ff00 | mmdPbz (a + 1) << 16 | mmdPbz (a + 3);
3735: }
3736:
3737: @Override protected int mmdRbz (int a) throws M68kException {
3738: if ((a & 1) == 0 &&
3739: !XEiJ.currentIsSecond) {
3740: return super.mmdRbz (a);
3741: }
3742: return Z8530.sccReadByte (a, false);
3743: }
3744: @Override protected int mmdRwz (int a) throws M68kException {
3745: return 0xff00 | mmdRbz (a + 1);
3746: }
3747: @Override protected int mmdRls (int a) throws M68kException {
3748: return 0xff00ff00 | mmdRbz (a + 1) << 16 | mmdRbz (a + 3);
3749: }
3750:
3751: @Override protected void mmdWb (int a, int d) throws M68kException {
3752: if ((a & 1) == 0 &&
3753: !XEiJ.currentIsSecond) {
3754: super.mmdWb (a, d);
3755: }
3756: Z8530.sccWriteByte (a, d);
3757: }
3758: @Override protected void mmdWw (int a, int d) throws M68kException {
3759: mmdWb (a + 1, d);
3760: }
3761: @Override protected void mmdWl (int a, int d) throws M68kException {
3762: mmdWb (a + 1, d >> 16);
3763: mmdWb (a + 3, d);
3764: }
3765: },
3766:
3767:
3768:
3769:
3770:
3771:
3772:
3773:
3774: MMD_PPI {
3775: @Override public String toString () {
3776: return Multilingual.mlnJapanese ? "PPI" : "PPI";
3777: }
3778:
3779: @Override protected int mmdRbz (int a) throws M68kException {
3780: if ((a & 1) == 0 &&
3781: !XEiJ.currentIsSecond) {
3782: return super.mmdRbz (a);
3783: }
3784: XEiJ.mpuClockTime += XEiJ.busWaitTime.ppi;
3785: return PPI.ppiReadByte (a);
3786: }
3787: @Override protected int mmdRwz (int a) throws M68kException {
3788: return 0xff00 | mmdRbz (a + 1);
3789: }
3790: @Override protected int mmdRls (int a) throws M68kException {
3791: return 0xff00ff00 | mmdRbz (a + 1) << 16 | mmdRbz (a + 3);
3792: }
3793:
3794: @Override protected void mmdWb (int a, int d) throws M68kException {
3795: if ((a & 1) == 0 &&
3796: !XEiJ.currentIsSecond) {
3797: super.mmdWb (a, d);
3798: }
3799: XEiJ.mpuClockTime += XEiJ.busWaitTime.ppi;
3800: PPI.ppiWriteByte (a, d);
3801: }
3802: @Override protected void mmdWw (int a, int d) throws M68kException {
3803: mmdWb (a + 1, d);
3804: }
3805: @Override protected void mmdWl (int a, int d) throws M68kException {
3806: mmdWb (a + 1, d >> 16);
3807: mmdWb (a + 3, d);
3808: }
3809: },
3810:
3811:
3812:
3813:
3814:
3815:
3816:
3817:
3818: MMD_IOI {
3819: @Override public String toString () {
3820: return Multilingual.mlnJapanese ? "I/O 割り込み" : "I/O Interrupt";
3821: }
3822:
3823: @Override protected int mmdRbz (int a) throws M68kException {
3824: if ((a & 1) == 0 &&
3825: !XEiJ.currentIsSecond) {
3826: return super.mmdRbz (a);
3827: }
3828: XEiJ.mpuClockTime += XEiJ.busWaitTime.ioi;
3829: a &= XEiJ.BUS_MOTHER_MASK;
3830: if (a == IOInterrupt.IOI_STATUS) {
3831: return IOInterrupt.ioiReadStatus ();
3832: } else if (a == IOInterrupt.IOI_VECTOR) {
3833:
3834: return 0xff;
3835: } else {
3836: return super.mmdRbz (a);
3837: }
3838: }
3839: @Override protected int mmdRwz (int a) throws M68kException {
3840: return 0xff00 | mmdRbz (a + 1);
3841: }
3842: @Override protected int mmdRls (int a) throws M68kException {
3843: return 0xff00ff00 | mmdRbz (a + 1) << 16 | mmdRbz (a + 3);
3844: }
3845:
3846: @Override protected void mmdWb (int a, int d) throws M68kException {
3847: if ((a & 1) == 0 &&
3848: !XEiJ.currentIsSecond) {
3849: super.mmdWb (a, d);
3850: }
3851: XEiJ.mpuClockTime += XEiJ.busWaitTime.ioi;
3852: a &= XEiJ.BUS_MOTHER_MASK;
3853: if (a == IOInterrupt.IOI_STATUS) {
3854: IOInterrupt.ioiWriteEnable (d);
3855: } else if (a == IOInterrupt.IOI_VECTOR) {
3856: IOInterrupt.ioiWriteVector (d);
3857: } else {
3858: super.mmdWb (a, d);
3859: }
3860: }
3861: @Override protected void mmdWw (int a, int d) throws M68kException {
3862: mmdWb (a + 1, d);
3863: }
3864: @Override protected void mmdWl (int a, int d) throws M68kException {
3865: mmdWb (a + 1, d >> 16);
3866: mmdWb (a + 3, d);
3867: }
3868: },
3869:
3870:
3871:
3872: MMD_XB1 {
3873: @Override public String toString () {
3874: return Multilingual.mlnJapanese ? "拡張ボード領域 1" : "Expansion Board Area 1";
3875: }
3876:
3877: @Override protected int mmdPbz (int a) {
3878: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3879: return XEiJ.fpuCoproboard1.cirPeekByteZero (a);
3880: }
3881: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3882: return XEiJ.fpuCoproboard2.cirPeekByteZero (a);
3883: }
3884: if ((a & (XEiJ.BUS_MOTHER_MASK & -HFS.HFS_ROM_SIZE)) == HFS.HFS_ADDRESS) {
3885: a &= XEiJ.BUS_MOTHER_MASK;
3886: return MainMemory.mmrM8[a] & 0xff;
3887: }
3888: if (Keyboard.KBD_ZKEY_ON &&
3889: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3890: return Keyboard.kbdZKeyIOReadByte (a);
3891: }
3892: return 0xff;
3893: }
3894: @Override protected int mmdPwz (int a) {
3895: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3896: return XEiJ.fpuCoproboard1.cirPeekWordZero (a);
3897: }
3898: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3899: return XEiJ.fpuCoproboard2.cirPeekWordZero (a);
3900: }
3901: if ((a & (XEiJ.BUS_MOTHER_MASK & -HFS.HFS_ROM_SIZE)) == HFS.HFS_ADDRESS) {
3902: a &= XEiJ.BUS_MOTHER_MASK;
3903: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
3904: }
3905: if (Keyboard.KBD_ZKEY_ON &&
3906: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3907: return Keyboard.kbdZKeyIOReadWord (a);
3908: }
3909: return 0xffff;
3910: }
3911: @Override protected int mmdPls (int a) {
3912: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3913: return XEiJ.fpuCoproboard1.cirPeekLong (a);
3914: }
3915: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3916: return XEiJ.fpuCoproboard2.cirPeekLong (a);
3917: }
3918: if ((a & (XEiJ.BUS_MOTHER_MASK & -HFS.HFS_ROM_SIZE)) == HFS.HFS_ADDRESS) {
3919: a &= XEiJ.BUS_MOTHER_MASK;
3920: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
3921: }
3922: if (Keyboard.KBD_ZKEY_ON &&
3923: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3924: return Keyboard.kbdZKeyIOReadLong (a);
3925: }
3926: return -1;
3927: }
3928:
3929: @Override protected int mmdRbz (int a) throws M68kException {
3930: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3931: return XEiJ.fpuCoproboard1.cirReadByteZero (a);
3932: }
3933: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3934: return XEiJ.fpuCoproboard2.cirReadByteZero (a);
3935: }
3936: if ((a & (XEiJ.BUS_MOTHER_MASK & -HFS.HFS_ROM_SIZE)) == HFS.HFS_ADDRESS) {
3937: a &= XEiJ.BUS_MOTHER_MASK;
3938: return MainMemory.mmrM8[a] & 0xff;
3939: }
3940: if (Keyboard.KBD_ZKEY_ON &&
3941: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3942: return Keyboard.kbdZKeyIOReadByte (a);
3943: }
3944: return super.mmdRbz (a);
3945: }
3946: @Override protected int mmdRwz (int a) throws M68kException {
3947: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3948: return XEiJ.fpuCoproboard1.cirReadWordZero (a);
3949: }
3950: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3951: return XEiJ.fpuCoproboard2.cirReadWordZero (a);
3952: }
3953: if ((a & (XEiJ.BUS_MOTHER_MASK & -HFS.HFS_ROM_SIZE)) == HFS.HFS_ADDRESS) {
3954: a &= XEiJ.BUS_MOTHER_MASK;
3955: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
3956: }
3957: if (Keyboard.KBD_ZKEY_ON &&
3958: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3959: return Keyboard.kbdZKeyIOReadWord (a);
3960: }
3961: return super.mmdRwz (a);
3962: }
3963: @Override protected int mmdRls (int a) throws M68kException {
3964: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3965: return XEiJ.fpuCoproboard1.cirReadLong (a);
3966: }
3967: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3968: return XEiJ.fpuCoproboard2.cirReadLong (a);
3969: }
3970: if ((a & (XEiJ.BUS_MOTHER_MASK & -HFS.HFS_ROM_SIZE)) == HFS.HFS_ADDRESS) {
3971: a &= XEiJ.BUS_MOTHER_MASK;
3972: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
3973: }
3974: if (Keyboard.KBD_ZKEY_ON &&
3975: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3976: return Keyboard.kbdZKeyIOReadLong (a);
3977: }
3978: return super.mmdRls (a);
3979: }
3980:
3981: @Override protected void mmdWb (int a, int d) throws M68kException {
3982: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3983: XEiJ.fpuCoproboard1.cirWriteByte (a, d);
3984: return;
3985: }
3986: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
3987: XEiJ.fpuCoproboard2.cirWriteByte (a, d);
3988: return;
3989: }
3990: if (Keyboard.KBD_ZKEY_ON &&
3991: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
3992: Keyboard.kbdZKeyIOWriteByte (a, d);
3993: return;
3994: }
3995: super.mmdWb (a, d);
3996: }
3997: @Override protected void mmdWw (int a, int d) throws M68kException {
3998: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
3999: XEiJ.fpuCoproboard1.cirWriteWord (a, d);
4000: return;
4001: }
4002: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
4003: XEiJ.fpuCoproboard2.cirWriteWord (a, d);
4004: return;
4005: }
4006: if (Keyboard.KBD_ZKEY_ON &&
4007: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
4008: Keyboard.kbdZKeyIOWriteWord (a, d);
4009: return;
4010: }
4011: super.mmdWw (a, d);
4012: }
4013: @Override protected void mmdWl (int a, int d) throws M68kException {
4014: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e000) {
4015: XEiJ.fpuCoproboard1.cirWriteLong (a, d);
4016: return;
4017: }
4018: if ((a & (XEiJ.BUS_MOTHER_MASK & -0x20)) == 0x00e9e080) {
4019: XEiJ.fpuCoproboard2.cirWriteLong (a, d);
4020: return;
4021: }
4022: if (Keyboard.KBD_ZKEY_ON &&
4023: (a & (XEiJ.BUS_MOTHER_MASK & -Keyboard.KBD_ZKEY_IO_SIZE)) == Keyboard.KBD_ZKEY_IO_ADDRESS) {
4024: Keyboard.kbdZKeyIOWriteLong (a, d);
4025: return;
4026: }
4027: super.mmdWl (a, d);
4028: }
4029: },
4030:
4031:
4032:
4033:
4034:
4035:
4036: MMD_EXS {
4037: @Override public String toString () {
4038: return Multilingual.mlnJapanese ? "拡張 SCSI ポート" : "Expansion SCSI Port";
4039: }
4040:
4041: @Override protected byte mmdPbs (int a) {
4042: a &= XEiJ.BUS_MOTHER_MASK;
4043: return (a & -32) == SPC.SPC_BASE_EX ? (byte) SPC.spcSCSIEXChip.spiPeek (a) : MainMemory.mmrM8[a];
4044: }
4045: @Override protected int mmdPbz (int a) {
4046: a &= XEiJ.BUS_MOTHER_MASK;
4047: return (a & -32) == SPC.SPC_BASE_EX ? SPC.spcSCSIEXChip.spiPeek (a) : MainMemory.mmrM8[a] & 0xff;
4048: }
4049: @Override protected int mmdPws (int a) {
4050: a &= XEiJ.BUS_MOTHER_MASK;
4051: return mmdPbs (a) << 8 | mmdPbz (a + 1);
4052: }
4053: @Override protected int mmdPwz (int a) {
4054: a &= XEiJ.BUS_MOTHER_MASK;
4055: return mmdPbz (a) << 8 | mmdPbz (a + 1);
4056: }
4057: @Override protected int mmdPls (int a) {
4058: a &= XEiJ.BUS_MOTHER_MASK;
4059: return mmdPbs (a) << 24 | mmdPbz (a + 1) << 16 | mmdPbz (a + 2) << 8 | mmdPbz (a + 3);
4060: }
4061:
4062: @Override protected byte mmdRbs (int a) throws M68kException {
4063: a &= XEiJ.BUS_MOTHER_MASK;
4064: return (a & -32) == SPC.SPC_BASE_EX ? (byte) SPC.spcSCSIEXChip.spiRead (a) : MainMemory.mmrM8[a];
4065: }
4066: @Override protected int mmdRbz (int a) throws M68kException {
4067: a &= XEiJ.BUS_MOTHER_MASK;
4068: return (a & -32) == SPC.SPC_BASE_EX ? SPC.spcSCSIEXChip.spiRead (a) : MainMemory.mmrM8[a] & 0xff;
4069: }
4070: @Override protected int mmdRws (int a) throws M68kException {
4071: a &= XEiJ.BUS_MOTHER_MASK;
4072: return mmdRbs (a) << 8 | mmdRbz (a + 1);
4073: }
4074: @Override protected int mmdRwz (int a) throws M68kException {
4075: a &= XEiJ.BUS_MOTHER_MASK;
4076: return mmdRbz (a) << 8 | mmdRbz (a + 1);
4077: }
4078: @Override protected int mmdRls (int a) throws M68kException {
4079: a &= XEiJ.BUS_MOTHER_MASK;
4080: return mmdRbs (a) << 24 | mmdRbz (a + 1) << 16 | mmdRbz (a + 2) << 8 | mmdRbz (a + 3);
4081: }
4082:
4083: @Override protected void mmdWb (int a, int d) throws M68kException {
4084: a &= XEiJ.BUS_MOTHER_MASK;
4085: if ((a & -32) == SPC.SPC_BASE_EX) {
4086: SPC.spcSCSIEXChip.spiWrite (a, d);
4087: return;
4088: }
4089: super.mmdWb (a, d);
4090: }
4091: @Override protected void mmdWw (int a, int d) throws M68kException {
4092: a &= XEiJ.BUS_MOTHER_MASK;
4093: mmdWb (a , d >> 8);
4094: mmdWb (a + 1, d );
4095: }
4096: @Override protected void mmdWl (int a, int d) throws M68kException {
4097: a &= XEiJ.BUS_MOTHER_MASK;
4098: mmdWw (a , d >> 16);
4099: mmdWw (a + 2, d );
4100: }
4101: },
4102:
4103:
4104:
4105:
4106:
4107:
4108:
4109:
4110:
4111:
4112:
4113:
4114:
4115:
4116:
4117:
4118:
4119:
4120:
4121:
4122: MMD_XB2 {
4123: @Override public String toString () {
4124: return Multilingual.mlnJapanese ? "拡張ボード領域 2" : "Expansion Board Area 2";
4125: }
4126:
4127: @Override protected int mmdRbz (int a) throws M68kException {
4128: a &= XEiJ.BUS_MOTHER_MASK;
4129: if (0x00eaff81 <= a && a <= 0x00eaff89 && (a & 1) != 0) {
4130: return MainMemory.mmrM8[a] & 0xff;
4131: }
4132: if (XEiJ.bnkOn && a == 0x00eaff7f) {
4133: return XEiJ.bnkPageStart >> 17;
4134: }
4135: return super.mmdRbz (a);
4136: }
4137:
4138: @Override protected void mmdWb (int a, int d) throws M68kException {
4139: a &= XEiJ.BUS_MOTHER_MASK;
4140: if (0x00eaff81 <= a && a <= 0x00eaff89 && (a & 1) != 0) {
4141: MainMemory.mmrM8[a] = (byte) d;
4142: a = (a & 14) + 2 << 20;
4143: for (int m = 1; m <= 128; m <<= 1) {
4144: if ((d & m) == 0) {
4145: XEiJ.busUser ( MemoryMappedDevice.MMD_MMR, a, a + 0x00040000);
4146: } else {
4147: XEiJ.busSuper (MemoryMappedDevice.MMD_MMR, a, a + 0x00040000);
4148: }
4149: a += 0x00040000;
4150: }
4151: return;
4152: }
4153: if (XEiJ.bnkOn && a == 0x00eaff7f) {
4154: XEiJ.bnkPageStart = (d & 0xff) << 17;
4155: return;
4156: }
4157: super.mmdWb (a, d);
4158: }
4159: },
4160:
4161:
4162:
4163:
4164:
4165:
4166:
4167:
4168:
4169:
4170:
4171:
4172:
4173:
4174:
4175:
4176:
4177:
4178:
4179:
4180:
4181: MMD_SPR {
4182: @Override public String toString () {
4183: return Multilingual.mlnJapanese ? "スプライト画面" : "Sprite Screen";
4184: }
4185:
4186: @Override protected byte mmdRbs (int a) throws M68kException {
4187: a &= XEiJ.BUS_MOTHER_MASK;
4188: return (a & 1) == 0 ? (byte) (mmdRwz (a) >> 8) : (byte) mmdRwz (a - 1);
4189: }
4190: @Override protected int mmdRbz (int a) throws M68kException {
4191: a &= XEiJ.BUS_MOTHER_MASK;
4192: return (a & 1) == 0 ? mmdRwz (a) >> 8 : mmdRwz (a - 1) & 0xff;
4193: }
4194: @Override protected int mmdRws (int a) throws M68kException {
4195: a &= XEiJ.BUS_MOTHER_MASK;
4196: return (short) mmdRwz (a);
4197: }
4198: @Override protected int mmdRwz (int a) throws M68kException {
4199: XEiJ.mpuClockTime += XEiJ.busWaitTime.sprc;
4200: a &= XEiJ.BUS_MOTHER_MASK;
4201: if (a < 0x00eb0800) {
4202: if (!SpriteScreen.sprAccessible) {
4203: return super.mmdRwz (a);
4204: }
4205: int n = (a >> 3) & 0xff;
4206: if (SpriteScreen.sprNumberOfSprites <= n) {
4207: return 0xffff;
4208: }
4209: switch (a & 0x06) {
4210: case 0:
4211: return SpriteScreen.sprX[n];
4212: case 2:
4213: return SpriteScreen.sprY[n];
4214: case 4:
4215: return (SpriteScreen.sprV[n] ? 0x8000 : 0) | (SpriteScreen.sprH[n] ? 0x4000 : 0) | SpriteScreen.sprColPort[n] << 4 | SpriteScreen.sprNum[n];
4216: case 6:
4217: return SpriteScreen.sprPrw[n];
4218: }
4219: } else if (a < 0x00eb8000) {
4220: switch (a) {
4221: case SpriteScreen.SPR_REG0_BG0_X:
4222: return SpriteScreen.sprReg0Bg0XPort;
4223: case SpriteScreen.SPR_REG1_BG0_Y:
4224: return SpriteScreen.sprReg1Bg0YPort;
4225: case SpriteScreen.SPR_REG2_BG1_X:
4226: return SpriteScreen.sprReg2Bg1XPort;
4227: case SpriteScreen.SPR_REG3_BG1_Y:
4228: return SpriteScreen.sprReg3Bg1YPort;
4229: case SpriteScreen.SPR_REG4_BG_CTRL:
4230: return SpriteScreen.sprReg4BgCtrlPort;
4231: case SpriteScreen.SPR_REG5_H_FRONT_END:
4232: return SpriteScreen.sprReg5HFrontEndPort;
4233: case SpriteScreen.SPR_REG6_H_BACK_END:
4234: return SpriteScreen.sprReg6HBackEndPort;
4235: case SpriteScreen.SPR_REG7_V_BACK_END:
4236: return SpriteScreen.sprReg7VBackEndPort;
4237: case SpriteScreen.SPR_REG8_RESO:
4238: return SpriteScreen.sprReg8ResoPort;
4239: }
4240: return 0xffff;
4241: } else {
4242: if (!SpriteScreen.sprAccessible) {
4243: return super.mmdRwz (a);
4244: }
4245: int t = a >> 2 & 0x1fff;
4246: return (a & 0x02) == 0 ? SpriteScreen.sprPatPort[t] >>> 16 : (char) SpriteScreen.sprPatPort[t];
4247: }
4248: return 0;
4249: }
4250: @Override protected int mmdRls (int a) throws M68kException {
4251: a &= XEiJ.BUS_MOTHER_MASK;
4252: return mmdRwz (a) << 16 | mmdRwz (a + 2);
4253: }
4254:
4255: @Override protected void mmdWb (int a, int d) throws M68kException {
4256: a &= XEiJ.BUS_MOTHER_MASK;
4257: if (a < 0x00eb0800 || 0x00eb8000 <= a) {
4258: mmdWw (a & ~1, d << 8 | (d & 0xff));
4259: } else {
4260: if ((a & 1) == 0) {
4261: mmdWw (a, d << 8 | (mmdRwz (a) & 0xff));
4262: } else {
4263: mmdWw (a - 1, (mmdRwz (a - 1) & ~0xff) | (d & 0xff));
4264: }
4265: }
4266: }
4267: @Override protected void mmdWw (int a, int d) throws M68kException {
4268: XEiJ.mpuClockTime += XEiJ.busWaitTime.sprc;
4269: a &= XEiJ.BUS_MOTHER_MASK;
4270: if (a < 0x00eb0800) {
4271: if (!SpriteScreen.sprAccessible) {
4272: super.mmdWw (a, d);
4273: }
4274: int n = (a >> 3) & 0xff;
4275: if (SpriteScreen.sprNumberOfSprites <= n) {
4276: return;
4277: }
4278: switch (a & 0x06) {
4279: case 0:
4280: SpriteScreen.sprX[n] = (short) (d & 1023);
4281: break;
4282: case 2:
4283: d &= 1023;
4284: if (SpriteScreen.sprY[n] != d) {
4285: int y = SpriteScreen.sprY[n];
4286: SpriteScreen.sprY[n] = (short) d;
4287: if (SpriteScreen.sprPrw[n] != 0) {
4288: int mask = ~(0x80000000 >>> n);
4289: int i = y << 3 | n >> 5;
4290: SpriteScreen.sprRRmap[i ] &= mask;
4291: SpriteScreen.sprRRmap[i + ( 1 << 3)] &= mask;
4292: SpriteScreen.sprRRmap[i + ( 2 << 3)] &= mask;
4293: SpriteScreen.sprRRmap[i + ( 3 << 3)] &= mask;
4294: SpriteScreen.sprRRmap[i + ( 4 << 3)] &= mask;
4295: SpriteScreen.sprRRmap[i + ( 5 << 3)] &= mask;
4296: SpriteScreen.sprRRmap[i + ( 6 << 3)] &= mask;
4297: SpriteScreen.sprRRmap[i + ( 7 << 3)] &= mask;
4298: SpriteScreen.sprRRmap[i + ( 8 << 3)] &= mask;
4299: SpriteScreen.sprRRmap[i + ( 9 << 3)] &= mask;
4300: SpriteScreen.sprRRmap[i + (10 << 3)] &= mask;
4301: SpriteScreen.sprRRmap[i + (11 << 3)] &= mask;
4302: SpriteScreen.sprRRmap[i + (12 << 3)] &= mask;
4303: SpriteScreen.sprRRmap[i + (13 << 3)] &= mask;
4304: SpriteScreen.sprRRmap[i + (14 << 3)] &= mask;
4305: SpriteScreen.sprRRmap[i + (15 << 3)] &= mask;
4306: mask = ~mask;
4307: i = d << 3 | n >> 5;
4308: SpriteScreen.sprRRmap[i ] |= mask;
4309: SpriteScreen.sprRRmap[i + ( 1 << 3)] |= mask;
4310: SpriteScreen.sprRRmap[i + ( 2 << 3)] |= mask;
4311: SpriteScreen.sprRRmap[i + ( 3 << 3)] |= mask;
4312: SpriteScreen.sprRRmap[i + ( 4 << 3)] |= mask;
4313: SpriteScreen.sprRRmap[i + ( 5 << 3)] |= mask;
4314: SpriteScreen.sprRRmap[i + ( 6 << 3)] |= mask;
4315: SpriteScreen.sprRRmap[i + ( 7 << 3)] |= mask;
4316: SpriteScreen.sprRRmap[i + ( 8 << 3)] |= mask;
4317: SpriteScreen.sprRRmap[i + ( 9 << 3)] |= mask;
4318: SpriteScreen.sprRRmap[i + (10 << 3)] |= mask;
4319: SpriteScreen.sprRRmap[i + (11 << 3)] |= mask;
4320: SpriteScreen.sprRRmap[i + (12 << 3)] |= mask;
4321: SpriteScreen.sprRRmap[i + (13 << 3)] |= mask;
4322: SpriteScreen.sprRRmap[i + (14 << 3)] |= mask;
4323: SpriteScreen.sprRRmap[i + (15 << 3)] |= mask;
4324: }
4325: }
4326: break;
4327: case 4:
4328: {
4329: int num = SpriteScreen.sprNum[n];
4330: SpriteScreen.sprNum[n] = (short) (d & 0xff);
4331: SpriteScreen.sprColPort[n] = (short) (d >> 4 & 0x0f << 4);
4332: SpriteScreen.sprH[n] = (short) (d << 1) < 0;
4333: SpriteScreen.sprV[n] = (short) d < 0;
4334: if (SpriteScreen.sprPrw[n] != 0) {
4335: int mask = 0x80000000 >>> n;
4336: SpriteScreen.sprPPmap[num << 3 | n >> 5] &= ~mask;
4337: SpriteScreen.sprPPmap[(d & 0xff) << 3 | n >> 5] |= mask;
4338: }
4339: }
4340: break;
4341: case 6:
4342: d &= 0x0003;
4343: int prw = SpriteScreen.sprPrw[n];
4344: SpriteScreen.sprPrw[n] = (byte) d;
4345: if (prw != d) {
4346: if (prw == 0) {
4347: int y = SpriteScreen.sprY[n];
4348: int mask = 0x80000000 >>> n;
4349: int i = y << 3 | n >> 5;
4350: SpriteScreen.sprRRmap[i ] |= mask;
4351: SpriteScreen.sprRRmap[i + ( 1 << 3)] |= mask;
4352: SpriteScreen.sprRRmap[i + ( 2 << 3)] |= mask;
4353: SpriteScreen.sprRRmap[i + ( 3 << 3)] |= mask;
4354: SpriteScreen.sprRRmap[i + ( 4 << 3)] |= mask;
4355: SpriteScreen.sprRRmap[i + ( 5 << 3)] |= mask;
4356: SpriteScreen.sprRRmap[i + ( 6 << 3)] |= mask;
4357: SpriteScreen.sprRRmap[i + ( 7 << 3)] |= mask;
4358: SpriteScreen.sprRRmap[i + ( 8 << 3)] |= mask;
4359: SpriteScreen.sprRRmap[i + ( 9 << 3)] |= mask;
4360: SpriteScreen.sprRRmap[i + (10 << 3)] |= mask;
4361: SpriteScreen.sprRRmap[i + (11 << 3)] |= mask;
4362: SpriteScreen.sprRRmap[i + (12 << 3)] |= mask;
4363: SpriteScreen.sprRRmap[i + (13 << 3)] |= mask;
4364: SpriteScreen.sprRRmap[i + (14 << 3)] |= mask;
4365: SpriteScreen.sprRRmap[i + (15 << 3)] |= mask;
4366: SpriteScreen.sprPPmap[SpriteScreen.sprNum[n] << 3 | n >> 5] |= mask;
4367: } else if (d == 0) {
4368: int y = SpriteScreen.sprY[n];
4369: int mask = ~(0x80000000 >>> n);
4370: int i = y << 3 | n >> 5;
4371: SpriteScreen.sprRRmap[i ] &= mask;
4372: SpriteScreen.sprRRmap[i + ( 1 << 3)] &= mask;
4373: SpriteScreen.sprRRmap[i + ( 2 << 3)] &= mask;
4374: SpriteScreen.sprRRmap[i + ( 3 << 3)] &= mask;
4375: SpriteScreen.sprRRmap[i + ( 4 << 3)] &= mask;
4376: SpriteScreen.sprRRmap[i + ( 5 << 3)] &= mask;
4377: SpriteScreen.sprRRmap[i + ( 6 << 3)] &= mask;
4378: SpriteScreen.sprRRmap[i + ( 7 << 3)] &= mask;
4379: SpriteScreen.sprRRmap[i + ( 8 << 3)] &= mask;
4380: SpriteScreen.sprRRmap[i + ( 9 << 3)] &= mask;
4381: SpriteScreen.sprRRmap[i + (10 << 3)] &= mask;
4382: SpriteScreen.sprRRmap[i + (11 << 3)] &= mask;
4383: SpriteScreen.sprRRmap[i + (12 << 3)] &= mask;
4384: SpriteScreen.sprRRmap[i + (13 << 3)] &= mask;
4385: SpriteScreen.sprRRmap[i + (14 << 3)] &= mask;
4386: SpriteScreen.sprRRmap[i + (15 << 3)] &= mask;
4387: SpriteScreen.sprPPmap[SpriteScreen.sprNum[n] << 3 | n >> 5] &= mask;
4388: }
4389: }
4390: break;
4391: }
4392: return;
4393: } else if (a < 0x00eb8000) {
4394: switch (a) {
4395: case SpriteScreen.SPR_REG0_BG0_X:
4396: SpriteScreen.sprReg0Bg0XPort = d & 1023;
4397: {
4398: int curr = SpriteScreen.sprReg0Bg0XMask == 0 ? SpriteScreen.sprReg0Bg0XPort : SpriteScreen.sprReg0Bg0XTest;
4399: if (SpriteScreen.sprReg0Bg0XCurr != curr) {
4400: SpriteScreen.sprReg0Bg0XCurr = curr;
4401: }
4402: }
4403: return;
4404: case SpriteScreen.SPR_REG1_BG0_Y:
4405: SpriteScreen.sprReg1Bg0YPort = d & 1023;
4406: {
4407: int curr = SpriteScreen.sprReg1Bg0YMask == 0 ? SpriteScreen.sprReg1Bg0YPort : SpriteScreen.sprReg1Bg0YTest;
4408: if (SpriteScreen.sprReg1Bg0YCurr != curr) {
4409: SpriteScreen.sprReg1Bg0YCurr = curr;
4410: }
4411: }
4412: return;
4413: case SpriteScreen.SPR_REG2_BG1_X:
4414: SpriteScreen.sprReg2Bg1XPort = d & 1023;
4415: {
4416: int curr = SpriteScreen.sprReg2Bg1XMask == 0 ? SpriteScreen.sprReg2Bg1XPort : SpriteScreen.sprReg2Bg1XTest;
4417: if (SpriteScreen.sprReg2Bg1XCurr != curr) {
4418: SpriteScreen.sprReg2Bg1XCurr = curr;
4419: }
4420: }
4421: return;
4422: case SpriteScreen.SPR_REG3_BG1_Y:
4423: SpriteScreen.sprReg3Bg1YPort = d & 1023;
4424: {
4425: int curr = SpriteScreen.sprReg3Bg1YMask == 0 ? SpriteScreen.sprReg3Bg1YPort : SpriteScreen.sprReg3Bg1YTest;
4426: if (SpriteScreen.sprReg3Bg1YCurr != curr) {
4427: SpriteScreen.sprReg3Bg1YCurr = curr;
4428: }
4429: }
4430: return;
4431: case SpriteScreen.SPR_REG4_BG_CTRL:
4432: SpriteScreen.sprReg4BgCtrlPort = d & 2047;
4433: {
4434: int curr = SpriteScreen.sprReg4BgCtrlPort & ~SpriteScreen.sprReg4BgCtrlMask | SpriteScreen.sprReg4BgCtrlTest & SpriteScreen.sprReg4BgCtrlMask;
4435: if (SpriteScreen.sprReg4BgCtrlCurr != curr) {
4436: SpriteScreen.sprReg4BgCtrlCurr = curr;
4437: }
4438: }
4439: return;
4440: case SpriteScreen.SPR_REG5_H_FRONT_END:
4441: SpriteScreen.sprReg5HFrontEndPort = d & 0xff;
4442: {
4443: int curr = SpriteScreen.sprReg5HFrontEndMask == 0 ? SpriteScreen.sprReg5HFrontEndPort : SpriteScreen.sprReg5HFrontEndTest;
4444: if (SpriteScreen.sprReg5HFrontEndCurr != curr) {
4445: SpriteScreen.sprReg5HFrontEndCurr = curr;
4446: }
4447: }
4448: return;
4449: case SpriteScreen.SPR_REG6_H_BACK_END:
4450: SpriteScreen.sprReg6HBackEndPort = d & 63;
4451: {
4452: int curr = SpriteScreen.sprReg6HBackEndMask == 0 ? SpriteScreen.sprReg6HBackEndPort : SpriteScreen.sprReg6HBackEndTest;
4453: if (SpriteScreen.sprReg6HBackEndCurr != curr) {
4454: SpriteScreen.sprReg6HBackEndCurr = curr;
4455: }
4456: }
4457: return;
4458: case SpriteScreen.SPR_REG7_V_BACK_END:
4459: SpriteScreen.sprReg7VBackEndPort = d & 0xff;
4460: {
4461: int curr = SpriteScreen.sprReg7VBackEndMask == 0 ? SpriteScreen.sprReg7VBackEndPort : SpriteScreen.sprReg7VBackEndTest;
4462: if (SpriteScreen.sprReg7VBackEndCurr != curr) {
4463: SpriteScreen.sprReg7VBackEndCurr = curr;
4464: }
4465: }
4466: return;
4467: case SpriteScreen.SPR_REG8_RESO:
4468: SpriteScreen.sprReg8ResoPort = d & 31;
4469: {
4470: int curr = SpriteScreen.sprReg8ResoPort & ~SpriteScreen.sprReg8ResoMask | SpriteScreen.sprReg8ResoTest & SpriteScreen.sprReg8ResoMask;
4471: if (SpriteScreen.sprReg8ResoCurr != curr) {
4472: SpriteScreen.sprReg8ResoCurr = curr;
4473: CRTC.crtRestart ();
4474: }
4475: }
4476: return;
4477: }
4478: return;
4479: } else {
4480: if (!SpriteScreen.sprAccessible) {
4481: super.mmdWw (a, d);
4482: }
4483: if (0x00ebe000 <= a) {
4484: int n = a >> 1 & 0x0fff;
4485: SpriteScreen.sprT1Num[n] = (short) ((d & 0xff) << 3);
4486: SpriteScreen.sprT1ColPort[n] = (short) ((d & 0x0f00) >> 4);
4487: SpriteScreen.sprT1H[n] = (short) (d << 1) < 0;
4488: SpriteScreen.sprT1V[n] = (short) d < 0;
4489: } else if (0x00ebc000 <= a) {
4490: int n = a >> 1 & 0x0fff;
4491: SpriteScreen.sprT0Num[n] = (short) ((d & 0xff) << 3);
4492: SpriteScreen.sprT0ColPort[n] = (short) ((d & 0x0f00) >> 4);
4493: SpriteScreen.sprT0H[n] = (short) (d << 1) < 0;
4494: SpriteScreen.sprT0V[n] = (short) d < 0;
4495: }
4496: int t = a >> 2 & 0x1fff;
4497: SpriteScreen.sprPatPort[t] = (a & 0x02) == 0 ? d << 16 | (char) SpriteScreen.sprPatPort[t] : (SpriteScreen.sprPatPort[t] & ~0xffff) | (char) d;
4498: }
4499: }
4500: @Override protected void mmdWl (int a, int d) throws M68kException {
4501: a &= XEiJ.BUS_MOTHER_MASK;
4502: mmdWw (a , d >> 16);
4503: mmdWw (a + 2, d );
4504: }
4505: },
4506:
4507:
4508:
4509:
4510:
4511:
4512:
4513:
4514:
4515:
4516: MMD_XB3 {
4517: @Override public String toString () {
4518: return Multilingual.mlnJapanese ? "拡張ボード領域 3" : "Expansion Board Area 3";
4519: }
4520:
4521: @Override protected int mmdRbz (int a) throws M68kException {
4522: a &= XEiJ.BUS_MOTHER_MASK;
4523: if (XEiJ.currentAccelerator == XEiJ.ACCELERATOR_XELLENT30 &&
4524: XEiJ.xt3PortAddress <= a && a < XEiJ.xt3PortAddress + 0x4000) {
4525: return (a & 1) == 0 ? 0 : XEiJ.xt3PortRead ();
4526: }
4527: return super.mmdRbz (a);
4528: }
4529: @Override protected int mmdRwz (int a) throws M68kException {
4530: a &= XEiJ.BUS_MOTHER_MASK;
4531: if (XEiJ.currentAccelerator == XEiJ.ACCELERATOR_XELLENT30 &&
4532: XEiJ.xt3PortAddress <= a && a < XEiJ.xt3PortAddress + 0x4000) {
4533: return XEiJ.xt3PortRead ();
4534: }
4535: return super.mmdRwz (a);
4536: }
4537: @Override protected int mmdRls (int a) throws M68kException {
4538: a &= XEiJ.BUS_MOTHER_MASK;
4539: if (XEiJ.currentAccelerator == XEiJ.ACCELERATOR_XELLENT30 &&
4540: XEiJ.xt3PortAddress <= a && a < XEiJ.xt3PortAddress + 0x4000) {
4541: return XEiJ.xt3PortRead () << 16 | XEiJ.xt3PortRead ();
4542: }
4543: return super.mmdRls (a);
4544: }
4545: @Override protected void mmdWb (int a, int d) throws M68kException {
4546: a &= XEiJ.BUS_MOTHER_MASK;
4547: if (XEiJ.currentAccelerator == XEiJ.ACCELERATOR_XELLENT30 &&
4548: XEiJ.xt3PortAddress <= a && a < XEiJ.xt3PortAddress + 0x4000) {
4549: if ((a & 1) == 0) {
4550: } else {
4551: XEiJ.xt3PortWrite (d);
4552: }
4553: return;
4554: }
4555: super.mmdWb (a, d);
4556: }
4557: @Override protected void mmdWw (int a, int d) throws M68kException {
4558: a &= XEiJ.BUS_MOTHER_MASK;
4559: if (XEiJ.currentAccelerator == XEiJ.ACCELERATOR_XELLENT30 &&
4560: XEiJ.xt3PortAddress <= a && a < XEiJ.xt3PortAddress + 0x4000) {
4561: XEiJ.xt3PortWrite (d);
4562: return;
4563: }
4564: super.mmdWw (a, d);
4565: }
4566: @Override protected void mmdWl (int a, int d) throws M68kException {
4567: a &= XEiJ.BUS_MOTHER_MASK;
4568: if (XEiJ.currentAccelerator == XEiJ.ACCELERATOR_XELLENT30 &&
4569: XEiJ.xt3PortAddress <= a && a < XEiJ.xt3PortAddress + 0x4000) {
4570: XEiJ.xt3PortWrite (d >> 16);
4571: XEiJ.xt3PortWrite (d);
4572: return;
4573: }
4574: super.mmdWl (a, d);
4575: }
4576: },
4577:
4578:
4579:
4580: MMD_XTM {
4581: @Override public String toString () {
4582: return Multilingual.mlnJapanese ? "Xellent30 の SRAM" : "SRAM on Xellent30";
4583: }
4584:
4585: @Override protected byte mmdPbs (int a) {
4586: a -= XEiJ.xt3MemoryPosition;
4587: return XEiJ.xt3MemoryArray[a];
4588: }
4589: @Override protected int mmdPbz (int a) {
4590: a -= XEiJ.xt3MemoryPosition;
4591: return XEiJ.xt3MemoryArray[a] & 0xff;
4592: }
4593: @Override protected int mmdPws (int a) {
4594: a -= XEiJ.xt3MemoryPosition;
4595: return XEiJ.xt3MemoryArray[a] << 8 | (XEiJ.xt3MemoryArray[a + 1] & 0xff);
4596: }
4597: @Override protected int mmdPwz (int a) {
4598: a -= XEiJ.xt3MemoryPosition;
4599: return (char) (XEiJ.xt3MemoryArray[a] << 8 | (XEiJ.xt3MemoryArray[a + 1] & 0xff));
4600: }
4601: @Override protected int mmdPls (int a) {
4602: a -= XEiJ.xt3MemoryPosition;
4603: return XEiJ.xt3MemoryArray[a] << 24 | (XEiJ.xt3MemoryArray[a + 1] & 0xff) << 16 | (char) (XEiJ.xt3MemoryArray[a + 2] << 8 | (XEiJ.xt3MemoryArray[a + 3] & 0xff));
4604: }
4605:
4606: @Override protected byte mmdRbs (int a) throws M68kException {
4607: a -= XEiJ.xt3MemoryPosition;
4608: return XEiJ.xt3MemoryArray[a];
4609: }
4610: @Override protected int mmdRbz (int a) throws M68kException {
4611: a -= XEiJ.xt3MemoryPosition;
4612: return XEiJ.xt3MemoryArray[a] & 0xff;
4613: }
4614: @Override protected int mmdRws (int a) throws M68kException {
4615: a -= XEiJ.xt3MemoryPosition;
4616: return XEiJ.xt3MemoryArray[a] << 8 | (XEiJ.xt3MemoryArray[a + 1] & 0xff);
4617: }
4618: @Override protected int mmdRwz (int a) throws M68kException {
4619: a -= XEiJ.xt3MemoryPosition;
4620: return (char) (XEiJ.xt3MemoryArray[a] << 8 | (XEiJ.xt3MemoryArray[a + 1] & 0xff));
4621: }
4622: @Override protected int mmdRls (int a) throws M68kException {
4623: a -= XEiJ.xt3MemoryPosition;
4624: return XEiJ.xt3MemoryArray[a] << 24 | (XEiJ.xt3MemoryArray[a + 1] & 0xff) << 16 | (char) (XEiJ.xt3MemoryArray[a + 2] << 8 | (XEiJ.xt3MemoryArray[a + 3] & 0xff));
4625: }
4626:
4627: @Override protected void mmdWb (int a, int d) throws M68kException {
4628: a -= XEiJ.xt3MemoryPosition;
4629: XEiJ.xt3MemoryArray[a ] = (byte) d;
4630: }
4631: @Override protected void mmdWw (int a, int d) throws M68kException {
4632: a -= XEiJ.xt3MemoryPosition;
4633: XEiJ.xt3MemoryArray[a ] = (byte) (d >> 8);
4634: XEiJ.xt3MemoryArray[a + 1] = (byte) d;
4635: }
4636: @Override protected void mmdWl (int a, int d) throws M68kException {
4637: a -= XEiJ.xt3MemoryPosition;
4638: XEiJ.xt3MemoryArray[a ] = (byte) (d >> 24);
4639: XEiJ.xt3MemoryArray[a + 1] = (byte) (d >> 16);
4640: XEiJ.xt3MemoryArray[a + 2] = (byte) (d >> 8);
4641: XEiJ.xt3MemoryArray[a + 3] = (byte) d;
4642: }
4643: },
4644:
4645:
4646:
4647: MMD_SMR {
4648: @Override public String toString () {
4649: return Multilingual.mlnJapanese ? "SRAM" : "SRAM";
4650: }
4651:
4652: @Override protected byte mmdPbs (int a) {
4653: a &= XEiJ.BUS_MOTHER_MASK;
4654: return MainMemory.mmrM8[a];
4655: }
4656: @Override protected int mmdPbz (int a) {
4657: a &= XEiJ.BUS_MOTHER_MASK;
4658: return MainMemory.mmrM8[a] & 0xff;
4659: }
4660: @Override protected int mmdPws (int a) {
4661: a &= XEiJ.BUS_MOTHER_MASK;
4662: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4663: return MainMemory.mmrBuffer.getShort (a);
4664: } else {
4665: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
4666: }
4667: }
4668: @Override protected int mmdPwz (int a) {
4669: a &= XEiJ.BUS_MOTHER_MASK;
4670: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4671: return MainMemory.mmrBuffer.getChar (a);
4672: } else {
4673: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
4674: }
4675: }
4676: @Override protected int mmdPls (int a) {
4677: a &= XEiJ.BUS_MOTHER_MASK;
4678: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4679: return MainMemory.mmrBuffer.getInt (a);
4680: } else {
4681: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
4682: }
4683: }
4684:
4685: @Override protected byte mmdRbs (int a) throws M68kException {
4686: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4687: a &= XEiJ.BUS_MOTHER_MASK;
4688: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4689: return MainMemory.mmrM8[a];
4690: }
4691: @Override protected int mmdRbz (int a) throws M68kException {
4692: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4693: a &= XEiJ.BUS_MOTHER_MASK;
4694: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4695: return MainMemory.mmrM8[a] & 0xff;
4696: }
4697: @Override protected int mmdRws (int a) throws M68kException {
4698: return (short) mmdRwz (a);
4699: }
4700: @Override protected int mmdRwz (int a) throws M68kException {
4701: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4702: a &= XEiJ.BUS_MOTHER_MASK;
4703: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4704: int d;
4705: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4706: d = MainMemory.mmrBuffer.getChar (a);
4707: } else {
4708: d = (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
4709: }
4710: return d;
4711: }
4712: @Override protected int mmdRls (int a) throws M68kException {
4713: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram * 2;
4714: a &= XEiJ.BUS_MOTHER_MASK;
4715: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram * 2;
4716: int d;
4717: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4718: d = MainMemory.mmrBuffer.getInt (a);
4719: } else {
4720: d = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
4721: }
4722: return d;
4723: }
4724:
4725: @Override protected void mmdWb (int a, int d) throws M68kException {
4726: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4727: if (SRAM.smrWriteEnableOn) {
4728: a &= XEiJ.BUS_MOTHER_MASK;
4729: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4730: MainMemory.mmrM8[a] = (byte) d;
4731: if (a == 0x00ed002b || a == 0x00ed0059) {
4732: Keyboard.kbdRepaint ();
4733: } else if (a == 0x00ed005a) {
4734: if (0x00fe0000 <= XEiJ.regPC0 && XEiJ.regPC0 <= 0x00ffffff) {
4735: SRAM.smrOverride ();
4736: }
4737: }
4738: } else {
4739: System.out.printf ("%08X writing $%02X to $%08X in a write-protected state\n", XEiJ.regPC0, d & 0xff, a);
4740: if (SRAM.smrSRAMBusErrorOn) {
4741: super.mmdWb (a, d);
4742: }
4743: }
4744: }
4745: @Override protected void mmdWw (int a, int d) throws M68kException {
4746: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4747: if (SRAM.smrWriteEnableOn) {
4748: a &= XEiJ.BUS_MOTHER_MASK;
4749: XEiJ.mpuClockTime += XEiJ.busWaitTime.sram;
4750: MainMemory.mmrM8[a ] = (byte) (d >> 8);
4751: MainMemory.mmrM8[a + 1] = (byte) d;
4752: if (a == (0x00ed002b & -2) || a == (0x00ed0059 & -2)) {
4753: Keyboard.kbdRepaint ();
4754: }
4755: } else {
4756: System.out.printf ("%08X writing $%04X to $%08X in a write-protected state\n", XEiJ.regPC0, d & 0xffff, a);
4757: if (SRAM.smrSRAMBusErrorOn) {
4758: super.mmdWw (a, d);
4759: }
4760: }
4761: }
4762: @Override protected void mmdWl (int a, int d) throws M68kException {
4763: if (SRAM.smrWriteEnableOn) {
4764: mmdWw (a , d >> 16);
4765: mmdWw (a + 2, d );
4766: } else {
4767: System.out.printf ("%08X writing $%08X to $%08X in a write-protected state\n", XEiJ.regPC0, d, a);
4768: if (SRAM.smrSRAMBusErrorOn) {
4769: super.mmdWl (a, d);
4770: }
4771: }
4772: }
4773: },
4774:
4775:
4776:
4777:
4778: MMD_XB4 {
4779: @Override public String toString () {
4780: return Multilingual.mlnJapanese ? "拡張ボード領域 4" : "Expansion Board Area 4";
4781: }
4782:
4783: @Override protected byte mmdRbs (int a) throws M68kException {
4784: if (XEiJ.bnkOn) {
4785: a &= XEiJ.BUS_MOTHER_MASK;
4786: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4787: return XEiJ.bnkMemory[a];
4788: }
4789: return super.mmdRbs (a);
4790: }
4791: @Override protected int mmdRbz (int a) throws M68kException {
4792: if (XEiJ.bnkOn) {
4793: a &= XEiJ.BUS_MOTHER_MASK;
4794: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4795: return XEiJ.bnkMemory[a] & 0xff;
4796: }
4797: return super.mmdRbz (a);
4798: }
4799: @Override protected int mmdRws (int a) throws M68kException {
4800: if (XEiJ.bnkOn) {
4801: a &= XEiJ.BUS_MOTHER_MASK;
4802: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4803: return ((XEiJ.bnkMemory[a ] ) << 8 |
4804: (XEiJ.bnkMemory[a + 1] & 0xff));
4805: }
4806: return super.mmdRws (a);
4807: }
4808: @Override protected int mmdRwz (int a) throws M68kException {
4809: if (XEiJ.bnkOn) {
4810: a &= XEiJ.BUS_MOTHER_MASK;
4811: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4812: return ((XEiJ.bnkMemory[a ] & 0xff) << 8 |
4813: (XEiJ.bnkMemory[a + 1] & 0xff));
4814: }
4815: return super.mmdRwz (a);
4816: }
4817: @Override protected int mmdRls (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 ] ) << 24 |
4822: (XEiJ.bnkMemory[a + 1] & 0xff) << 16 |
4823: (XEiJ.bnkMemory[a + 2] & 0xff) << 8 |
4824: (XEiJ.bnkMemory[a + 3] & 0xff));
4825: }
4826: return super.mmdRls (a);
4827: }
4828:
4829: @Override protected void mmdWb (int a, int d) throws M68kException {
4830: if (XEiJ.bnkOn) {
4831: a &= XEiJ.BUS_MOTHER_MASK;
4832: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4833: XEiJ.bnkMemory[a] = (byte) d;
4834: return;
4835: }
4836: super.mmdWb (a, d);
4837: }
4838: @Override protected void mmdWw (int a, int d) throws M68kException {
4839: if (XEiJ.bnkOn) {
4840: a &= XEiJ.BUS_MOTHER_MASK;
4841: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4842: XEiJ.bnkMemory[a ] = (byte) (d >> 8);
4843: XEiJ.bnkMemory[a + 1] = (byte) d;
4844: return;
4845: }
4846: super.mmdWw (a, d);
4847: }
4848: @Override protected void mmdWl (int a, int d) throws M68kException {
4849: if (XEiJ.bnkOn) {
4850: a &= XEiJ.BUS_MOTHER_MASK;
4851: a = XEiJ.bnkPageStart + (a - 0x00ee0000);
4852: XEiJ.bnkMemory[a ] = (byte) (d >> 24);
4853: XEiJ.bnkMemory[a + 1] = (byte) (d >> 16);
4854: XEiJ.bnkMemory[a + 2] = (byte) (d >> 8);
4855: XEiJ.bnkMemory[a + 3] = (byte) d;
4856: return;
4857: }
4858: super.mmdWl (a, d);
4859: }
4860: },
4861:
4862:
4863:
4864: MMD_CG1 {
4865: @Override public String toString () {
4866: return Multilingual.mlnJapanese ? "CGROM" : "CGROM";
4867: }
4868:
4869: @Override protected byte mmdPbs (int a) {
4870: a &= XEiJ.BUS_MOTHER_MASK;
4871: return MainMemory.mmrM8[a];
4872: }
4873: @Override protected int mmdPbz (int a) {
4874: a &= XEiJ.BUS_MOTHER_MASK;
4875: return MainMemory.mmrM8[a] & 0xff;
4876: }
4877: @Override protected int mmdPws (int a) {
4878: a &= XEiJ.BUS_MOTHER_MASK;
4879: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4880: return MainMemory.mmrBuffer.getShort (a);
4881: } else {
4882: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
4883: }
4884: }
4885: @Override protected int mmdPwz (int a) {
4886: a &= XEiJ.BUS_MOTHER_MASK;
4887: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4888: return MainMemory.mmrBuffer.getChar (a);
4889: } else {
4890: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
4891: }
4892: }
4893: @Override protected int mmdPls (int a) {
4894: a &= XEiJ.BUS_MOTHER_MASK;
4895: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4896: return MainMemory.mmrBuffer.getInt (a);
4897: } else {
4898: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
4899: }
4900: }
4901:
4902: @Override protected byte mmdRbs (int a) throws M68kException {
4903: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
4904: a &= XEiJ.BUS_MOTHER_MASK;
4905: return MainMemory.mmrM8[a];
4906: }
4907: @Override protected int mmdRbz (int a) throws M68kException {
4908: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
4909: a &= XEiJ.BUS_MOTHER_MASK;
4910: return MainMemory.mmrM8[a] & 0xff;
4911: }
4912: @Override protected int mmdRws (int a) throws M68kException {
4913: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
4914: a &= XEiJ.BUS_MOTHER_MASK;
4915: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4916: return MainMemory.mmrBuffer.getShort (a);
4917: } else {
4918: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
4919: }
4920: }
4921: @Override protected int mmdRwz (int a) throws M68kException {
4922: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
4923: a &= XEiJ.BUS_MOTHER_MASK;
4924: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4925: return MainMemory.mmrBuffer.getChar (a);
4926: } else {
4927: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
4928: }
4929: }
4930: @Override protected int mmdRls (int a) throws M68kException {
4931: XEiJ.mpuClockTime += XEiJ.busWaitTime.romlong;
4932: a &= XEiJ.BUS_MOTHER_MASK;
4933: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4934: return MainMemory.mmrBuffer.getInt (a);
4935: } else {
4936: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
4937: }
4938: }
4939: },
4940:
4941:
4942:
4943: MMD_CG2 {
4944: @Override public String toString () {
4945: return Multilingual.mlnJapanese ? "CGROM" : "CGROM";
4946: }
4947:
4948: @Override protected byte mmdPbs (int a) {
4949: a &= XEiJ.BUS_MOTHER_MASK;
4950: return MainMemory.mmrM8[a];
4951: }
4952: @Override protected int mmdPbz (int a) {
4953: a &= XEiJ.BUS_MOTHER_MASK;
4954: return MainMemory.mmrM8[a] & 0xff;
4955: }
4956: @Override protected int mmdPws (int a) {
4957: a &= XEiJ.BUS_MOTHER_MASK;
4958: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4959: return MainMemory.mmrBuffer.getShort (a);
4960: } else {
4961: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
4962: }
4963: }
4964: @Override protected int mmdPwz (int a) {
4965: a &= XEiJ.BUS_MOTHER_MASK;
4966: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4967: return MainMemory.mmrBuffer.getChar (a);
4968: } else {
4969: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
4970: }
4971: }
4972: @Override protected int mmdPls (int a) {
4973: a &= XEiJ.BUS_MOTHER_MASK;
4974: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4975: return MainMemory.mmrBuffer.getInt (a);
4976: } else {
4977: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
4978: }
4979: }
4980:
4981: @Override protected byte mmdRbs (int a) throws M68kException {
4982: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
4983: a &= XEiJ.BUS_MOTHER_MASK;
4984: return MainMemory.mmrM8[a];
4985: }
4986: @Override protected int mmdRbz (int a) throws M68kException {
4987: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
4988: a &= XEiJ.BUS_MOTHER_MASK;
4989: return MainMemory.mmrM8[a] & 0xff;
4990: }
4991: @Override protected int mmdRws (int a) throws M68kException {
4992: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
4993: a &= XEiJ.BUS_MOTHER_MASK;
4994: if (MainMemory.MMR_USE_BYTE_BUFFER) {
4995: return MainMemory.mmrBuffer.getShort (a);
4996: } else {
4997: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
4998: }
4999: }
5000: @Override protected int mmdRwz (int a) throws M68kException {
5001: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
5002: a &= XEiJ.BUS_MOTHER_MASK;
5003: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5004: return MainMemory.mmrBuffer.getChar (a);
5005: } else {
5006: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
5007: }
5008: }
5009: @Override protected int mmdRls (int a) throws M68kException {
5010: XEiJ.mpuClockTime += XEiJ.busWaitTime.romlong;
5011: a &= XEiJ.BUS_MOTHER_MASK;
5012: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5013: return MainMemory.mmrBuffer.getInt (a);
5014: } else {
5015: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
5016: }
5017: }
5018: },
5019:
5020:
5021:
5022: MMD_ROM {
5023: @Override public String toString () {
5024: return Multilingual.mlnJapanese ? "ROM" : "ROM";
5025: }
5026:
5027: @Override protected byte mmdPbs (int a) {
5028: a &= XEiJ.BUS_MOTHER_MASK;
5029: return MainMemory.mmrM8[a];
5030: }
5031: @Override protected int mmdPbz (int a) {
5032: a &= XEiJ.BUS_MOTHER_MASK;
5033: return MainMemory.mmrM8[a] & 0xff;
5034: }
5035: @Override protected int mmdPws (int a) {
5036: a &= XEiJ.BUS_MOTHER_MASK;
5037: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5038: return MainMemory.mmrBuffer.getShort (a);
5039: } else {
5040: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
5041: }
5042: }
5043: @Override protected int mmdPwz (int a) {
5044: a &= XEiJ.BUS_MOTHER_MASK;
5045: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5046: return MainMemory.mmrBuffer.getChar (a);
5047: } else {
5048: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
5049: }
5050: }
5051: @Override protected int mmdPls (int a) {
5052: a &= XEiJ.BUS_MOTHER_MASK;
5053: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5054: return MainMemory.mmrBuffer.getInt (a);
5055: } else {
5056: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
5057: }
5058: }
5059:
5060: @Override protected byte mmdRbs (int a) throws M68kException {
5061: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
5062: a &= XEiJ.BUS_MOTHER_MASK;
5063: return MainMemory.mmrM8[a];
5064: }
5065: @Override protected int mmdRbz (int a) throws M68kException {
5066: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
5067: a &= XEiJ.BUS_MOTHER_MASK;
5068: return MainMemory.mmrM8[a] & 0xff;
5069: }
5070: @Override protected int mmdRws (int a) throws M68kException {
5071: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
5072: a &= XEiJ.BUS_MOTHER_MASK;
5073: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5074: return MainMemory.mmrBuffer.getShort (a);
5075: } else {
5076: return MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff);
5077: }
5078: }
5079: @Override protected int mmdRwz (int a) throws M68kException {
5080: XEiJ.mpuClockTime += XEiJ.busWaitTime.rom;
5081: a &= XEiJ.BUS_MOTHER_MASK;
5082: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5083: return MainMemory.mmrBuffer.getChar (a);
5084: } else {
5085: return (char) (MainMemory.mmrM8[a] << 8 | (MainMemory.mmrM8[a + 1] & 0xff));
5086: }
5087: }
5088: @Override protected int mmdRls (int a) throws M68kException {
5089: XEiJ.mpuClockTime += XEiJ.busWaitTime.romlong;
5090: a &= XEiJ.BUS_MOTHER_MASK;
5091: if (MainMemory.MMR_USE_BYTE_BUFFER) {
5092: return MainMemory.mmrBuffer.getInt (a);
5093: } else {
5094: return MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 0xff) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | (MainMemory.mmrM8[a + 3] & 0xff));
5095: }
5096: }
5097: },
5098:
5099:
5100:
5101: MMD_IBP {
5102: @Override public String toString () {
5103: return Multilingual.mlnJapanese ? "命令ブレークポイント" : "Instruction Break Point";
5104: }
5105: @Override protected int mmdRwz (int a) throws M68kException {
5106: if (InstructionBreakPoint.IBP_ON) {
5107: InstructionBreakPoint.InstructionBreakRecord[] hashTable = (XEiJ.regSRS != 0 ?
5108: InstructionBreakPoint.ibpSuperHashTable :
5109: InstructionBreakPoint.ibpUserHashTable);
5110: for (InstructionBreakPoint.InstructionBreakRecord r = hashTable[a >> 1 & InstructionBreakPoint.IBP_HASH_MASK];
5111: r != null;
5112: r = r.ibrNext) {
5113: if (r.ibrPhysicalAddress == a) {
5114: if (r.ibrValue == r.ibrTarget) {
5115: if (r.ibrThreshold < 0) {
5116: InstructionBreakPoint.ibpRemove (r.ibrLogicalAddress, XEiJ.regSRS);
5117: XEiJ.mpuContinue = true;
5118: } else if (r.ibrTarget < r.ibrThreshold) {
5119: r.ibrTarget = r.ibrThreshold;
5120: XEiJ.mpuContinue = true;
5121: } else {
5122: if (r.ibrScriptElement != null &&
5123: r.ibrScriptElement.exlEval (ExpressionEvaluator.EVM_EXPRESSION).exlFloatValue.iszero ()) {
5124: break;
5125: }
5126: r.ibrTarget++;
5127: XEiJ.mpuContinue = false;
5128: }
5129: M68kException.m6eNumber = M68kException.M6E_INSTRUCTION_BREAK_POINT;
5130: throw M68kException.m6eSignal;
5131: } else {
5132: if (r.ibrWaitInstruction != null) {
5133: WaitInstruction.instruction = r.ibrWaitInstruction;
5134: return XEiJ.EMX_OPCODE_EMXWAIT;
5135: }
5136: r.ibrValue++;
5137: break;
5138: }
5139: }
5140: }
5141: }
5142: if (DataBreakPoint.DBP_ON) {
5143: return DataBreakPoint.dbpMemoryMap[a >>> XEiJ.BUS_PAGE_BITS].mmdRwz (a);
5144: } else {
5145: return XEiJ.busMemoryMap[a >>> XEiJ.BUS_PAGE_BITS].mmdRwz (a);
5146: }
5147: }
5148: },
5149:
5150:
5151:
5152: MMD_DBP {
5153: @Override public String toString () {
5154: return Multilingual.mlnJapanese ? "データブレークポイント" : "Data Break Point";
5155: }
5156:
5157: @Override protected byte mmdPbs (int a) {
5158: return (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdPbs (a);
5159: }
5160: @Override protected int mmdPbz (int a) {
5161: return (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdPbz (a);
5162: }
5163: @Override protected int mmdPws (int a) {
5164: return (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdPws (a);
5165: }
5166: @Override protected int mmdPwz (int a) {
5167: return (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdPwz (a);
5168: }
5169: @Override protected int mmdPls (int a) {
5170: return (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdPls (a);
5171: }
5172:
5173: @Override protected byte mmdRbs (int a) throws M68kException {
5174: int d = (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdRbs (a);
5175: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_BYTE, a, d);
5176: return (byte) d;
5177: }
5178: @Override protected int mmdRbz (int a) throws M68kException {
5179: int d = (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdRbz (a);
5180: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_BYTE, a, d);
5181: return d;
5182: }
5183: @Override protected int mmdRws (int a) throws M68kException {
5184: int d = (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdRws (a);
5185: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_WORD, a, d);
5186: return d;
5187: }
5188: @Override protected int mmdRwz (int a) throws M68kException {
5189: int d = (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdRwz (a);
5190: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_WORD, a, d);
5191: return d;
5192: }
5193: @Override protected int mmdRls (int a) throws M68kException {
5194: int d = (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdRls (a);
5195: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_LONG, a, d);
5196: return d;
5197: }
5198:
5199: @Override protected void mmdWb (int a, int d) throws M68kException {
5200: (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdWb (a, d);
5201: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_BYTE, a, d);
5202: }
5203: @Override protected void mmdWw (int a, int d) throws M68kException {
5204: (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdWw (a, d);
5205: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_WORD, a, d);
5206: }
5207: @Override protected void mmdWl (int a, int d) throws M68kException {
5208: (XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap)[a >>> XEiJ.BUS_PAGE_BITS].mmdWl (a, d);
5209: DataBreakPoint.dbpBreak (DataBreakPoint.DBP_LONG, a, d);
5210: }
5211: },
5212:
5213:
5214:
5215: MMD_NUL {
5216: @Override public String toString () {
5217: return Multilingual.mlnJapanese ? "ヌルデバイス" : "Null Device";
5218: }
5219: };
5220:
5221:
5222:
5223:
5224:
5225:
5226: protected byte mmdPbs (int a) {
5227: try {
5228: return (byte) mmdRbz (a);
5229: } catch (M68kException e) {
5230: }
5231: return -1;
5232: }
5233: protected int mmdPbz (int a) {
5234: try {
5235: return mmdRbz (a);
5236: } catch (M68kException e) {
5237: }
5238: return 0xff;
5239: }
5240: protected int mmdPws (int a) {
5241: try {
5242: return (short) mmdRwz (a);
5243: } catch (M68kException e) {
5244: }
5245: return -1;
5246: }
5247: protected int mmdPwz (int a) {
5248: try {
5249: return mmdRwz (a);
5250: } catch (M68kException e) {
5251: }
5252: return 0xffff;
5253: }
5254: protected int mmdPls (int a) {
5255: try {
5256: return mmdRls (a);
5257: } catch (M68kException e) {
5258: }
5259: return -1;
5260: }
5261:
5262:
5263:
5264: protected byte mmdRbs (int a) throws M68kException {
5265: return (byte) mmdRbz (a);
5266: }
5267: protected int mmdRbz (int a) throws M68kException {
5268: M68kException.m6eFSLW |= M68kException.M6E_FSLW_BUS_ERROR_ON_READ;
5269: M68kException.m6eNumber = M68kException.M6E_ACCESS_FAULT;
5270: M68kException.m6eAddress = a;
5271: M68kException.m6eDirection = XEiJ.MPU_WR_READ;
5272: M68kException.m6eSize = XEiJ.MPU_SS_BYTE;
5273: throw M68kException.m6eSignal;
5274: }
5275: protected int mmdRws (int a) throws M68kException {
5276: return (short) mmdRwz (a);
5277: }
5278: protected int mmdRwz (int a) throws M68kException {
5279: M68kException.m6eFSLW |= M68kException.M6E_FSLW_BUS_ERROR_ON_READ;
5280: M68kException.m6eNumber = M68kException.M6E_ACCESS_FAULT;
5281: M68kException.m6eAddress = a;
5282: M68kException.m6eDirection = XEiJ.MPU_WR_READ;
5283: M68kException.m6eSize = XEiJ.MPU_SS_WORD;
5284: throw M68kException.m6eSignal;
5285: }
5286: protected int mmdRls (int a) throws M68kException {
5287: M68kException.m6eFSLW |= M68kException.M6E_FSLW_BUS_ERROR_ON_READ;
5288: M68kException.m6eNumber = M68kException.M6E_ACCESS_FAULT;
5289: M68kException.m6eAddress = a;
5290: M68kException.m6eDirection = XEiJ.MPU_WR_READ;
5291: M68kException.m6eSize = XEiJ.MPU_SS_LONG;
5292: throw M68kException.m6eSignal;
5293: }
5294:
5295:
5296:
5297: protected void mmdVb (int a, int d) {
5298: try {
5299: mmdWb (a, d);
5300: } catch (M68kException e) {
5301: }
5302: }
5303: protected void mmdVw (int a, int d) {
5304: try {
5305: mmdWw (a, d);
5306: } catch (M68kException e) {
5307: }
5308: }
5309: protected void mmdVl (int a, int d) {
5310: try {
5311: mmdWl (a, d);
5312: } catch (M68kException e) {
5313: }
5314: }
5315:
5316:
5317: protected void mmdWb (int a, int d) throws M68kException {
5318: M68kException.m6eFSLW |= M68kException.M6E_FSLW_BUS_ERROR_ON_WRITE;
5319: M68kException.m6eNumber = M68kException.M6E_ACCESS_FAULT;
5320: M68kException.m6eAddress = a;
5321: M68kException.m6eDirection = XEiJ.MPU_WR_WRITE;
5322: M68kException.m6eSize = XEiJ.MPU_SS_BYTE;
5323: throw M68kException.m6eSignal;
5324: }
5325: protected void mmdWw (int a, int d) throws M68kException {
5326: M68kException.m6eFSLW |= M68kException.M6E_FSLW_BUS_ERROR_ON_WRITE;
5327: M68kException.m6eNumber = M68kException.M6E_ACCESS_FAULT;
5328: M68kException.m6eAddress = a;
5329: M68kException.m6eDirection = XEiJ.MPU_WR_WRITE;
5330: M68kException.m6eSize = XEiJ.MPU_SS_WORD;
5331: throw M68kException.m6eSignal;
5332: }
5333: protected void mmdWl (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_LONG;
5339: throw M68kException.m6eSignal;
5340: }
5341: }
5342:
5343:
5344: