From 28f645aeabcc3de25d4a10787e5804e49f891839 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Wed, 13 Mar 2013 22:28:14 -0700 Subject: [PATCH] Compiler suggested cleanups --- AltairZ80/altairz80_dsk.c | 6 ++++-- AltairZ80/altairz80_hdsk.c | 6 ++++-- AltairZ80/altairz80_sio.c | 15 ++++++++++----- NOVA/nova_cpu.c | 11 ++++++----- PDP11/pdp11_dmc.c | 2 ++ PDP11/pdp11_sys.c | 3 ++- PDP11/pdp11_xq.c | 3 ++- VAX/vax_sysdev.c | 2 +- swtp6800/common/m6800.c | 24 +++++++++++++----------- 9 files changed, 44 insertions(+), 28 deletions(-) diff --git a/AltairZ80/altairz80_dsk.c b/AltairZ80/altairz80_dsk.c index 4c7e9742..368f9743 100644 --- a/AltairZ80/altairz80_dsk.c +++ b/AltairZ80/altairz80_dsk.c @@ -477,10 +477,11 @@ int32 dsk11(const int32 port, const int32 io, const int32 data) { sim_debug(OUT_MSG, &dsk_dev, "DSK%i: " ADDRESS_FORMAT " OUT 0x09: %x\n", current_disk, PCX, data); if (data & 0x01) { /* step head in */ - if (current_track[current_disk] == (tracks[current_disk] - 1)) + if (current_track[current_disk] == (tracks[current_disk] - 1)) { sim_debug(TRACK_STUCK_MSG, &dsk_dev, "DSK%i: " ADDRESS_FORMAT " Unnecessary step in.\n", current_disk, PCX); + } current_track[current_disk]++; if (current_track[current_disk] > (tracks[current_disk] - 1)) current_track[current_disk] = (tracks[current_disk] - 1); @@ -491,10 +492,11 @@ int32 dsk11(const int32 port, const int32 io, const int32 data) { } if (data & 0x02) { /* step head out */ - if (current_track[current_disk] == 0) + if (current_track[current_disk] == 0) { sim_debug(TRACK_STUCK_MSG, &dsk_dev, "DSK%i: " ADDRESS_FORMAT " Unnecessary step out.\n", current_disk, PCX); + } current_track[current_disk]--; if (current_track[current_disk] < 0) { current_track[current_disk] = 0; diff --git a/AltairZ80/altairz80_hdsk.c b/AltairZ80/altairz80_hdsk.c index 085b17e5..1565c010 100644 --- a/AltairZ80/altairz80_hdsk.c +++ b/AltairZ80/altairz80_hdsk.c @@ -572,14 +572,16 @@ static int32 checkParameters(void) { selectedTrack = 0; } selectedDMA &= ADDRMASK; - if (hdskLastCommand == HDSK_READ) + if (hdskLastCommand == HDSK_READ) { sim_debug(READ_MSG, &hdsk_dev, "HDSK%d " ADDRESS_FORMAT " Read Track=%04d Sector=%02d Len=%04d DMA=%04x\n", selectedDisk, PCX, selectedTrack, selectedSector, uptr -> HDSK_SECTOR_SIZE, selectedDMA); - if (hdskLastCommand == HDSK_WRITE) + } + if (hdskLastCommand == HDSK_WRITE) { sim_debug(WRITE_MSG, &hdsk_dev, "HDSK%d " ADDRESS_FORMAT " Write Track=%04d Sector=%02d Len=%04d DMA=%04x\n", selectedDisk, PCX, selectedTrack, selectedSector, uptr -> HDSK_SECTOR_SIZE, selectedDMA); + } return TRUE; } diff --git a/AltairZ80/altairz80_sio.c b/AltairZ80/altairz80_sio.c index 10283178..f1440c48 100644 --- a/AltairZ80/altairz80_sio.c +++ b/AltairZ80/altairz80_sio.c @@ -702,12 +702,14 @@ static int32 sio0sCore(const int32 port, const int32 io, const int32 data) { int32 sio0s(const int32 port, const int32 io, const int32 data) { const int32 result = sio0sCore(port, io, data); - if (io == 0) + if (io == 0) { sim_debug(IN_MSG, &sio_dev, "\tSIO_S: " ADDRESS_FORMAT " IN(0x%03x) = 0x%02x\n", PCX, port, result); - else if (io) + } + else if (io) { sim_debug(OUT_MSG, &sio_dev, "\tSIO_S: " ADDRESS_FORMAT " OUT(0x%03x) = 0x%02x\n", PCX, port, data); + } return result; } @@ -750,12 +752,14 @@ static char* printable(char* result, int32 data, const int32 isIn) { int32 sio0d(const int32 port, const int32 io, const int32 data) { char buffer[8]; const int32 result = sio0dCore(port, io, data); - if (io == 0) + if (io == 0) { sim_debug(IN_MSG, &sio_dev, "\tSIO_D: " ADDRESS_FORMAT " IN(0x%03x) = 0x%02x%s\n", PCX, port, result, printable(buffer, result, TRUE)); - else if (io) + } + else if (io) { sim_debug(OUT_MSG, &sio_dev, "\tSIO_D: " ADDRESS_FORMAT " OUT(0x%03x) = 0x%02x%s\n", PCX, port, data, printable(buffer, data, FALSE)); + } return result; } @@ -1264,10 +1268,11 @@ static void attachCPM(UNIT *uptr) { /* 'C' option makes sure that file is properly truncated if it had existed before */ sim_quiet = sim_switches & SWMASK ('Q'); /* -q means quiet */ lastCPMStatus = attach_unit(uptr, cpmCommandLine); - if (lastCPMStatus != SCPE_OK) + if (lastCPMStatus != SCPE_OK) { sim_debug(VERBOSE_MSG, &simh_device, "SIMH: " ADDRESS_FORMAT " Cannot open '%s' (%s).\n", PCX, cpmCommandLine, sim_error_text(lastCPMStatus)); + } } /* setClockZSDOSAdr points to 6 byte block in M: YY MM DD HH MM SS in BCD notation */ diff --git a/NOVA/nova_cpu.c b/NOVA/nova_cpu.c index efd30f62..c71b6680 100644 --- a/NOVA/nova_cpu.c +++ b/NOVA/nova_cpu.c @@ -243,11 +243,12 @@ #define STK_CHECK(x,y) if (((x) & 0377) < (y)) \ int_req = int_req | INT_STK #define IND_STEP(x) M[x] & A_IND; /* return next level indicator */ \ - if ( ((x) <= AUTO_TOP) && ((x) >= AUTO_INC) ) \ - if ( (x) < AUTO_DEC ) \ - M[x] = (M[x] + 1) & DMASK; \ - else \ - M[x] = (M[x] - 1) & DMASK; \ + if ( ((x) <= AUTO_TOP) && ((x) >= AUTO_INC) ) { \ + if ( (x) < AUTO_DEC ) \ + M[x] = (M[x] + 1) & DMASK; \ + else \ + M[x] = (M[x] - 1) & DMASK; \ + } \ x = M[x] & AMASK #define INCREMENT_PC PC = (PC + 1) & AMASK /* increment PC */ diff --git a/PDP11/pdp11_dmc.c b/PDP11/pdp11_dmc.c index ef074a60..ccbe3419 100644 --- a/PDP11/pdp11_dmc.c +++ b/PDP11/pdp11_dmc.c @@ -2311,7 +2311,9 @@ t_stat dmc_wr(int32 data, int32 PA, int32 access) if (access == WRITE) { if (PA & 1) + { sim_debug(DBG_WRN, controller->device, "dmc_wr(), Unexpected non-16-bit write access to SEL%d\n", reg); + } dmc_setreg(controller, PA, data, 1); } else diff --git a/PDP11/pdp11_sys.c b/PDP11/pdp11_sys.c index 265b011c..6743d117 100644 --- a/PDP11/pdp11_sys.c +++ b/PDP11/pdp11_sys.c @@ -1076,7 +1076,8 @@ switch (j) { /* case on class */ for (cptr = get_glyph (cptr, gbuf, 0); gbuf[0] != 0; cptr = get_glyph (cptr, gbuf, 0)) { for (i = 0; (opcode[i] != NULL) && - (strcmp (opcode[i], gbuf) != 0) ; i++) ; + (strcmp (opcode[i], gbuf) != 0) ; i++) + ; if ((((opc_val[i] >> I_V_CL) & I_M_CL) != j) || (opcode[i] == NULL)) return SCPE_ARG; diff --git a/PDP11/pdp11_xq.c b/PDP11/pdp11_xq.c index 19412b46..1fd6297f 100644 --- a/PDP11/pdp11_xq.c +++ b/PDP11/pdp11_xq.c @@ -2645,11 +2645,12 @@ t_stat xq_svc(UNIT* uptr) } /* resubmit service timer */ - if ((xq->var->must_poll) || (xq->var->poll && (xq->var->mode != XQ_T_DELQA_PLUS))) + if ((xq->var->must_poll) || (xq->var->poll && (xq->var->mode != XQ_T_DELQA_PLUS))) { if (sim_idle_enab) sim_clock_coschedule(uptr, tmxr_poll); else sim_activate(uptr, (tmr_poll*clk_tps)/xq->var->poll); + } return SCPE_OK; } diff --git a/VAX/vax_sysdev.c b/VAX/vax_sysdev.c index 58ae915a..8bbef94e 100644 --- a/VAX/vax_sysdev.c +++ b/VAX/vax_sysdev.c @@ -1739,7 +1739,7 @@ fprintf (st, "console halt (BREAK typed on the console terminal). If BDR<7> is fprintf (st, "onsole firmware responds to all these conditions by entering its interactive\n"); fprintf (st, "command mode. If BDR<7> is clear, the console firmware boots the operating\n"); fprintf (st, "system in response to these conditions. This bit can be set and cleared by\n"); -fprintf (st, "the command “SET CPU AUTOBOOT” (clearing the flag) and “SET CPU NOAUTOBOOT”\n"); +fprintf (st, "the command \"SET CPU AUTOBOOT\" (clearing the flag) and \"SET CPU NOAUTOBOOT\"\n"); fprintf (st, "setting the flag. The default value is set.\n"); return SCPE_OK; } diff --git a/swtp6800/common/m6800.c b/swtp6800/common/m6800.c index 794184c7..ba3c8609 100644 --- a/swtp6800/common/m6800.c +++ b/swtp6800/common/m6800.c @@ -88,20 +88,20 @@ /* Macros to handle the flags in the CCR */ #define CCR_ALWAYS_ON (0xC0) /* for 6800 */ #define CCR_MSK (HF|IF|NF|ZF|VF|CF) -#define TOGGLE_FLAG(FLAG) (CCR ^= FLAG) -#define SET_FLAG(FLAG) (CCR |= FLAG) -#define CLR_FLAG(FLAG) (CCR &= ~FLAG) -#define GET_FLAG(FLAG) (CCR & FLAG) +#define TOGGLE_FLAG(FLAG) ((CCR) ^= FLAG) +#define SET_FLAG(FLAG) ((CCR) |= FLAG) +#define CLR_FLAG(FLAG) ((CCR) &= ~FLAG) +#define GET_FLAG(FLAG) ((CCR) & FLAG) #define COND_SET_FLAG(COND,FLAG) \ if (COND) SET_FLAG(FLAG); else CLR_FLAG(FLAG) #define COND_SET_FLAG_N(VAR) \ - if (VAR & 0x80) SET_FLAG(NF); else CLR_FLAG(NF) + if ((VAR) & 0x80) SET_FLAG(NF); else CLR_FLAG(NF) #define COND_SET_FLAG_Z(VAR) \ - if (VAR == 0) SET_FLAG(ZF); else CLR_FLAG(ZF) + if ((VAR) == 0) SET_FLAG(ZF); else CLR_FLAG(ZF) #define COND_SET_FLAG_H(VAR) \ - if (VAR & 0x10) SET_FLAG(HF); else CLR_FLAG(HF) + if ((VAR) & 0x10) SET_FLAG(HF); else CLR_FLAG(HF) #define COND_SET_FLAG_C(VAR) \ - if (VAR & 0x100) SET_FLAG(CF); else CLR_FLAG(CF) + if ((VAR) & 0x100) SET_FLAG(CF); else CLR_FLAG(CF) #define COND_SET_FLAG_V(COND) \ if (COND) SET_FLAG(VF); else CLR_FLAG(VF) @@ -403,7 +403,7 @@ t_stat sim_instr (void) DAR += 6; A &= 0xF0; A |= (DAR & 0x0F); - COND_SET_FLAG(DAR & 0x10,CF); + COND_SET_FLAG(DAR & 0x10,CF); } DAR = (A >> 4) & 0x0F; if (DAR > 9 || get_flag(CF)) { @@ -1885,18 +1885,20 @@ int32 get_flag(int32 flg) void condevalVa(int32 op1, int32 op2) { - if (get_flag(CF)) + if (get_flag(CF)) { COND_SET_FLAG_V(((op1 & 0x80) && (op2 & 0x80)) || ( ((op1 & 0x80) == 0) && ((op2 & 0x80) == 0))); + } } /* test and set V for subtraction */ void condevalVs(int32 op1, int32 op2) { - if (get_flag(CF)) + if (get_flag(CF)) { COND_SET_FLAG_V(((op1 & 0x80) && ((op2 & 0x80) == 0)) || (((op1 & 0x80) == 0) && (op2 & 0x80))); + } } /* calls from the simulator */