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: if (Mouse.musFollowScrollOn) {
373: dx -= CRTC.crtR10TxXPort;
374: dy -= CRTC.crtR11TxYPort;
375: }
376: }
377: } else {
378: if (SCC_FSX_MOUSE &&
379: sccFSXMouseHook != 0 &&
380: MC68060.mmuPeekLongData (0x0938, 1) == sccFSXMouseHook) {
381: on = MC68060.mmuPeekWordSignData (sccFSXMouseWork + 0x2e, 1) == 0 ? 1 : 0;
382: int xy = MC68060.mmuPeekLongData (sccFSXMouseWork + 0x0a, 1);
383: dx = (xy >> 16) - CRTC.crtR10TxXPort;
384: dy = (short) xy - CRTC.crtR11TxYPort;
385: coeff = MC68060.mmuPeekWordZeroData (sccFSXMouseWork + 0x04, 1);
386: } else {
387: on = MC68060.mmuPeekByteSignData (0x0aa2, 1);
388: int xy = MC68060.mmuPeekLongData (0x0ace, 1);
389: dx = xy >> 16;
390: dy = (short) xy;
391: if (Mouse.musFollowScrollOn) {
392: dx -= CRTC.crtR10TxXPort;
393: dy -= CRTC.crtR11TxYPort;
394: }
395: }
396: }
397: dx = Mouse.musScreenX - dx;
398: dy = Mouse.musScreenY - dy;
399: if (Mouse.musEdgeAccelerationOn) {
400: final int range = 10;
401: final int speed = 10;
402: if (Mouse.musScreenX < range) {
403: dx = -speed;
404: } else if (XEiJ.pnlScreenWidth - range <= Mouse.musScreenX) {
405: dx = speed;
406: }
407: if (Mouse.musScreenY < range) {
408: dy = -speed;
409: } else if (XEiJ.pnlScreenHeight - range <= Mouse.musScreenY) {
410: dy = speed;
411: }
412: }
413: if (on != 0) {
414:
415: if (Mouse.musCursorNumber != 0 && Mouse.musCursorAvailable) {
416: Mouse.musCursorNumber = 0;
417: XEiJ.pnlPanel.setCursor (Mouse.musCursorArray[0]);
418: }
419: } else {
420:
421: if (Mouse.musCursorNumber != 1 && Mouse.musCursorAvailable) {
422: Mouse.musCursorNumber = 1;
423: XEiJ.pnlPanel.setCursor (Mouse.musCursorArray[1]);
424: }
425: }
426: if (coeff != 256 && coeff != 0) {
427:
428: dx = (dx << 8) / coeff;
429: dy = (dy << 8) / coeff;
430: }
431:
432:
433: scc0bData1 = (dx == 0 ? 0 : dx >= 0 ?
434: Mouse.MUS_DEACCELERATION_TABLE[Math.min (1024, dx)] :
435: -Mouse.MUS_DEACCELERATION_TABLE[Math.min (1024, -dx)] & 0xff);
436: scc0bData2 = (dy == 0 ? 0 : dy >= 0 ?
437: Mouse.MUS_DEACCELERATION_TABLE[Math.min (1024, dy)] :
438: -Mouse.MUS_DEACCELERATION_TABLE[Math.min (1024, -dy)] & 0xff);
439: } else if (!XEiJ.frmIsActive) {
440:
441: if (Mouse.musCursorNumber != 1 && Mouse.musCursorAvailable) {
442: Mouse.musCursorNumber = 1;
443: XEiJ.pnlPanel.setCursor (Mouse.musCursorArray[1]);
444: }
445: scc0bData1 = scc0bData2 = 0;
446: Mouse.musExclusiveStart = true;
447: } else {
448:
449: if (Mouse.musCursorNumber != 0 && Mouse.musCursorAvailable) {
450: Mouse.musCursorNumber = 0;
451: XEiJ.pnlPanel.setCursor (Mouse.musCursorArray[0]);
452: }
453: int dx, dy;
454: if (XEiJ.PNL_ROTATION_ON) {
455: int ox = (XEiJ.pnlScreenX1 + XEiJ.pnlScreenX2) >> 1;
456: int oy = (XEiJ.pnlScreenY1 + XEiJ.pnlScreenY2) >> 1;
457: int tx = Mouse.musPanelX - ox;
458: int ty = Mouse.musPanelY - oy;
459: XEiJ.rbtRobot.mouseMove (XEiJ.pnlGlobalX + ox,
460: XEiJ.pnlGlobalY + oy);
461: dx = (int) Math.round (XEiJ.pnlInverseL00 * (double) tx + XEiJ.pnlInverseL01 * (double) ty);
462: dy = (int) Math.round (XEiJ.pnlInverseL10 * (double) tx + XEiJ.pnlInverseL11 * (double) ty);
463: } else {
464: int ox = XEiJ.pnlScreenX1 + (XEiJ.pnlZoomWidth >> 1);
465: int oy = XEiJ.pnlScreenY1 + (XEiJ.pnlZoomHeight >> 1);
466: XEiJ.rbtRobot.mouseMove (XEiJ.pnlGlobalX + ox, XEiJ.pnlGlobalY + oy);
467: dx = Mouse.musPanelX - ox;
468: dy = Mouse.musPanelY - oy;
469: }
470: if (Mouse.musExclusiveStart) {
471:
472:
473: dx = 0;
474: dy = 0;
475: Mouse.musExclusiveStart = false;
476: }
477:
478:
479: if (dx != 0) {
480: if (dx >= 0) {
481:
482: dx = dx * Mouse.musSpeedRatioX >> 16;
483: if (127 < dx) {
484: d |= 0x10;
485: dx = 127;
486: }
487: } else {
488:
489: dx = -(-dx * Mouse.musSpeedRatioX >> 16);
490: if (dx < -128) {
491: d |= 0x20;
492: dx = -128;
493: }
494: dx &= 0xff;
495: }
496: }
497: if (dy != 0) {
498: if (dy >= 0) {
499:
500: dy = dy * Mouse.musSpeedRatioY >> 16;
501: if (127 < dy) {
502: d |= 0x40;
503: dy = 127;
504: }
505: } else {
506:
507: dy = -(-dy * Mouse.musSpeedRatioY >> 16);
508: if (dy < -128) {
509: d |= 0x80;
510: dy = -128;
511: }
512: dy &= 0xff;
513: }
514: }
515: scc0bData1 = dx;
516: scc0bData2 = dy;
517: }
518: scc0bInputCounter = 1;
519: } else if (scc0bInputCounter == 1) {
520: d = scc0bData1;
521: if (peek) {
522: break;
523: }
524: scc0bInputCounter = 2;
525: } else if (scc0bInputCounter == 2) {
526: d = scc0bData2;
527: if (peek) {
528: break;
529: }
530: scc0bInputCounter = 3;
531: }
532: break;
533:
534: case SCC_1A_COMMAND & 7:
535: switch (scc1aRegisterNumber) {
536: case 0:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546: d = RS232CTerminal.trmAUXReadCommand ();
547: break;
548: case 2:
549:
550:
551: d = sccInterruptVector;
552: break;
553: case 3:
554:
555:
556:
557: d = scc1aReceiveRR3 | scc1aSendRR3 | scc0bReceiveRR3;
558: break;
559: case 12:
560: d = scc1aBaudRateGen & 0xff;
561: break;
562: case 13:
563: d = scc1aBaudRateGen >> 8 & 0xff;
564: break;
565: default:
566: if (SCC_DEBUG_ON && sccDebugOn != 0) {
567: System.out.println ("unimplemented register");
568: }
569: }
570: if (peek) {
571: break;
572: }
573: scc1aRegisterNumber = 0;
574: break;
575:
576: case SCC_1A_DATA & 7:
577: d = RS232CTerminal.trmAUXReadData ();
578: break;
579:
580: default:
581: d = 0xff;
582: }
583: if (SCC_DEBUG_ON && ((a & 4) == 0 ? (sccDebugOn & 1) != 0 : (sccDebugOn & 2) != 0)) {
584: System.out.printf ("%08x sccRead(0x%08x)=0x%02x\n", XEiJ.regPC0, a, d);
585: }
586: return d;
587: }
588:
589:
590:
591:
592:
593: public static void sccWriteByte (int a, int d) {
594: XEiJ.mpuClockTime += XEiJ.busWaitTime.scc;
595: d &= 0xff;
596: if (SCC_DEBUG_ON && ((a & 4) == 0 ? (sccDebugOn & 1) != 0 : (sccDebugOn & 2) != 0)) {
597: System.out.printf ("%08x sccWrite(0x%08x,0x%02x)\n", XEiJ.regPC0, a, d);
598: }
599: switch (a & 7) {
600:
601: case SCC_0B_COMMAND & 7:
602: switch (scc0bRegisterNumber) {
603: case 0:
604: if ((d & 0xf0) == 0) {
605: scc0bRegisterNumber = d;
606: } else if (d == 0x38) {
607: if (scc0bReceiveRR3 != 0) {
608: scc0bReceiveRR3 = 0;
609: if (scc0bInputCounter < 3) {
610: if (scc0bReceiveMask != 0) {
611: scc0bReceiveRR3 = SCC_0B_RECEIVE_MASK;
612: scc0bReceiveRequest = SCC_0B_RECEIVE_MASK;
613: XEiJ.mpuIRR |= XEiJ.MPU_SCC_INTERRUPT_MASK;
614: }
615: }
616: }
617: } else if (d == 0x10) {
618: } else if (d == 0x30) {
619: } else if (d == 0x80) {
620: } else {
621: if (SCC_DEBUG_ON && sccDebugOn != 0) {
622: System.out.println ("unimplemented command");
623: }
624: }
625: return;
626: case 1:
627: scc0bReceiveMask = (d & 0x18) != 0 ? SCC_0B_RECEIVE_MASK : 0;
628: if ((d & 0xec) != 0x00) {
629: if (SCC_DEBUG_ON && sccDebugOn != 0) {
630: System.out.println ("unimplemented interrupt mode");
631: }
632: }
633: break;
634: case 2:
635: sccInterruptVector = d;
636: if (SCC_DEBUG_ON && sccDebugOn != 0) {
637: System.out.printf ("sccInterruptVector=0x%02x\n", sccInterruptVector);
638: }
639: sccUpdateVector ();
640: break;
641: case 3:
642: if (d == 0xc0) {
643: } else if (d == 0xc1) {
644: } else {
645: if (SCC_DEBUG_ON && sccDebugOn != 0) {
646: System.out.println ("unimplemented receiver configuration");
647: }
648: }
649: break;
650: case 4:
651: break;
652: case 5:
653:
654:
655:
656:
657:
658:
659:
660: {
661: int rts = d >> 1 & 1;
662: if ((~scc0bRts & rts) != 0) {
663: scc0bInputCounter = 0;
664:
665: if (scc0bReceiveMask != 0) {
666: scc0bReceiveRR3 = SCC_0B_RECEIVE_MASK;
667: scc0bReceiveRequest = SCC_0B_RECEIVE_MASK;
668: XEiJ.mpuIRR |= XEiJ.MPU_SCC_INTERRUPT_MASK;
669: }
670: }
671: scc0bRts = rts;
672: if ((d & 0x75) == 0x60) {
673: } else {
674: if (SCC_DEBUG_ON && sccDebugOn != 0) {
675: System.out.println ("unimplemented sender configuration");
676: }
677: }
678: }
679: break;
680: case 6:
681: break;
682: case 7:
683: break;
684: case 9:
685: if ((d & 0xc0) == 0x40) {
686: scc0bRts = 0;
687: } else if ((d & 0xc0) == 0x80) {
688: } else if ((d & 0xc0) == 0xc0) {
689: scc0bRts = 0;
690: }
691: sccVectorInclude = d & 0x11;
692: if (SCC_DEBUG_ON && sccDebugOn != 0) {
693: System.out.printf ("sccVectorInclude=0x%02x\n", sccVectorInclude);
694: }
695: sccUpdateVector ();
696: if ((d & 0x26) != 0x00) {
697: if (SCC_DEBUG_ON && sccDebugOn != 0) {
698: System.out.println ("unimplemented interrupt configuration");
699: }
700: }
701: break;
702: case 10:
703: if (d == 0x00) {
704: } else {
705: if (SCC_DEBUG_ON && sccDebugOn != 0) {
706: System.out.println ("unimplemented SDLC configuration");
707: }
708: }
709: break;
710: case 11:
711: if (d == 0x50) {
712: } else if (d == 0x56) {
713: } else {
714: if (SCC_DEBUG_ON && sccDebugOn != 0) {
715: System.out.println ("unimplemented clock control");
716: }
717: }
718: break;
719: case 12:
720: scc0bBaudRateGen = (scc0bBaudRateGen & ~0xff) | d;
721: break;
722: case 13:
723: scc0bBaudRateGen = d << 8 | (scc0bBaudRateGen & 0xff);
724: break;
725: case 14:
726: if (d == 0x02) {
727: } else if (d == 0x03) {
728: } else {
729: if (SCC_DEBUG_ON && sccDebugOn != 0) {
730: System.out.println ("unimplemented DPLL configuration");
731: }
732: }
733: break;
734: case 15:
735: if (d == 0x00) {
736: } else if (d == 0x80) {
737: } else if (d == 0x88) {
738: } else {
739: if (SCC_DEBUG_ON && sccDebugOn != 0) {
740: System.out.println ("unimplemented status interrupt configuration");
741: }
742: }
743: break;
744: default:
745: if (SCC_DEBUG_ON && sccDebugOn != 0) {
746: System.out.println ("unimplemented register");
747: }
748: }
749: scc0bRegisterNumber = 0;
750: return;
751:
752: case SCC_0B_DATA & 7:
753: return;
754:
755: case SCC_1A_COMMAND & 7:
756: switch (scc1aRegisterNumber) {
757: case 0:
758: if ((d & 0xf0) == 0) {
759: scc1aRegisterNumber = d;
760: } else if (d == 0x38) {
761: scc1aReceiveRR3 = 0;
762: } else if (d == 0x10) {
763: } else if (d == 0x30) {
764: } else if (d == 0x80) {
765: } else {
766: if (SCC_DEBUG_ON && sccDebugOn != 0) {
767: System.out.println ("unimplemented command");
768: }
769: }
770: return;
771: case 1:
772:
773:
774:
775:
776:
777:
778:
779:
780:
781:
782:
783:
784: scc1aReceiveMask = (d & 0x18) != 0 ? SCC_1A_RECEIVE_MASK : 0;
785: scc1aSendMask = (d & 0x02) != 0 ? SCC_1A_SEND_MASK : 0;
786: if ((d & 0xe3) != 0x00) {
787: if (SCC_DEBUG_ON && sccDebugOn != 0) {
788: System.out.println ("unimplemented interrupt mode");
789: }
790: }
791: break;
792: case 2:
793: sccInterruptVector = d;
794: if (SCC_DEBUG_ON && sccDebugOn != 0) {
795: System.out.printf ("sccInterruptVector=0x%02x\n", sccInterruptVector);
796: }
797: sccUpdateVector ();
798: break;
799: case 3:
800:
801:
802:
803:
804:
805:
806:
807:
808:
809:
810:
811:
812: if ((d & 0x3e) == 0x00) {
813: scc1aRxBits = d >> 6;
814: } else {
815: if (SCC_DEBUG_ON && sccDebugOn != 0) {
816: System.out.println ("unimplemented receiver configuration");
817: }
818: }
819: break;
820: case 4:
821:
822:
823:
824:
825:
826:
827:
828:
829:
830:
831:
832:
833:
834:
835:
836:
837:
838: scc1aClockModeShift = d >> 6 == 0 ? 0 : (d >> 6) + 3;
839: scc1aStop = d >> 2 & 3;
840: scc1aParity = d & 3;
841: break;
842: case 5:
843:
844:
845:
846:
847:
848:
849:
850:
851:
852:
853:
854:
855:
856:
857:
858: if ((d & 0x15) == 0x00) {
859: RS232CTerminal.trmAUXSetNotReceiving ((d & 0x02) == 0);
860: scc1aTxBits = d >> 5 & 3;
861: scc1aTxEnable = d >> 3 & 1;
862: } else {
863: if (SCC_DEBUG_ON && sccDebugOn != 0) {
864: System.out.println ("unimplemented sender configuration");
865: }
866: }
867: break;
868: case 6:
869: break;
870: case 7:
871: break;
872: case 9:
873: if ((d & 0xc0) == 0x40) {
874: scc0bRts = 0;
875: } else if ((d & 0xc0) == 0x80) {
876: scc1aBRGEnable = 0;
877: scc1aRxEnable = 0;
878: scc1aTxEnable = 0;
879: RS232CTerminal.trmAUXReset ();
880: } else if ((d & 0xc0) == 0xc0) {
881: scc0bRts = 0;
882: scc1aBRGEnable = 0;
883: scc1aRxEnable = 0;
884: scc1aTxEnable = 0;
885: RS232CTerminal.trmAUXReset ();
886: }
887: sccVectorInclude = d & 0x11;
888: if (SCC_DEBUG_ON && sccDebugOn != 0) {
889: System.out.printf ("sccVectorInclude=0x%02x\n", sccVectorInclude);
890: }
891: sccUpdateVector ();
892: if ((d & 0x2e) != 0x08) {
893: if (SCC_DEBUG_ON && sccDebugOn != 0) {
894: System.out.println ("unimplemented interrupt configuration");
895: }
896: }
897: break;
898: case 10:
899: if (d == 0x00) {
900: } else {
901: if (SCC_DEBUG_ON && sccDebugOn != 0) {
902: System.out.println ("unimplemented SDLC configuration");
903: }
904: }
905: break;
906: case 11:
907: if (d == 0x50) {
908: } else if (d == 0x56) {
909: } else {
910: if (SCC_DEBUG_ON && sccDebugOn != 0) {
911: System.out.println ("unimplemented clock control");
912: }
913: }
914: break;
915: case 12:
916:
917:
918:
919:
920:
921:
922:
923:
924:
925:
926:
927:
928:
929:
930:
931:
932: scc1aBaudRateGen = (scc1aBaudRateGen & ~0xff) | d;
933: break;
934: case 13:
935:
936:
937:
938: scc1aBaudRateGen = d << 8 | (scc1aBaudRateGen & 0xff);
939: break;
940: case 14:
941:
942:
943:
944:
945:
946:
947:
948:
949:
950:
951:
952:
953:
954:
955:
956:
957:
958: if ((d & 0xfe) == 0x02) {
959: scc1aBRGEnable = d & 1;
960: if (scc1aBRGEnable != 0) {
961:
962:
963:
964:
965:
966:
967:
968:
969: RS232CTerminal.trmReflectSettings (1);
970: }
971: } else {
972: if (SCC_DEBUG_ON && sccDebugOn != 0) {
973: System.out.println ("unimplemented DPLL configuration");
974: }
975: }
976: break;
977: case 15:
978:
979:
980:
981:
982:
983:
984:
985:
986:
987:
988: if (d == 0x00) {
989: } else if (d == 0x80) {
990: } else if (d == 0x88) {
991: } else {
992: if (SCC_DEBUG_ON && sccDebugOn != 0) {
993: System.out.println ("unimplemented status interrupt configuration");
994: }
995: }
996: break;
997: default:
998: if (SCC_DEBUG_ON && sccDebugOn != 0) {
999: System.out.println ("unimplemented register");
1000: }
1001: }
1002: scc1aRegisterNumber = 0;
1003: return;
1004:
1005: case SCC_1A_DATA & 7:
1006: RS232CTerminal.trmAUXWriteData (d);
1007: return;
1008:
1009: default:
1010: ;
1011: }
1012: }
1013:
1014:
1015:
1016: }
1017:
1018:
1019: