From 6cda56650d60c237ab2482d34216dc4d3bcf0f72 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Thu, 8 Nov 2012 06:23:52 -0800 Subject: [PATCH] Fixed compiler identified bugs and warnings. --- TX-0/tx0_cpu.c | 20 ++++++++++++-------- display/display.c | 14 +++++++------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/TX-0/tx0_cpu.c b/TX-0/tx0_cpu.c index ad08285c..034a1b38 100644 --- a/TX-0/tx0_cpu.c +++ b/TX-0/tx0_cpu.c @@ -466,7 +466,9 @@ t_stat sim_instr (void) while (reason == 0) { /* loop until halted */ if (sim_interval <= 0) { /* check clock queue */ - if (reason = sim_process_event ()) break; + reason = sim_process_event (); + if (reason != SCPE_OK) + break; } if (sim_brk_summ && sim_brk_test (PC, SWMASK ('E'))) { /* breakpoint? */ @@ -699,8 +701,8 @@ t_stat sim_instr (void) break; case 2: /* tsx (Transfer and set Index) */ XR = PC & 0017777; /* XR[4] = 0; */ + TRACE_PRINT(TRN_MSG, ("[%06o] TSX: PC=%06o, XR=%05o\n", PC-1, y, XR)); PC = y; - TRACE_PRINT(TRN_MSG, ("[%06o] TSX: PC=%06o, XR=%05o\n", PC, XR)); inst_ctr.tsx++; break; case 3: /* tix (Transfer and Index) */ @@ -807,8 +809,8 @@ t_stat sim_instr (void) case IOS_SEL: { /* These are used for Magtape control. Magtape is compatible with IBM 709. Maybe the SIMH 7090 magtape can be leveraged. */ - int32 CLRA = (op && 0100000); - int32 BINDEC = (op && 020); + int32 CLRA = (op & 0100000); + int32 BINDEC = (op & 020); int32 device = op & 03; int32 tape_ord = (op >> 2) & 03; char *tape_cmd[] = {"Backspace Tape", "Read/Select Tape", "Rewind Tape", "Write/Select Tape" }; @@ -1006,7 +1008,7 @@ t_stat sim_instr (void) TRACE_PRINT(COUNTERS_MSG, ("TRN=%d, TZE=%d, TSX=%d, TIX=%d, TRA=%d, TRX=%d, TLV=%d\n", inst_ctr.trn, inst_ctr.tze, inst_ctr.tsx, inst_ctr.tix, inst_ctr.tra, inst_ctr.trx, inst_ctr.tlv)); TRACE_PRINT(COUNTERS_MSG, ("CLA=%d, AMB=%d, CYR=%d, SHR=%d, MBL=%d, XMB=%d, COM=%d, PAD=%d, CRY=%d, ANB=%d, ORB=%d, LMB=%d, MBX=%d\n", - inst_ctr.cla = inst_ctr.amb, inst_ctr.cyr, inst_ctr.shr, inst_ctr.mbl, inst_ctr.xmb, inst_ctr.com, inst_ctr.pad, inst_ctr.cry, inst_ctr.anb, inst_ctr.orb, inst_ctr.lmb, inst_ctr.mbx)); + inst_ctr.cla, inst_ctr.amb, inst_ctr.cyr, inst_ctr.shr, inst_ctr.mbl, inst_ctr.xmb, inst_ctr.com, inst_ctr.pad, inst_ctr.cry, inst_ctr.anb, inst_ctr.orb, inst_ctr.lmb, inst_ctr.mbx)); return reason; } @@ -1222,13 +1224,13 @@ t_stat sim_load(FILE *fileref, char *cptr, char *fnam, int32 flag) { if (result == NULL) return SCPE_ARG; for (j = lo; j <= hi; j++) { - if (_putw(j, fileref)== EOF) return SCPE_IOERR; - if (_putw(M[j], fileref) == EOF) return SCPE_IOERR; + if (putw(j, fileref)== EOF) return SCPE_IOERR; + if (putw(M[j], fileref) == EOF) return SCPE_IOERR; } } else { lo = strtotv(cptr, &result, 8) & 0xFFFF; for (j = lo; !feof(fileref); j++) { - if ((word = _getw(fileref)) == EOF) break; + if ((word = getw(fileref)) == EOF) break; M[j] = word; } } @@ -1374,7 +1376,9 @@ t_stat sim_opr_orig(int32 op) AC |= petr(1, 0, 0); break; case OOPR_DIS: +#ifdef USE_DISPLAY LP = dpy (AC); /* Display point on the CRT */ +#endif /* USE_DISPLAY */ break; } } diff --git a/display/display.c b/display/display.c index efbce44b..aa276435 100644 --- a/display/display.c +++ b/display/display.c @@ -85,9 +85,9 @@ #define ELEMENTS(X) (sizeof(X)/sizeof(X[0])) struct phosphor { - float red, green, blue; - float level; /* decay level (0.5 for half life) */ - float t_level; /* seconds to decay to level */ + double red, green, blue; + double level; /* decay level (0.5 for half life) */ + double t_level; /* seconds to decay to level */ }; struct color { @@ -545,7 +545,7 @@ display_delay(int t, int slowdown) #endif /* DEBUG_DELAY defined */ } } - else if (elapsed < MINELAPSED || slowdown && delay < MINDELAY) { + else if ((elapsed < MINELAPSED) || (slowdown && (delay < MINDELAY))) { /* too little elapsed time passed, or delta very small */ int gain = delay_check>>GAINSHIFT; if (gain == 0) @@ -783,13 +783,13 @@ phosphor_init(struct phosphor *phosphors, int nphosphors, int color) * for each of R G and B to be greater than 1.0 */ - r = rr * level_scale[ilevel] * 0xffff; + r = (int)(rr * level_scale[ilevel] * 0xffff); if (r > 0xffff) r = 0xffff; - g = rg * level_scale[ilevel] * 0xffff; + g = (int)(rg * level_scale[ilevel] * 0xffff); if (g > 0xffff) g = 0xffff; - b = rb * level_scale[ilevel] * 0xffff; + b = (int)(rb * level_scale[ilevel] * 0xffff); if (b > 0xffff) b = 0xffff; cp = ws_color_rgb(r, g, b);