MainMemory.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: package xeij;
32:
33: import java.lang.*;
34: import java.nio.*;
35: import java.util.*;
36:
37: public class MainMemory {
38:
39: public static final boolean MMR_USE_BYTE_BUFFER = false;
40:
41:
42: public static final byte[] mmrM8 = new byte[XEiJ.BUS_ARRAY_SIZE];
43: public static ByteBuffer mmrBuffer;
44:
45: public static int mmrHumanVersion;
46: public static boolean mmrFEfuncActivated;
47:
48:
49: public static int mmrTwentyOneOptionAddress;
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60: public static int mmrMemorySizeRequest;
61: public static int mmrMemorySizeCurrent;
62:
63:
64:
65:
66: public static boolean mmrMemorySaveOn;
67:
68:
69:
70: public static void mmrInit () {
71:
72: int mainMemorySizeMB = Settings.sgsGetInt ("memory");
73: mmrMemorySizeRequest = (mainMemorySizeMB == 1 ||
74: mainMemorySizeMB == 2 ||
75: mainMemorySizeMB == 4 ||
76: mainMemorySizeMB == 6 ||
77: mainMemorySizeMB == 8 ||
78: mainMemorySizeMB == 10 ||
79: mainMemorySizeMB == 12 ? mainMemorySizeMB << 20 :
80: 12 << 20);
81: mmrMemorySizeCurrent = mmrMemorySizeRequest;
82: System.out.printf (Multilingual.mlnJapanese ?
83: "メインメモリのサイズは %dMB です\n" :
84: "Main memory size is %dMB\n",
85: mmrMemorySizeCurrent >>> 20);
86:
87: mmrMemorySaveOn = Settings.sgsGetOnOff ("memorysave");
88:
89: byte[] mainMemoryArray = Settings.sgsGetData ("memorydata");
90: if (mainMemoryArray.length != 0) {
91: System.out.println (Multilingual.mlnJapanese ?
92: "メインメモリのデータを復元します" :
93: "Main memory data is restored");
94: System.arraycopy (mainMemoryArray, 0,
95: mmrM8, 0,
96: Math.min (mainMemoryArray.length, mmrMemorySizeCurrent));
97: if (mainMemoryArray.length < mmrMemorySizeCurrent) {
98: Arrays.fill (mmrM8, mainMemoryArray.length, mmrMemorySizeCurrent, (byte) 0);
99: }
100: } else {
101: System.out.println (Multilingual.mlnJapanese ?
102: "メインメモリをゼロクリアします" :
103: "Main memory is zero-cleared");
104: Arrays.fill (mmrM8, 0, mmrMemorySizeCurrent, (byte) 0);
105: }
106:
107:
108: if (MMR_USE_BYTE_BUFFER) {
109: mmrBuffer = ByteBuffer.wrap (mmrM8);
110: mmrBuffer.order (ByteOrder.BIG_ENDIAN);
111: }
112:
113: mmrHumanVersion = 0;
114: mmrFEfuncActivated = false;
115: if (HFS.HFS_USE_TWENTY_ONE) {
116: mmrTwentyOneOptionAddress = 0;
117: }
118:
119: }
120:
121: public static void mmrReset () {
122:
123: mmrMemorySizeCurrent = mmrMemorySizeRequest;
124: mmrHumanVersion = 0;
125: mmrFEfuncActivated = false;
126: if (HFS.HFS_USE_TWENTY_ONE) {
127: mmrTwentyOneOptionAddress = 0;
128: }
129:
130: XEiJ.busSuper (MemoryMappedDevice.MMD_MMR, 0x00000000, 0x00002000);
131: XEiJ.busUser (MemoryMappedDevice.MMD_MMR, 0x00002000, mmrMemorySizeCurrent);
132: if (mmrMemorySizeCurrent < 0x00200000) {
133: XEiJ.busUser (MemoryMappedDevice.MMD_MM1, mmrMemorySizeCurrent, 0x00200000);
134: XEiJ.busSuper (MemoryMappedDevice.MMD_NUL, 0x00200000, 0x00c00000);
135: } else {
136: XEiJ.busSuper (MemoryMappedDevice.MMD_NUL, mmrMemorySizeCurrent, 0x00c00000);
137: }
138:
139: mmrSetSupervisorArea (0);
140:
141: }
142:
143:
144:
145: public static void mmrSetSupervisorArea (int d) {
146: int a = ((d & 0xff) + 1) << 13;
147: if (mmrMemorySizeCurrent < 0x00200000) {
148:
149:
150:
151:
152:
153: if (a < 0x00100000) {
154: XEiJ.busSuper (MemoryMappedDevice.MMD_MMR, 0x00000000, a);
155: XEiJ.busUser (MemoryMappedDevice.MMD_MMR, a, 0x00100000);
156: XEiJ.busUser (MemoryMappedDevice.MMD_MM1, 0x00100000, 0x00200000);
157: } else {
158: XEiJ.busSuper (MemoryMappedDevice.MMD_MMR, 0x00000000, 0x00100000);
159: XEiJ.busSuper (MemoryMappedDevice.MMD_MM1, 0x00100000, a);
160: XEiJ.busUser (MemoryMappedDevice.MMD_MM1, a, 0x00200000);
161: }
162: } else {
163:
164:
165:
166:
167:
168: XEiJ.busSuper (MemoryMappedDevice.MMD_MMR, 0x00000000, a);
169: XEiJ.busUser (MemoryMappedDevice.MMD_MMR, a, 0x00200000);
170: }
171: }
172:
173:
174:
175: public static byte mmrRbs (int a) {
176:
177:
178:
179:
180:
181:
182:
183: return mmrM8[a & XEiJ.BUS_MOTHER_MASK];
184: }
185:
186:
187:
188: public static int mmrRbz (int a) {
189:
190:
191:
192:
193:
194:
195:
196: return mmrM8[a & XEiJ.BUS_MOTHER_MASK] & 255;
197: }
198:
199:
200:
201: public static int mmrRws (int a) {
202: if (MMR_USE_BYTE_BUFFER) {
203: return mmrBuffer.getShort (a & XEiJ.BUS_MOTHER_MASK);
204: } else {
205:
206:
207:
208:
209:
210:
211:
212: return mmrM8[a & XEiJ.BUS_MOTHER_MASK] << 8 | mmrM8[a + 1 & XEiJ.BUS_MOTHER_MASK] & 255;
213: }
214: }
215:
216:
217:
218: public static int mmrRwz (int a) {
219: if (MMR_USE_BYTE_BUFFER) {
220: return mmrBuffer.getChar (a & XEiJ.BUS_MOTHER_MASK);
221: } else {
222:
223:
224:
225:
226:
227:
228:
229: return (char) (mmrM8[a & XEiJ.BUS_MOTHER_MASK] << 8 | mmrM8[a + 1 & XEiJ.BUS_MOTHER_MASK] & 255);
230: }
231: }
232:
233:
234:
235: public static int mmrRls (int a) {
236: if (MMR_USE_BYTE_BUFFER) {
237: return mmrBuffer.getInt (a & XEiJ.BUS_MOTHER_MASK);
238: } else {
239:
240:
241:
242:
243:
244:
245:
246: return mmrM8[a & XEiJ.BUS_MOTHER_MASK] << 24 | (mmrM8[a + 1 & XEiJ.BUS_MOTHER_MASK] & 255) << 16 | (char) (mmrM8[a + 2 & XEiJ.BUS_MOTHER_MASK] << 8 | mmrM8[a + 3 & XEiJ.BUS_MOTHER_MASK] & 255);
247: }
248: }
249:
250:
251:
252: public static long mmrRqs (int a) {
253: if (MMR_USE_BYTE_BUFFER) {
254: return mmrBuffer.getLong (a & XEiJ.BUS_MOTHER_MASK);
255: } else {
256: return ((long) (mmrM8[a & XEiJ.BUS_MOTHER_MASK] << 24 |
257: mmrM8[a + 1 & XEiJ.BUS_MOTHER_MASK] << 16 & 0x00ff0000 |
258: mmrM8[a + 2 & XEiJ.BUS_MOTHER_MASK] << 8 & 0x0000ff00 |
259: mmrM8[a + 3 & XEiJ.BUS_MOTHER_MASK] & 0x000000ff) << 32 |
260: (long) (mmrM8[a + 4 & XEiJ.BUS_MOTHER_MASK] << 24 |
261: mmrM8[a + 5 & XEiJ.BUS_MOTHER_MASK] << 16 & 0x00ff0000 |
262: mmrM8[a + 6 & XEiJ.BUS_MOTHER_MASK] << 8 & 0x0000ff00 |
263: mmrM8[a + 7 & XEiJ.BUS_MOTHER_MASK] & 0x000000ff) & 0x00000000ffffffffL);
264: }
265: }
266:
267:
268:
269: public static void mmrWb (int a, int d) {
270:
271:
272:
273:
274:
275:
276:
277: mmrM8[a & XEiJ.BUS_MOTHER_MASK] = (byte) d;
278: }
279:
280:
281:
282: public static void mmrWw (int a, int d) {
283: if (MMR_USE_BYTE_BUFFER) {
284: mmrBuffer.putShort (a & XEiJ.BUS_MOTHER_MASK, (short) d);
285: } else {
286:
287:
288:
289:
290:
291:
292:
293: mmrM8[a & XEiJ.BUS_MOTHER_MASK] = (byte) (d >> 8);
294: mmrM8[a + 1 & XEiJ.BUS_MOTHER_MASK] = (byte) d;
295: }
296: }
297:
298:
299:
300: public static void mmrWl (int a, int d) {
301: if (MMR_USE_BYTE_BUFFER) {
302: mmrBuffer.putInt (a & XEiJ.BUS_MOTHER_MASK, d);
303: } else {
304:
305:
306:
307:
308:
309:
310:
311: mmrM8[a & XEiJ.BUS_MOTHER_MASK] = (byte) (d >> 24);
312: mmrM8[a + 1 & XEiJ.BUS_MOTHER_MASK] = (byte) (d >> 16);
313: mmrM8[a + 2 & XEiJ.BUS_MOTHER_MASK] = (byte) (d >> 8);
314: mmrM8[a + 3 & XEiJ.BUS_MOTHER_MASK] = (byte) d;
315: }
316: }
317:
318:
319:
320: public static void mmrWq (int a, long d) {
321: if (MMR_USE_BYTE_BUFFER) {
322: mmrBuffer.putLong (a & XEiJ.BUS_MOTHER_MASK, d);
323: } else {
324: mmrM8[a & XEiJ.BUS_MOTHER_MASK] = (byte) (d >> 56);
325: mmrM8[a + 1 & XEiJ.BUS_MOTHER_MASK] = (byte) (d >> 48);
326: mmrM8[a + 2 & XEiJ.BUS_MOTHER_MASK] = (byte) (d >> 40);
327: mmrM8[a + 3 & XEiJ.BUS_MOTHER_MASK] = (byte) (d >> 32);
328: mmrM8[a + 4 & XEiJ.BUS_MOTHER_MASK] = (byte) (d >> 24);
329: mmrM8[a + 5 & XEiJ.BUS_MOTHER_MASK] = (byte) (d >> 16);
330: mmrM8[a + 6 & XEiJ.BUS_MOTHER_MASK] = (byte) (d >> 8);
331: mmrM8[a + 7 & XEiJ.BUS_MOTHER_MASK] = (byte) d;
332: }
333: }
334:
335:
336:
337: public static void mmrWba (int a, int... da) {
338: for (int d : da) {
339: mmrWb (a, d);
340: a++;
341: }
342: }
343:
344:
345:
346: public static void mmrWwa (int a, int... da) {
347: for (int d : da) {
348: mmrWw (a, d);
349: a += 2;
350: }
351: }
352:
353:
354:
355: public static void mmrWla (int a, int... da) {
356: for (int d : da) {
357: mmrWl (a, d);
358: a += 4;
359: }
360: }
361:
362:
363: public static int mmrStrlen (int a, int l) {
364: for (int i = 0; i < l; i++) {
365: if (mmrM8[a + i] == 0) {
366: return i;
367: }
368: }
369: return l;
370: }
371:
372:
373:
374:
375:
376:
377:
378: public static String mmrRstr (int a, int l) {
379: return mmrRstr (new StringBuilder (), a, l).toString ();
380: }
381: public static StringBuilder mmrRstr (StringBuilder sb, int a, int l) {
382: for (int i = 0; i < l; i++) {
383: int s = mmrRbz (a + i);
384: char c;
385: if (0x81 <= s && s <= 0x9f || 0xe0 <= s && s <= 0xef) {
386: int t = i + 1 < l ? mmrRbz (a + i + 1) : 0;
387: if (0x40 <= t && t != 0x7f && t <= 0xfc) {
388: c = CharacterCode.chrSJISToChar[s << 8 | t];
389: if (c == 0) {
390: c = '※';
391: }
392: i++;
393: } else {
394: c = '.';
395: }
396: } else {
397: c = CharacterCode.chrSJISToChar[s];
398: if (c < 0x20 || c == 0x7f) {
399: c = '.';
400: }
401: }
402: sb.append (c);
403: }
404: return sb;
405: }
406:
407:
408:
409:
410:
411:
412: public static void mmrWstr (int a, String s) {
413: int l = s.length ();
414: for (int i = 0; i < l; i++) {
415: int c = CharacterCode.chrCharToSJIS[s.charAt (i)];
416: if (c == 0 && s.charAt (i) != '\0') {
417: mmrWw (a, 0x81a6);
418: a += 2;
419: } else if (c <= 0x00ff) {
420: mmrWb (a, c);
421: a++;
422: } else {
423: mmrWw (a, c);
424: a += 2;
425: }
426: }
427: }
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442: public static int mmrHumanTop () {
443: return (mmrHumanVersion == 0x0302 ||
444: mmrHumanVersion == 0x025f ? 0x00008372 :
445: mmrHumanVersion == 0x0301 ? 0x000082d0 :
446: mmrHumanVersion == 0x020f ? 0x0000841c :
447: mmrHumanVersion == 0x0203 ? 0x00007d50 :
448: mmrHumanVersion == 0x0202 ? 0x00007dce :
449: mmrHumanVersion == 0x0201 ? 0x00007dae :
450: mmrHumanVersion == 0x0200 ? 0x00007dae :
451: mmrHumanVersion == 0x0101 ? 0x00010a1a :
452: mmrHumanVersion == 0x0100 ? 0x00010a10 :
453: -1);
454: }
455:
456:
457:
458:
459: public static int mmrHumanBtm () {
460: return mmrHumanVersion > 0 ? MC68060.mmuPeekLongData (0x00001c00, 1) : -1;
461: }
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476: public static int mmrHumanPmm () {
477: return (mmrHumanVersion == 0x0302 ||
478: mmrHumanVersion == 0x025f ? MC68060.mmuPeekLongData (0x00013d0a, 1) :
479: mmrHumanVersion == 0x0301 ? MC68060.mmuPeekLongData (0x00013bf4, 1) :
480: mmrHumanVersion == 0x020f ? MC68060.mmuPeekLongData (0x00013c9c, 1) :
481: mmrHumanVersion == 0x0203 ? MC68060.mmuPeekLongData (0x00012b54, 1) :
482: mmrHumanVersion == 0x0202 ? MC68060.mmuPeekLongData (0x00012dc8, 1) :
483: mmrHumanVersion == 0x0201 ? MC68060.mmuPeekLongData (0x00012d88, 1) :
484: mmrHumanVersion == 0x0200 ? MC68060.mmuPeekLongData (0x00012d88, 1) :
485: mmrHumanVersion == 0x0101 ? MC68060.mmuPeekLongData (0x00008a92, 1) :
486: mmrHumanVersion == 0x0100 ? MC68060.mmuPeekLongData (0x00008a98, 1) :
487: -1);
488: }
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503: public static int mmrHumanNul () {
504: int a = (mmrHumanVersion == 0x0302 ||
505: mmrHumanVersion == 0x025f ? 0x0000fa50 :
506: mmrHumanVersion == 0x0301 ? 0x0000f93a :
507: mmrHumanVersion == 0x020f ? 0x0000fa04 :
508: mmrHumanVersion == 0x0203 ? 0x0000eac2 :
509: mmrHumanVersion == 0x0202 ? 0x0000ed36 :
510: mmrHumanVersion == 0x0201 ? 0x0000ece6 :
511: mmrHumanVersion == 0x0200 ? 0x0000ece6 :
512: mmrHumanVersion == 0x0101 ? 0x0000b84c :
513: mmrHumanVersion == 0x0100 ? 0x0000b83e :
514: -1);
515: return (a >= 0 &&
516: MC68060.mmuPeekLongData (a + 14, 1) == ('N' << 24 | 'U' << 16 | 'L' << 8 | ' ') &&
517: MC68060.mmuPeekLongData (a + 18, 1) == (' ' << 24 | ' ' << 16 | ' ' << 8 | ' ') ? a : -1);
518: }
519:
520:
521:
522:
523:
524:
525:
526:
527: public static int mmrHumanDev (int name1, int name2) {
528: int dev = -1;
529: for (int a = mmrHumanNul (), i = 0; a >= 0 && i < 100; a = MC68060.mmuPeekLongData (a, 1), i++) {
530:
531: if (MC68060.mmuPeekLongData (a + 14, 1) == name1 && MC68060.mmuPeekLongData (a + 18, 1) == name2) {
532: dev = a;
533:
534: }
535: }
536: return dev;
537: }
538:
539:
540:
541:
542: public static void mmrCheckHuman () {
543: if (mmrHumanVersion != 0) {
544: return;
545: }
546:
547: if (!(MC68060.mmuPeekLongData (0x00001c00, 1) != 0 &&
548: MC68060.mmuPeekLongData (0x00001c1c, 1) == 0)) {
549: return;
550: }
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567: mmrHumanVersion = (MC68060.mmuPeekWordZeroData (0x0000a4ac + 8, 1) == 0x0302 ? 0x0302 :
568: MC68060.mmuPeekWordZeroData (0x0000a4ac + 8, 1) == 0x025f ? 0x025f :
569: MC68060.mmuPeekWordZeroData (0x0000a3c6 + 8, 1) == 0x0301 ? 0x0301 :
570: MC68060.mmuPeekWordZeroData (0x0000a4fa + 8, 1) == 0x020f ? 0x020f :
571: MC68060.mmuPeekWordZeroData (0x00009d7e + 8, 1) == 0x0203 ? 0x0203 :
572: MC68060.mmuPeekWordZeroData (0x00009ed6 + 8, 1) == 0x0202 ? 0x0202 :
573: MC68060.mmuPeekWordZeroData (0x00009ee4 + 8, 1) == 0x0201 ? 0x0201 :
574: MC68060.mmuPeekWordZeroData (0x00009ee4 + 8, 1) == 0x0200 ? 0x0200 :
575: MC68060.mmuPeekWordZeroData (0x00009aee + 8, 1) == 0x0101 ? 0x0101 :
576: MC68060.mmuPeekWordZeroData (0x00009ae4 + 8, 1) == 0x0100 ? 0x0100 :
577: -1);
578: if (mmrHumanVersion < 0) {
579: return;
580: }
581:
582: int patched = 0;
583: int failed = 0;
584: switch (mmrHumanVersion) {
585:
586: case 0x0215:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600: if (MC68060.mmuPeekLongData (0x000086ec, 1) == 0x4e7a0002) {
601: MC68060.mmuPokeLongData (0x000086ec, 0x2f017203, 1);
602: MC68060.mmuPokeLongData (0x000086f0, 0x70ac4e4f, 1);
603: MC68060.mmuPokeLongData (0x000086f4, 0x221f2048, 1);
604: patched++;
605: } else {
606: failed++;
607: }
608:
609:
610:
611: if (MC68060.mmuPeekLongData (0x00009a5a, 1) == 0x08010001) {
612: MC68060.mmuPokeByteData (0x00009a5a + 3, 0x00, 1);
613: patched++;
614: } else {
615: failed++;
616: }
617:
618:
619:
620:
621:
622:
623:
624:
625:
626:
627:
628:
629:
630:
631:
632: if (MC68060.mmuPeekWordZeroData (0x0000bc42, 1) == 0x51c8) {
633: MC68060.mmuPokeByteData (0x0000bc42 + 1, 0xc9, 1);
634: patched++;
635: } else {
636: failed++;
637: }
638:
639:
640:
641: if (MC68060.mmuPeekWordZeroData (0x0000d848, 1) == 0x7057) {
642: MC68060.mmuPokeByteData (0x0000d848 + 1, 0x46, 1);
643: patched++;
644: } else {
645: failed++;
646: }
647:
648:
649:
650:
651:
652:
653:
654:
655:
656: if (MC68060.mmuPeekWordZeroData (0x00010ae8, 1) == 0x700b) {
657: MC68060.mmuPokeByteData (0x00010ae8 + 1, 0x0f, 1);
658: patched++;
659: } else {
660: failed++;
661: }
662:
663:
664:
665:
666:
667:
668:
669:
670:
671: break;
672:
673: case 0x0301:
674:
675:
676:
677:
678:
679:
680:
681:
682:
683:
684:
685:
686:
687:
688: if (MC68060.mmuPeekLongData (0x000085b8, 1) == 0x4e7a0002) {
689: MC68060.mmuPokeLongData (0x000085b8, 0x2f017203, 1);
690: MC68060.mmuPokeLongData (0x000085bc, 0x70ac4e4f, 1);
691: MC68060.mmuPokeLongData (0x000085c0, 0x221f2048, 1);
692: patched++;
693: } else {
694: failed++;
695: }
696:
697:
698:
699:
700: if (MC68060.mmuPeekWordZeroData (0x00009926 + 2, 1) == 0x0001) {
701: MC68060.mmuPokeByteData (0x00009926 + 3, 0x00, 1);
702: patched++;
703: } else {
704: failed++;
705: }
706:
707:
708:
709:
710:
711:
712:
713:
714:
715:
716:
717:
718: if (MC68060.mmuPeekWordZeroData (0x00010a22, 1) == 0x700b) {
719: MC68060.mmuPokeByteData (0x00010a22 + 1, 0x0f, 1);
720: patched++;
721: } else {
722: failed++;
723: }
724:
725: break;
726:
727: case 0x0302:
728: case 0x025f:
729:
730:
731:
732:
733:
734:
735:
736:
737:
738:
739:
740:
741:
742:
743:
744:
745:
746:
747:
748: if (MC68060.mmuPeekLongData (0x00007140, 1) == 0x1b7c0016) {
749: MC68060.mmuPokeLongData (0x00007140, XEiJ.EMX_OPCODE_EMXNOP << 16 | 0x2209, 1);
750: MC68060.mmuPokeLongData (0x00007144, 0x1abc0016, 1);
751: MC68060.mmuPokeLongData (0x00007148, 0x51ed0002, 1);
752: MC68060.mmuPokeLongData (0x00007168, 0x61006d90, 1);
753: MC68060.mmuPokeLongData (0x0000716c, XEiJ.EMX_OPCODE_EMXNOP << 16 | 0x4e75, 1);
754: patched++;
755: } else {
756: failed++;
757: }
758:
759:
760:
761:
762:
763:
764:
765:
766:
767:
768:
769:
770:
771:
772:
773:
774:
775:
776:
777:
778:
779:
780:
781:
782:
783:
784:
785:
786:
787:
788:
789:
790:
791:
792:
793:
794:
795:
796:
797:
798:
799:
800:
801:
802:
803:
804:
805:
806:
807:
808:
809:
810: if (MC68060.mmuPeekLongData (0x0000865a, 1) == 0x4e7a0002) {
811: MC68060.mmuPokeLongData (0x0000865a, 0x2f017203, 1);
812: MC68060.mmuPokeLongData (0x0000865e, 0x70ac4e4f, 1);
813: MC68060.mmuPokeLongData (0x00008662, 0x221f2048, 1);
814: patched++;
815: } else {
816: failed++;
817: }
818:
819:
820:
821:
822:
823:
824:
825:
826:
827:
828:
829:
830:
831: if (MC68060.mmuPeekLongData (0x0000971e, 1) == 0x2b48001c) {
832: MC68060.mmuPokeWordData (0x0000971e, 0x48ed, 1);
833: MC68060.mmuPokeLongData (0x00009720, 0x1f00001c, 1);
834: MC68060.mmuPokeLongData (0x00009724, 0x200c4a41, 1);
835: MC68060.mmuPokeLongData (0x00009728, 0x6600fe30, 1);
836: MC68060.mmuPokeLongData (0x0000972c, XEiJ.EMX_OPCODE_EMXNOP << 16 | 0x600a, 1);
837: patched++;
838: } else {
839: failed++;
840: }
841:
842:
843:
844:
845: if (XEiJ.currentMPU < Model.MPU_MC68LC060) {
846: if (MC68060.mmuPeekWordZeroData (0x000099c4 + 2, 1) == 0x0001) {
847: MC68060.mmuPokeByteData (0x000099c4 + 3, 0x00, 1);
848: patched++;
849: } else {
850: failed++;
851: }
852: }
853:
854:
855:
856:
857:
858:
859:
860:
861: if (MC68060.mmuPeekWordZeroData (0x0000a08c, 1) == 0x6704 &&
862: MC68060.mmuPeekLongData (0x0000a08e, 1) == 0x3f3c0000) {
863: MC68060.mmuPokeLongData (0x0000a08c, 0x67024267, 1);
864: MC68060.mmuPokeWordData (0x0000a090, XEiJ.EMX_OPCODE_EMXNOP, 1);
865: patched++;
866: } else {
867: failed++;
868: }
869:
870:
871:
872:
873: if (MC68060.mmuPeekWordZeroData (0x0000b2ea, 1) == 0x324c) {
874: MC68060.mmuPokeByteData (0x0000b2ea + 0, 0x22, 1);
875: patched++;
876: } else {
877: failed++;
878: }
879:
880:
881:
882:
883:
884:
885:
886:
887:
888:
889:
890:
891:
892:
893:
894:
895:
896:
897:
898: if (MC68060.mmuPeekWordZeroData (0x00010b38, 1) == 0x700b) {
899: MC68060.mmuPokeByteData (0x00010b38 + 1, 0x0f, 1);
900: patched++;
901: } else {
902: failed++;
903: }
904:
905: break;
906: }
907:
908:
909:
910:
911:
912:
913:
914:
915:
916:
917:
918:
919:
920:
921:
922:
923:
924:
925:
926:
927:
928:
929:
930:
931:
932:
933:
934:
935:
936:
937:
938:
939:
940:
941:
942:
943: if (FEFunction.fpkRejectFloatOn) {
944: int fline = (mmrHumanVersion == 0x0302 ||
945: mmrHumanVersion == 0x025f ? 0x00008598 :
946: mmrHumanVersion == 0x0301 ? 0x000084f6 :
947: mmrHumanVersion == 0x020f ? 0x00008642 :
948: mmrHumanVersion == 0x0203 ? 0x00007f58 :
949: mmrHumanVersion == 0x0202 ? 0x00007fd6 :
950: mmrHumanVersion == 0x0201 ? 0x00007fb6 :
951: mmrHumanVersion == 0x0200 ? 0x00007fb6 :
952:
953: -1);
954: if (fline > 0) {
955: if (MC68060.mmuPeekWordZeroData (0x0000856e - 0x00008598 + fline, 1) == 0x6626 &&
956: MC68060.mmuPeekLongData (0x00008590 - 0x00008598 + fline, 1) == 0xff09588f &&
957: MC68060.mmuPeekLongData (0x00008594 - 0x00008598 + fline, 1) == 0x608eff00) {
958: MC68060.mmuPokeWordData (0x0000856e - 0x00008598 + fline, 0x6622, 1);
959: MC68060.mmuPokeLongData (0x00008590 - 0x00008598 + fline, 0x608eff00, 1);
960: MC68060.mmuPokeLongData (0x00008594 - 0x00008598 + fline, 0x4645666e, 1);
961: patched++;
962: } else {
963: failed++;
964: }
965: }
966: }
967:
968: System.out.println (new StringBuilder ().
969: append ("Human68k version ").
970: append ((char) ('0' + (mmrHumanVersion >> 8) % 10)).
971: append ('.').
972: append ((char) ('0' + (mmrHumanVersion & 255) / 10)).
973: append ((char) ('0' + (mmrHumanVersion & 255) % 10)).
974: append (Multilingual.mlnJapanese ? " にパッチをあてました (" : " was patched (").
975: append (patched).
976: append ('/').
977: append (patched + failed).
978: append (')').toString ());
979:
980: mmrFEfuncActivated = FEFunction.fpkOn;
981: if (mmrFEfuncActivated) {
982: System.out.println (Multilingual.mlnJapanese ?
983: "FE ファンクション命令が有効になりました" :
984: "FE function instruction has been activated");
985: }
986: }
987:
988:
989:
990: public static int mmrGetLevelZeroPC () {
991: if (0x020f <= mmrHumanVersion) {
992: int level = MC68060.mmuPeekWordZeroData (0x1c08, XEiJ.regSRS);
993: if (level != 0) {
994: int ssp = MC68060.mmuPeekLongData (0x1c5c, XEiJ.regSRS);
995: int pc = MC68060.mmuPeekLongData (ssp + 0x3a, XEiJ.regSRS);
996: return pc;
997: }
998: }
999: return 0;
1000: }
1001:
1002: }
1003:
1004:
1005: