Z8530.java
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20: package xeij;
21:
22: import java.awt.event.*;
23: import java.lang.*;
24: import java.util.*;
25: import javax.swing.*;
26: import javax.swing.event.*;
27:
28: public class Z8530 {
29:
30: public static final boolean SCC_DEBUG_ON = false;
31: public static int sccDebugOn;
32: public static JMenu sccDebugMenu;
33:
34: public static double sccFreq = 5000000.0;
35:
36:
37: public static final int SCC_0B_COMMAND = 0x00e98001;
38: public static final int SCC_0B_DATA = 0x00e98003;
39: public static final int SCC_1A_COMMAND = 0x00e98005;
40: public static final int SCC_1A_DATA = 0x00e98007;
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69: public static int sccInterruptVector;
70: public static int sccVectorInclude;
71:
72: public static final int SCC_0B_RECEIVE_VECTOR = 2;
73: public static final int SCC_0B_RECEIVE_MASK = 0x04;
74: public static int scc0bReceiveMask;
75: public static int scc0bReceiveRR3;
76: public static int scc0bReceiveRequest;
77: public static int scc0bReceiveVector;
78:
79: public static final int SCC_1A_RECEIVE_VECTOR = 6;
80: public static final int SCC_1A_RECEIVE_MASK = 0x20;
81: public static int scc1aReceiveMask;
82: public static int scc1aReceiveRR3;
83: public static int scc1aReceiveRequest;
84: public static int scc1aReceiveVector;
85:
86: public static final int SCC_1A_SEND_VECTOR = 4;
87: public static final int SCC_1A_SEND_MASK = 0x10;
88: public static int scc1aSendMask;
89: public static int scc1aSendRR3;
90: public static int scc1aSendRequest;
91: public static int scc1aSendVector;
92:
93:
94: public static int scc0bRegisterNumber;
95: public static int scc0bRts;
96: public static int scc0bBaudRateGen;
97: public static int scc0bInputCounter;
98: public static int scc0bData1;
99: public static int scc0bData2;
100:
101: public static final boolean SCC_FSX_MOUSE = true;
102: public static int sccFSXMouseHook;
103: public static int sccFSXMouseWork;
104:
105:
106: public static final int SCC_1A_INPUT_BITS = 16;
107: public static final int SCC_1A_INPUT_SIZE = 1 << SCC_1A_INPUT_BITS;
108: public static final int SCC_1A_INPUT_MASK = SCC_1A_INPUT_SIZE - 1;
109: public static int scc1aRegisterNumber;
110: public static final int[] scc1aInputBuffer = new int[SCC_1A_INPUT_SIZE];
111: public static int scc1aInputRead;
112: public static int scc1aInputWrite;
113:
114: public static int scc1aBRGEnable;
115: public static int scc1aClockModeShift;
116: public static int scc1aBaudRateGen;
117: public static long scc1aInterval;
118:
119: public static int scc1aRxBits;
120: public static int scc1aRxEnable;
121: public static int scc1aStop;
122: public static int scc1aParity;
123: public static int scc1aTxBits;
124: public static int scc1aTxEnable;
125:
126:
127:
128:
129: public static void sccInit () {
130:
131: sccFreq = 5000000 < Settings.sgsGetInt ("sccfreq") ? 7372800.0 : 5000000.0;
132:
133: if (SCC_DEBUG_ON) {
134: sccDebugOn = 2;
135: sccDebugMenu =
136: ComponentFactory.createMenu (
137: "SCC",
138: ComponentFactory.createCheckBoxMenuItem ((sccDebugOn & 1) != 0, "Port 0B", new ActionListener () {
139: @Override public void actionPerformed (ActionEvent ae) {
140: sccDebugOn = (sccDebugOn & ~1) | (((JCheckBoxMenuItem) ae.getSource ()).isSelected () ? 1 : 0);
141: }
142: }),
143: ComponentFactory.createCheckBoxMenuItem ((sccDebugOn & 2) != 0, "Port 1A", new ActionListener () {
144: @Override public void actionPerformed (ActionEvent ae) {
145: sccDebugOn = (sccDebugOn & ~2) | (((JCheckBoxMenuItem) ae.getSource ()).isSelected () ? 2 : 0);
146: }
147: }),
148: ComponentFactory.createCheckBoxMenuItem ((sccDebugOn & 4) != 0, "Interrupt", new ActionListener () {
149: @Override public void actionPerformed (ActionEvent ae) {
150: sccDebugOn = (sccDebugOn & ~4) | (((JCheckBoxMenuItem) ae.getSource ()).isSelected () ? 4 : 0);
151: }
152: })
153: );
154: }
155:
156:
157:
158: sccReset ();
159:
160: }
161:
162:
163:
164:
165: public static void sccTini () {
166: Settings.sgsPutInt ("sccfreq", (int) sccFreq);
167: }
168:
169:
170:
171: public static void sccReset () {
172:
173: sccInterruptVector = 0x00;
174: sccVectorInclude = 0x00;
175: scc0bReceiveMask = 0;
176: scc0bReceiveRR3 = 0;
177: scc0bReceiveRequest = 0;
178: scc0bReceiveVector = 0;
179: scc1aReceiveMask = 0;
180: scc1aReceiveRR3 = 0;
181: scc1aReceiveRequest = 0;
182: scc1aReceiveVector = 0;
183: scc1aSendMask = 0;
184: scc1aSendRR3 = 0;
185: scc1aSendRequest = 0;
186: scc1aSendVector = 0;
187:
188: scc0bRegisterNumber = 0;
189: scc0bRts = 0;
190: scc0bBaudRateGen = 31;
191: scc0bInputCounter = 0;
192: scc0bData1 = 0;
193: scc0bData2 = 0;
194: if (SCC_FSX_MOUSE) {
195: sccFSXMouseHook = 0;
196: sccFSXMouseWork = 0;
197: }
198:
199: scc1aRegisterNumber = 0;
200: Arrays.fill (scc1aInputBuffer, 0);
201: scc1aInputRead = 0;
202: scc1aInputWrite = 0;
203: scc1aRxBits = 3;
204: scc1aRxEnable = 0;
205: scc1aStop = 1;
206: scc1aParity = 0;
207: scc1aTxBits = 3;
208: scc1aTxEnable = 0;
209: scc1aBRGEnable = 0;
210: scc1aClockModeShift = 4;
211: scc1aBaudRateGen = 14;
212: double rate = sccFreq / (double) ((scc1aBaudRateGen + 2) << (scc1aClockModeShift + 1));
213: double bits = (1.0 +
214: (scc1aRxBits == 0 ? 5.0 :
215: scc1aRxBits == 1 ? 7.0 :
216: scc1aRxBits == 2 ? 6.0 : 8.0) +
217: ((scc1aParity & 1) == 0 ? 0.0 : 1.0) +
218: (scc1aStop == 0 ? 0.0 :
219: scc1aStop == 1 ? 1.0 :
220: scc1aStop == 2 ? 1.5 : 2.0));
221: double interval = bits / rate;
222: scc1aInterval = Math.round (interval * (double) XEiJ.TMR_FREQ);
223:
224: RS232CTerminal.trmAUXReset ();
225: }
226:
227:
228:
229:
230:
231:
232: public static int sccAcknowledge () {
233: int d = 0;
234:
235: if (scc1aReceiveRequest != 0) {
236: scc1aReceiveRequest = 0;
237: d = scc1aReceiveVector;
238: } else if (scc1aSendRequest != 0) {
239: scc1aSendRequest = 0;
240: d = scc1aSendVector;
241: } else if (scc0bReceiveRequest != 0) {
242: scc0bReceiveRequest = 0;
243: d = scc0bReceiveVector;
244: }
245: if (SCC_DEBUG_ON && (sccDebugOn & 4) != 0) {
246: System.out.printf ("%08x sccAcknowledge()=0x%02x\n", XEiJ.regPC0, d);
247: }
248: return d;
249: }
250:
251:
252:
253:
254: public static void sccDone () {
255: if (SCC_DEBUG_ON && (sccDebugOn & 4) != 0) {
256: System.out.printf ("%08x sccDone()\n", XEiJ.regPC0);
257: }
258: if ((scc1aReceiveRequest | scc1aSendRequest | scc0bReceiveRequest) != 0) {
259: XEiJ.mpuIRR |= XEiJ.MPU_SCC_INTERRUPT_MASK;
260: }
261: }
262:
263:
264:
265:
266: public static void sccUpdateVector () {
267: if (sccVectorInclude == 0x00) {
268: scc0bReceiveVector = sccInterruptVector;
269: scc1aReceiveVector = sccInterruptVector;
270: scc1aSendVector = sccInterruptVector;
271: } else if (sccVectorInclude == 0x01) {
272: int t = sccInterruptVector & 0b11110001;
273: scc0bReceiveVector = t | SCC_0B_RECEIVE_VECTOR << 1;
274: scc1aReceiveVector = t | SCC_1A_RECEIVE_VECTOR << 1;
275: scc1aSendVector = t | SCC_1A_SEND_VECTOR << 1;
276: } else {
277: int t = sccInterruptVector & 0b10001111;
278: scc0bReceiveVector = t | SCC_0B_RECEIVE_VECTOR << 4;
279: scc1aReceiveVector = t | SCC_1A_RECEIVE_VECTOR << 4;
280: scc1aSendVector = t | SCC_1A_SEND_VECTOR << 4;
281: }
282: if (SCC_DEBUG_ON && (sccDebugOn & 4) != 0) {
283: System.out.printf ("scc0bReceiveVector=0x%02x\n", scc0bReceiveVector);
284: System.out.printf ("scc1aReceiveVector=0x%02x\n", scc1aReceiveVector);
285: System.out.printf ("scc1aSendVector=0x%02x\n", scc1aSendVector);
286: }
287: }
288:
289:
290:
291: public static int sccReadByte (int a, boolean peek) {
292: XEiJ.mpuClockTime += XEiJ.busWaitTime.scc;
293: int d = 0;
294: switch (a & 7) {
295:
296: case SCC_0B_COMMAND & 7:
297: switch (scc0bRegisterNumber) {
298: case 0:
299:
300:
301:
302:
303:
304:
305:
306:
307: d = scc0bInputCounter < 3 ? 0x25 : 0x24;
308: break;
309: case 2:
310:
311:
312: d = (scc1aReceiveRequest != 0 ? scc1aReceiveVector :
313: scc1aSendRequest != 0 ? scc1aSendVector :
314: scc0bReceiveRequest != 0 ? scc0bReceiveVector :
315: sccInterruptVector);
316: break;
317: case 3:
318:
319:
320:
321: break;
322: case 12:
323: d = scc0bBaudRateGen & 0xff;
324: break;
325: case 13:
326: d = scc0bBaudRateGen >> 8 & 0xff;
327: break;
328: default:
329: if (SCC_DEBUG_ON && sccDebugOn != 0) {
330: System.out.println ("unimplemented register");
331: }
332: }
333: if (peek) {
334: break;
335: }
336: scc0bRegisterNumber = 0;
337: break;
338:
339: case SCC_0B_DATA & 7:
340: if (scc0bInputCounter == 0) {
341: d = Mouse.musExtraData;
342: if (XEiJ.mpuClockTime < Mouse.musWheelReleaseTime) {
343: d |= Mouse.musWheelButton;
344: }
345: if (peek) {
346: break;
347: }
348: Mouse.musExtraData = Mouse.musData;
349: if (!Mouse.musOnScreen) {
350:
351: if (Mouse.musCursorNumber != 1 && Mouse.musCursorAvailable) {
352: Mouse.musCursorNumber = 1;
353: XEiJ.pnlPanel.setCursor (Mouse.musCursorArray[1]);
354: }
355: scc0bData1 = scc0bData2 = 0;
356: } else if (Mouse.musSeamlessOn) {
357: int on, dx, dy, coeff = 256;
358: if (XEiJ.currentMPU < Model.MPU_MC68LC040) {
359: if (SCC_FSX_MOUSE &&
360: sccFSXMouseHook != 0 &&
361: MainMemory.mmrRls (0x0938) == sccFSXMouseHook) {
362: on = MainMemory.mmrRws (sccFSXMouseWork + 0x2e) == 0 ? 1 : 0;
363: int xy = MainMemory.mmrRls (sccFSXMouseWork + 0x0a);
364: dx = (xy >> 16) - CRTC.crtR10TxXPort;
365: dy = (short) xy - CRTC.crtR11TxYPort;
366: coeff = MainMemory.mmrRwz (sccFSXMouseWork + 0x04);
367: } else {
368: on = MainMemory.mmrRbs (0x0aa2);
369: int xy = MainMemory.mmrRls (0x0ace);
370: dx = xy >> 16;
371: dy = (short) xy;
372: }
373: } else {
374: if (SCC_FSX_MOUSE &&
375: sccFSXMouseHook != 0 &&
376: MC68060.mmuPeekLongData (0x0938, 1) == sccFSXMouseHook) {
377: on = MC68060.mmuPeekWordSignData (sccFSXMouseWork + 0x2e, 1) == 0 ? 1 : 0;
378: int xy = MC68060.mmuPeekLongData (sccFSXMouseWork + 0x0a, 1);
379: dx = (xy >> 16) - CRTC.crtR10TxXPort;
380: dy = (short) xy - CRTC.crtR11TxYPort;
381: coeff = MC68060.mmuPeekWordZeroData (sccFSXMouseWork + 0x04, 1);
382: } else {
383: on = MC68060.mmuPeekByteSignData (0x0aa2, 1);
384: int xy = MC68060.mmuPeekLongData (0x0ace, 1);
385: dx = xy >> 16;
386: dy = (short) xy;
387: }
388: }
389: dx = Mouse.musScreenX - dx;
390: dy = Mouse.musScreenY - dy;
391: if (Mouse.musEdgeAccelerationOn) {
392: final int range = 10;
393: final int speed = 10;
394: if (Mouse.musScreenX < range) {
395: dx = -speed;
396: } else if (XEiJ.pnlScreenWidth - range <= Mouse.musScreenX) {
397: dx = speed;
398: }
399: if (Mouse.musScreenY < range) {
400: dy = -speed;
401: } else if (XEiJ.pnlScreenHeight - range <= Mouse.musScreenY) {
402: dy = speed;
403: }
404: }
405: if (on != 0) {
406:
407: if (Mouse.musCursorNumber != 0 && Mouse.musCursorAvailable) {
408: Mouse.musCursorNumber = 0;
409: XEiJ.pnlPanel.setCursor (Mouse.musCursorArray[0]);
410: }
411: } else {
412:
413: if (Mouse.musCursorNumber != 1 && Mouse.musCursorAvailable) {
414: Mouse.musCursorNumber = 1;
415: XEiJ.pnlPanel.setCursor (Mouse.musCursorArray[1]);
416: }
417: }
418: if (coeff != 256 && coeff != 0) {
419:
420: dx = (dx << 8) / coeff;
421: dy = (dy << 8) / coeff;
422: }
423:
424:
425: scc0bData1 = (dx == 0 ? 0 : dx >= 0 ?
426: Mouse.MUS_DEACCELERATION_TABLE[Math.min (1024, dx)] :
427: -Mouse.MUS_DEACCELERATION_TABLE[Math.min (1024, -dx)] & 0xff);
428: scc0bData2 = (dy == 0 ? 0 : dy >= 0 ?
429: Mouse.MUS_DEACCELERATION_TABLE[Math.min (1024, dy)] :
430: -Mouse.MUS_DEACCELERATION_TABLE[Math.min (1024, -dy)] & 0xff);
431: } else if (!XEiJ.frmIsActive) {
432:
433: if (Mouse.musCursorNumber != 1 && Mouse.musCursorAvailable) {
434: Mouse.musCursorNumber = 1;
435: XEiJ.pnlPanel.setCursor (Mouse.musCursorArray[1]);
436: }
437: scc0bData1 = scc0bData2 = 0;
438: Mouse.musExclusiveStart = true;
439: } else {
440:
441: if (Mouse.musCursorNumber != 0 && Mouse.musCursorAvailable) {
442: Mouse.musCursorNumber = 0;
443: XEiJ.pnlPanel.setCursor (Mouse.musCursorArray[0]);
444: }
445: int ox = XEiJ.pnlScreenX1 + (XEiJ.pnlZoomWidth >> 1);
446: int oy = XEiJ.pnlScreenY1 + (XEiJ.pnlZoomHeight >> 1);
447: XEiJ.rbtRobot.mouseMove (XEiJ.pnlGlobalX + ox, XEiJ.pnlGlobalY + oy);
448: int dx = Mouse.musPanelX - ox;
449: int dy = Mouse.musPanelY - oy;
450: if (Mouse.musExclusiveStart) {
451:
452:
453: dx = 0;
454: dy = 0;
455: Mouse.musExclusiveStart = false;
456: }
457:
458:
459: if (dx != 0) {
460: if (dx >= 0) {
461:
462: dx = dx * Mouse.musSpeedRatioX >> 16;
463: if (127 < dx) {
464: d |= 0x10;
465: dx = 127;
466: }
467: } else {
468:
469: dx = -(-dx * Mouse.musSpeedRatioX >> 16);
470: if (dx < -128) {
471: d |= 0x20;
472: dx = -128;
473: }
474: dx &= 0xff;
475: }
476: }
477: if (dy != 0) {
478: if (dy >= 0) {
479:
480: dy = dy * Mouse.musSpeedRatioY >> 16;
481: if (127 < dy) {
482: d |= 0x40;
483: dy = 127;
484: }
485: } else {
486:
487: dy = -(-dy * Mouse.musSpeedRatioY >> 16);
488: if (dy < -128) {
489: d |= 0x80;
490: dy = -128;
491: }
492: dy &= 0xff;
493: }
494: }
495: scc0bData1 = dx;
496: scc0bData2 = dy;
497: }
498: scc0bInputCounter = 1;
499: } else if (scc0bInputCounter == 1) {
500: d = scc0bData1;
501: if (peek) {
502: break;
503: }
504: scc0bInputCounter = 2;
505: } else if (scc0bInputCounter == 2) {
506: d = scc0bData2;
507: if (peek) {
508: break;
509: }
510: scc0bInputCounter = 3;
511: }
512: break;
513:
514: case SCC_1A_COMMAND & 7:
515: switch (scc1aRegisterNumber) {
516: case 0:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526: d = RS232CTerminal.trmAUXReadCommand ();
527: break;
528: case 2:
529:
530:
531: d = sccInterruptVector;
532: break;
533: case 3:
534:
535:
536:
537: d = scc1aReceiveRR3 | scc1aSendRR3 | scc0bReceiveRR3;
538: break;
539: case 12:
540: d = scc1aBaudRateGen & 0xff;
541: break;
542: case 13:
543: d = scc1aBaudRateGen >> 8 & 0xff;
544: break;
545: default:
546: if (SCC_DEBUG_ON && sccDebugOn != 0) {
547: System.out.println ("unimplemented register");
548: }
549: }
550: if (peek) {
551: break;
552: }
553: scc1aRegisterNumber = 0;
554: break;
555:
556: case SCC_1A_DATA & 7:
557: d = RS232CTerminal.trmAUXReadData ();
558: break;
559:
560: default:
561: d = 0xff;
562: }
563: if (SCC_DEBUG_ON && ((a & 4) == 0 ? (sccDebugOn & 1) != 0 : (sccDebugOn & 2) != 0)) {
564: System.out.printf ("%08x sccRead(0x%08x)=0x%02x\n", XEiJ.regPC0, a, d);
565: }
566: return d;
567: }
568:
569:
570:
571:
572:
573: public static void sccWriteByte (int a, int d) {
574: XEiJ.mpuClockTime += XEiJ.busWaitTime.scc;
575: d &= 0xff;
576: if (SCC_DEBUG_ON && ((a & 4) == 0 ? (sccDebugOn & 1) != 0 : (sccDebugOn & 2) != 0)) {
577: System.out.printf ("%08x sccWrite(0x%08x,0x%02x)\n", XEiJ.regPC0, a, d);
578: }
579: switch (a & 7) {
580:
581: case SCC_0B_COMMAND & 7:
582: switch (scc0bRegisterNumber) {
583: case 0:
584: if ((d & 0xf0) == 0) {
585: scc0bRegisterNumber = d;
586: } else if (d == 0x38) {
587: if (scc0bReceiveRR3 != 0) {
588: scc0bReceiveRR3 = 0;
589: if (scc0bInputCounter < 3) {
590: if (scc0bReceiveMask != 0) {
591: scc0bReceiveRR3 = SCC_0B_RECEIVE_MASK;
592: scc0bReceiveRequest = SCC_0B_RECEIVE_MASK;
593: XEiJ.mpuIRR |= XEiJ.MPU_SCC_INTERRUPT_MASK;
594: }
595: }
596: }
597: } else if (d == 0x10) {
598: } else if (d == 0x30) {
599: } else if (d == 0x80) {
600: } else {
601: if (SCC_DEBUG_ON && sccDebugOn != 0) {
602: System.out.println ("unimplemented command");
603: }
604: }
605: return;
606: case 1:
607: scc0bReceiveMask = (d & 0x18) != 0 ? SCC_0B_RECEIVE_MASK : 0;
608: if ((d & 0xec) != 0x00) {
609: if (SCC_DEBUG_ON && sccDebugOn != 0) {
610: System.out.println ("unimplemented interrupt mode");
611: }
612: }
613: break;
614: case 2:
615: sccInterruptVector = d;
616: if (SCC_DEBUG_ON && sccDebugOn != 0) {
617: System.out.printf ("sccInterruptVector=0x%02x\n", sccInterruptVector);
618: }
619: sccUpdateVector ();
620: break;
621: case 3:
622: if (d == 0xc0) {
623: } else if (d == 0xc1) {
624: } else {
625: if (SCC_DEBUG_ON && sccDebugOn != 0) {
626: System.out.println ("unimplemented receiver configuration");
627: }
628: }
629: break;
630: case 4:
631: break;
632: case 5:
633:
634:
635:
636:
637:
638:
639:
640: {
641: int rts = d >> 1 & 1;
642: if ((~scc0bRts & rts) != 0) {
643: scc0bInputCounter = 0;
644:
645: if (scc0bReceiveMask != 0) {
646: scc0bReceiveRR3 = SCC_0B_RECEIVE_MASK;
647: scc0bReceiveRequest = SCC_0B_RECEIVE_MASK;
648: XEiJ.mpuIRR |= XEiJ.MPU_SCC_INTERRUPT_MASK;
649: }
650: }
651: scc0bRts = rts;
652: if ((d & 0x75) == 0x60) {
653: } else {
654: if (SCC_DEBUG_ON && sccDebugOn != 0) {
655: System.out.println ("unimplemented sender configuration");
656: }
657: }
658: }
659: break;
660: case 6:
661: break;
662: case 7:
663: break;
664: case 9:
665: if ((d & 0xc0) == 0x40) {
666: scc0bRts = 0;
667: } else if ((d & 0xc0) == 0x80) {
668: } else if ((d & 0xc0) == 0xc0) {
669: scc0bRts = 0;
670: }
671: sccVectorInclude = d & 0x11;
672: if (SCC_DEBUG_ON && sccDebugOn != 0) {
673: System.out.printf ("sccVectorInclude=0x%02x\n", sccVectorInclude);
674: }
675: sccUpdateVector ();
676: if ((d & 0x26) != 0x00) {
677: if (SCC_DEBUG_ON && sccDebugOn != 0) {
678: System.out.println ("unimplemented interrupt configuration");
679: }
680: }
681: break;
682: case 10:
683: if (d == 0x00) {
684: } else {
685: if (SCC_DEBUG_ON && sccDebugOn != 0) {
686: System.out.println ("unimplemented SDLC configuration");
687: }
688: }
689: break;
690: case 11:
691: if (d == 0x50) {
692: } else if (d == 0x56) {
693: } else {
694: if (SCC_DEBUG_ON && sccDebugOn != 0) {
695: System.out.println ("unimplemented clock control");
696: }
697: }
698: break;
699: case 12:
700: scc0bBaudRateGen = (scc0bBaudRateGen & ~0xff) | d;
701: break;
702: case 13:
703: scc0bBaudRateGen = d << 8 | (scc0bBaudRateGen & 0xff);
704: break;
705: case 14:
706: if (d == 0x02) {
707: } else if (d == 0x03) {
708: } else {
709: if (SCC_DEBUG_ON && sccDebugOn != 0) {
710: System.out.println ("unimplemented DPLL configuration");
711: }
712: }
713: break;
714: case 15:
715: if (d == 0x00) {
716: } else if (d == 0x80) {
717: } else if (d == 0x88) {
718: } else {
719: if (SCC_DEBUG_ON && sccDebugOn != 0) {
720: System.out.println ("unimplemented status interrupt configuration");
721: }
722: }
723: break;
724: default:
725: if (SCC_DEBUG_ON && sccDebugOn != 0) {
726: System.out.println ("unimplemented register");
727: }
728: }
729: scc0bRegisterNumber = 0;
730: return;
731:
732: case SCC_0B_DATA & 7:
733: return;
734:
735: case SCC_1A_COMMAND & 7:
736: switch (scc1aRegisterNumber) {
737: case 0:
738: if ((d & 0xf0) == 0) {
739: scc1aRegisterNumber = d;
740: } else if (d == 0x38) {
741: scc1aReceiveRR3 = 0;
742: } else if (d == 0x10) {
743: } else if (d == 0x30) {
744: } else if (d == 0x80) {
745: } else {
746: if (SCC_DEBUG_ON && sccDebugOn != 0) {
747: System.out.println ("unimplemented command");
748: }
749: }
750: return;
751: case 1:
752:
753:
754:
755:
756:
757:
758:
759:
760:
761:
762:
763:
764: scc1aReceiveMask = (d & 0x18) != 0 ? SCC_1A_RECEIVE_MASK : 0;
765: scc1aSendMask = (d & 0x02) != 0 ? SCC_1A_SEND_MASK : 0;
766: if ((d & 0xe3) != 0x00) {
767: if (SCC_DEBUG_ON && sccDebugOn != 0) {
768: System.out.println ("unimplemented interrupt mode");
769: }
770: }
771: break;
772: case 2:
773: sccInterruptVector = d;
774: if (SCC_DEBUG_ON && sccDebugOn != 0) {
775: System.out.printf ("sccInterruptVector=0x%02x\n", sccInterruptVector);
776: }
777: sccUpdateVector ();
778: break;
779: case 3:
780:
781:
782:
783:
784:
785:
786:
787:
788:
789:
790:
791:
792: if ((d & 0x3e) == 0x00) {
793: scc1aRxBits = d >> 6;
794: } else {
795: if (SCC_DEBUG_ON && sccDebugOn != 0) {
796: System.out.println ("unimplemented receiver configuration");
797: }
798: }
799: break;
800: case 4:
801:
802:
803:
804:
805:
806:
807:
808:
809:
810:
811:
812:
813:
814:
815:
816:
817:
818: scc1aClockModeShift = d >> 6 == 0 ? 0 : (d >> 6) + 3;
819: scc1aStop = d >> 2 & 3;
820: scc1aParity = d & 3;
821: break;
822: case 5:
823:
824:
825:
826:
827:
828:
829:
830:
831:
832:
833:
834:
835:
836:
837:
838: if ((d & 0x15) == 0x00) {
839: RS232CTerminal.trmAUXSetNotReceiving ((d & 0x02) == 0);
840: scc1aTxBits = d >> 5 & 3;
841: scc1aTxEnable = d >> 3 & 1;
842: } else {
843: if (SCC_DEBUG_ON && sccDebugOn != 0) {
844: System.out.println ("unimplemented sender configuration");
845: }
846: }
847: break;
848: case 6:
849: break;
850: case 7:
851: break;
852: case 9:
853: if ((d & 0xc0) == 0x40) {
854: scc0bRts = 0;
855: } else if ((d & 0xc0) == 0x80) {
856: scc1aBRGEnable = 0;
857: scc1aRxEnable = 0;
858: scc1aTxEnable = 0;
859: RS232CTerminal.trmAUXReset ();
860: } else if ((d & 0xc0) == 0xc0) {
861: scc0bRts = 0;
862: scc1aBRGEnable = 0;
863: scc1aRxEnable = 0;
864: scc1aTxEnable = 0;
865: RS232CTerminal.trmAUXReset ();
866: }
867: sccVectorInclude = d & 0x11;
868: if (SCC_DEBUG_ON && sccDebugOn != 0) {
869: System.out.printf ("sccVectorInclude=0x%02x\n", sccVectorInclude);
870: }
871: sccUpdateVector ();
872: if ((d & 0x2e) != 0x08) {
873: if (SCC_DEBUG_ON && sccDebugOn != 0) {
874: System.out.println ("unimplemented interrupt configuration");
875: }
876: }
877: break;
878: case 10:
879: if (d == 0x00) {
880: } else {
881: if (SCC_DEBUG_ON && sccDebugOn != 0) {
882: System.out.println ("unimplemented SDLC configuration");
883: }
884: }
885: break;
886: case 11:
887: if (d == 0x50) {
888: } else if (d == 0x56) {
889: } else {
890: if (SCC_DEBUG_ON && sccDebugOn != 0) {
891: System.out.println ("unimplemented clock control");
892: }
893: }
894: break;
895: case 12:
896:
897:
898:
899:
900:
901:
902:
903:
904:
905:
906:
907:
908:
909:
910:
911:
912: scc1aBaudRateGen = (scc1aBaudRateGen & ~0xff) | d;
913: break;
914: case 13:
915:
916:
917:
918: scc1aBaudRateGen = d << 8 | (scc1aBaudRateGen & 0xff);
919: break;
920: case 14:
921:
922:
923:
924:
925:
926:
927:
928:
929:
930:
931:
932:
933:
934:
935:
936:
937:
938: if ((d & 0xfe) == 0x02) {
939: scc1aBRGEnable = d & 1;
940: if (scc1aBRGEnable != 0) {
941:
942:
943:
944:
945:
946:
947:
948:
949: RS232CTerminal.trmReflectSettings (1);
950: }
951: } else {
952: if (SCC_DEBUG_ON && sccDebugOn != 0) {
953: System.out.println ("unimplemented DPLL configuration");
954: }
955: }
956: break;
957: case 15:
958:
959:
960:
961:
962:
963:
964:
965:
966:
967:
968: if (d == 0x00) {
969: } else if (d == 0x80) {
970: } else if (d == 0x88) {
971: } else {
972: if (SCC_DEBUG_ON && sccDebugOn != 0) {
973: System.out.println ("unimplemented status interrupt configuration");
974: }
975: }
976: break;
977: default:
978: if (SCC_DEBUG_ON && sccDebugOn != 0) {
979: System.out.println ("unimplemented register");
980: }
981: }
982: scc1aRegisterNumber = 0;
983: return;
984:
985: case SCC_1A_DATA & 7:
986: RS232CTerminal.trmAUXWriteData (d);
987: return;
988:
989: default:
990: ;
991: }
992: }
993:
994:
995:
996: }
997:
998:
999: