TM03/TE16のサポート - Page 6

2003.12.12

ここからはデバッグを始めるのですが、 その前に SIMH のログ機能を使うため、 幾つかの追加コードを入れましょう。


pdp11_tu.c に対する追加


$ cvs diff -u pdp11_tu.c
cvs diff: Diffing .
Index: pdp11_tu.c
===================================================================
RCS file: /wrk/simh/cvs/src/simh/pdp11e/pdp11_tu.c,v
retrieving revision 1.21
diff -u -r1.21 pdp11_tu.c
--- pdp11_tu.c	12 Dec 2003 05:49:11 -0000	1.21
+++ pdp11_tu.c	12 Dec 2003 07:45:49 -0000
@@ -10,7 +10,8 @@
 extern int32 cpu_18b, cpu_ubm, cpu_rh11;
 extern int32 int_req[IPL_HLVL];
 extern int32 int_vec[IPL_HLVL][32];
-
+extern int32 cpu_log;
+extern FILE *sim_log;
 
 #define TU_NUMDR	8				// #drives
 #define USTAT		u3				// unit status
@@ -274,6 +275,63 @@
   0	// 07 Reserved
 };
 
+char *reg_name[] = {
+  "TUCS1",
+  "TUWC ",
+  "TUBA ",
+  "TUFC ",
+  "TUCS2",
+  "TUFS ",
+  "TUER ",
+  "TUAS ",
+  "TUCC ",
+  "TUDB ",
+  "TUMR ",
+  "TUDT ",
+  "TUSN ",
+  "TUTC ",
+  "TUBAE",
+  "TUCS3",
+  NULL
+};
+
+char *fnc_name[] = {
+  "FNC_NOP",
+  "FNC_UNLOAD",
+  "002",
+  "FNC_REWIND",
+  "FNC_FCLR",
+  "005",
+  "006",
+  "007",
+  "FNC_RIP",
+  "011",
+  "FNC_ERASE",
+  "FNC_WREOF",
+  "FNC_SPACEF",
+  "FNC_SPACER",
+  "016",
+  "017",
+  "020",
+  "021",
+  "022",
+  "023",
+  "FNC_WCHKF",
+  "025",
+  "026",
+  "FNC_WCHKR",
+  "FNC_WRITE",
+  "031",
+  "032",
+  "033",
+  "FNC_READF",
+  "035",
+  "036",
+  "FNC_READR",
+  NULL
+};
+
+
 static uint8 *xbuf = NULL;			// xfer buffer
 
 
@@ -470,6 +528,10 @@
 int32
 tu_inta(void)
 {
+#if 1
+if (DBG_LOG(LOG_TU))
+fprintf(sim_log, "# tu_inta()\n");
+#endif
 	tucs1 &= ~CS1_IE;				// clear int enable
 	tuiff  = 0;					// clear CSTB INTR
 	return(VEC_TU);					// acknowledge
@@ -528,7 +590,10 @@
 	t_mtrlnt tbc;
 	t_stat st;
 	t_stat r = SCPE_OK;
-
+#if 1
+if (DBG_LOG(LOG_TU))
+fprintf(sim_log, "# tu_svc(uptr)\n");
+#endif
 	drv = uptr - tu_dev.units;			// get drive #
 	if (uptr->USTAT & FS_REW) {			// rewind or unload?
 		sim_tape_rewind(uptr);			// rewind tape
@@ -543,7 +608,11 @@
 	ba  = (tubae << 16) | tuba;			// get byte addr
 	wc = 0200000 - tuwc;				// get word count
 	fc = 0200000 - tufc;				// get frame count
-
+#if 1
+if (DBG_LOG(LOG_TU))
+fprintf(sim_log, "# f = 0%o, fmt = 0%o, ba = 0%o, wc = %d, fc = %d\n",
+f, fmt, ba, wc, fc);
+#endif
 	uptr->USTAT = 0;				// clear status
 
 	switch (f) {					// case on function
@@ -685,7 +754,10 @@
 {
 	int32 fnc, den, space_test = FS_BOT;
 	UNIT *uptr;
-
+#if 1
+if (DBG_LOG(LOG_TU))
+  fprintf(sim_log, "# tu_go(drv = %d)\n", drv);
+#endif
 	fnc = GET_FNC(tucs1);				// get function
 	den = GET_DEN(tutc);				// get density
 	uptr = tu_dev.units + drv;			// get unit
@@ -702,7 +774,10 @@
 
 	tufs &= ~FS_ATA;				// clear attention
 	tutc &= ~TC_SAC;				// clear addr change
-
+#if 1
+if (DBG_LOG(LOG_TU))
+  fprintf(sim_log, "# tu_go: tucs1 = 0%06o [%s]\n", tucs1, fnc_name[fnc]);
+#endif
 	switch (fnc) {					// case on function
 	case FNC_FCLR:					// drive clear
 		tuer  = 0;				// clear errors
@@ -779,14 +854,26 @@
 	case FNC_READF:					// read
 	DATA_XFER:
 		if ((uptr->flags & UNIT_ATT) == 0) {	// unattached?
+#if 1
+if (DBG_LOG(LOG_TU))
+  fprintf(sim_log, "# tu_go: unattached\n");
+#endif
 			tuer |= ER_UNS;
 			break;
 		}
 		if (fmt_test[GET_FMT(tutc)] == 0) {	// invalid format?
+#if 1
+if (DBG_LOG(LOG_TU))
+  fprintf(sim_log, "# tu_go: invalid format\n");
+#endif
 			tuer |= ER_FER;
 			break;
 		}
 		if (den_test[den] == 0) {		// invalid density?
+#if 1
+if (DBG_LOG(LOG_TU))
+  fprintf(sim_log, "# tu_go: invalid density\n");
+#endif
 			tuer |= ER_NXF;
 			break;
 		}
@@ -917,7 +1004,10 @@
 		update_tucs(0, drv);
 		break;
 	}
-
+#if 1
+if (DBG_LOG(LOG_TU))
+  fprintf(sim_log, "# tu_rd: %s: 0%06o\n", reg_name[j], *data);
+#endif
 	return(SCPE_OK);
 }
 
@@ -939,7 +1029,10 @@
 		tuer = tuer | ER_RMR;			// won't write
 		update_tucs (0, drv);
 		return SCPE_OK;  }
-
+#if 1
+if (DBG_LOG(LOG_TU))
+  fprintf(sim_log, "# tu_wr: %s: 0%06o\n", reg_name[j], data);
+#endif
 	switch (j) {					// decode PA<4:1>
 	case 000:					// MTCS1
 		if ((access == WRITEB) && (PA & 1)) {
@@ -1100,7 +1193,8 @@
 	int32 u;
 	UNIT *uptr;
 #if 1
-printf("# tu_reset(dptr)\r\n");
+if (DBG_LOG(LOG_TU))
+fprintf(sim_log, "# tu_reset(dptr)\n");
 #endif
 	tucs1 = CS1_DVA | CS1_DONE;
 	tuba  = 0;
@@ -1138,7 +1232,8 @@
 	int32 drv = uptr - tu_dev.units;
 	t_stat r;
 #if 1
-printf("# tu_attach(uptr, cptr =\"%s\")\r\n", cptr);
+if (DBG_LOG(LOG_TU))
+fprintf(sim_log, "# tu_attach(uptr, cptr =\"%s\")\n", cptr);
 #endif
 	r = sim_tape_attach(uptr, cptr);
 	if (r != SCPE_OK) {
@@ -1165,7 +1260,8 @@
 {
 	int32 drv = uptr - tu_dev.units;
 #if 1
-printf("# tu_detach(uptr)\r\n");
+if (DBG_LOG(LOG_TU))
+fprintf(sim_log, "# tu_detach(uptr)\n");
 #endif
 	if (sim_is_active(uptr)) {			// unit active?
 		sim_cancel(uptr);			// cancel operation

$ 


pdp11_defs.h に対する追加


$ cvs diff -u pdp11_defs.h
Index: pdp11_defs.h
===================================================================
RCS file: /wrk/simh/cvs/src/simh/pdp11e/pdp11_defs.h,v
retrieving revision 1.3
diff -u -r1.3 pdp11_defs.h
--- pdp11_defs.h        11 Dec 2003 11:26:09 -0000      1.3
+++ pdp11_defs.h        12 Dec 2003 06:06:30 -0000
@@ -565,20 +565,21 @@
 
 /* Logging */
 
-#define LOG_CPU_I      0x0001
-#define LOG_TM         0x0008
-#define LOG_RP         0x0010
-#define LOG_TS         0x0020
-#define LOG_RQ         0x0040
-#define LOG_TQ         0x0080
-#define LOG_XQ0                0x0100
-#define LOG_XQ1                0x0200
-#define LOG_XQ2                0x0400
-#define LOG_XQ3                0x0800
-#define LOG_TC_MS      0x1000
-#define LOG_TC_RW      0x2000
-#define LOG_TC_BL      0x4000
-#define LOG_HK         0x8000
+#define LOG_CPU_I      0x00001
+#define LOG_TM         0x00008
+#define LOG_RP         0x00010
+#define LOG_TS         0x00020
+#define LOG_RQ         0x00040
+#define LOG_TQ         0x00080
+#define LOG_XQ0                0x00100
+#define LOG_XQ1                0x00200
+#define LOG_XQ2                0x00400
+#define LOG_XQ3                0x00800
+#define LOG_TC_MS      0x01000
+#define LOG_TC_RW      0x02000
+#define LOG_TC_BL      0x04000
+#define LOG_HK         0x08000
+#define LOG_TU         0x18000
 
 #define DBG_LOG(x)     (sim_log && (cpu_log & (x)))
 
$ 


pdp11_cpu.c に対する追加


$ cvs diff -u pdp11_cpu.c
Index: pdp11_cpu.c
===================================================================
RCS file: /wrk/simh/cvs/src/simh/pdp11e/pdp11_cpu.c,v
retrieving revision 1.1
diff -u -r1.1 pdp11_cpu.c
--- pdp11_cpu.c 12 Dec 2003 06:07:27 -0000      1.1
+++ pdp11_cpu.c 12 Dec 2003 06:08:15 -0000
@@ -415,7 +415,7 @@
        { ORDATA (STOP_TRAPS, stop_trap, TRAP_V_MAX) },
        { FLDATA (STOP_VECA, stop_vecabort, 0) },
        { FLDATA (STOP_SPA, stop_spabort, 0) },
-       { HRDATA (DBGLOG, cpu_log, 16), REG_HIDDEN },
+       { HRDATA (DBGLOG, cpu_log, 32), REG_HIDDEN },
        { ORDATA (FAC0H, FR[0].h, 32) },
        { ORDATA (FAC0L, FR[0].l, 32) },
        { ORDATA (FAC1H, FR[1].h, 32) },

$ 


ログ機能の動作確認





PREV   NEXT