diff --git a/I7000/i7000_chan.c b/I7000/i7000_chan.c index ea3406d..6802efe 100644 --- a/I7000/i7000_chan.c +++ b/I7000/i7000_chan.c @@ -242,7 +242,7 @@ set_chan(UNIT * uptr, int32 val, CONST char *cptr, void *desc) /* Hook up to new channel */ if (dibp->upc > 1) { - int unit; + uint32 unit; for (unit = 0; unit < dptr->numunits; unit++) { /* Set the new channel */ dptr->units[unit].flags &= ~UNIT_CHAN; @@ -270,7 +270,7 @@ print_chan(FILE * st, UNIT * uptr, int32 v, CONST void *desc) for (i = 0; sim_devices[i] != NULL; i++) { UNIT *u = sim_devices[i]->units; DIB *dibp = (DIB *) sim_devices[i]->ctxt; - int num; + uint32 num; /* If no DIB, not channel device */ if (dibp == NULL) @@ -346,7 +346,7 @@ chan9_set_select(UNIT * uptr, int32 val, CONST char *cptr, void *desc) /* Change to new selection. */ if (dibp->upc > 1) { - int unit; + uint32 unit; for (unit = 0; unit < dptr->numunits; unit++) { if (newsel) dptr->units[unit].flags |= UNIT_SELECT; diff --git a/I7000/i7000_com.c b/I7000/i7000_com.c index 542ec03..bf89262 100644 --- a/I7000/i7000_com.c +++ b/I7000/i7000_com.c @@ -474,7 +474,7 @@ t_stat com_svc(UNIT * uptr) if (chan_test(chan, CTL_READ)) { /* Send low order character if one */ if (com_dflg) { - ch = com_data; + ch = com_data & 0377; sim_debug(DEBUG_DATA, &com_dev, "sent=%02o\n", ch); switch (chan_write_char(chan, &ch, (com_sta == 3)?DEV_REOR:0)) { case DATA_OK: diff --git a/I7000/i7000_con.c b/I7000/i7000_con.c index 044e36e..e7a3fa3 100644 --- a/I7000/i7000_con.c +++ b/I7000/i7000_con.c @@ -76,9 +76,7 @@ t_stat con_help(FILE *, DEVICE *, UNIT *, int32, const char *); const char *con_description(DEVICE *dptr); extern char ascii_to_six[128]; -extern char mem_to_ascii[64]; extern t_stat chan_boot(int32, DEVICE *); -extern const char sim_six_to_ascii[64]; #ifdef I7070 t_stat cdr_setload(UNIT *, int32, char *, void *); t_stat cdr_getload(FILE *, UNIT *, int32, void *); diff --git a/I7000/i7000_defs.h b/I7000/i7000_defs.h index ec69901..a3de6ce 100644 --- a/I7000/i7000_defs.h +++ b/I7000/i7000_defs.h @@ -273,7 +273,7 @@ extern t_value assembly[NUM_CHAN]; /* Assembly register */ /* Channel half of controls */ /* Channel status */ extern uint32 chan_flags[NUM_CHAN]; /* Channel flags */ -extern char *chname[11]; /* Channel names */ +extern const char *chname[11]; /* Channel names */ extern int num_devs[NUM_CHAN]; /* Number devices per channel*/ extern uint8 lpr_chan9[NUM_CHAN]; #ifdef I7010 @@ -610,7 +610,7 @@ extern UNIT chan_unit[]; extern REG cpu_reg[]; extern int cycle_time; - +extern const char mem_to_ascii[64]; #endif /* _I7000_H_ */ diff --git a/I7000/i7000_dsk.c b/I7000/i7000_dsk.c index dded9da..6cb0c81 100644 --- a/I7000/i7000_dsk.c +++ b/I7000/i7000_dsk.c @@ -166,7 +166,7 @@ extern uint8 chan_io_status[NUM_CHAN]; /* Channel status flags */ struct disk_t { - char *name; /* Type Name */ + const char *name; /* Type Name */ int cyl; /* Number of cylinders */ int track; /* Number of tracks/cylinder */ unsigned int bpt; /* Max bytes per track */ @@ -1217,7 +1217,7 @@ disk_format(UNIT * uptr, FILE * f, int cyl, UNIT * base) sim_fwrite(fbuffer[u], 1, dsk->fbpt, f); /* Make sure we did not pass size of track */ - if (out > dsk->bpt) + if (out > (int)dsk->bpt) return 1; /* Too big for track */ return 0; } diff --git a/I7000/i7000_ht.c b/I7000/i7000_ht.c index b762539..9946c16 100644 --- a/I7000/i7000_ht.c +++ b/I7000/i7000_ht.c @@ -55,6 +55,9 @@ #define UNIT_HT(x) UNIT_ATTABLE|UNIT_DISABLE|UNIT_ROABLE|UNIT_S_CHAN(x)| \ UNIT_SELECT +#if defined(HTSIZE) +#undef HTSIZE +#endif #define HTSIZE 31731000 /* in u3 is device address */ @@ -140,7 +143,7 @@ void ht_tape_posterr(UNIT * uptr, uint32 error); /* One buffer per channel */ uint8 ht_unit[NUM_CHAN * 2]; /* Currently selected unit */ -uint8 ht_buffer[NUM_DEVS_HT][BUFFSIZE]; +uint8 ht_buffer[NUM_DEVS_HT+1][BUFFSIZE]; int ht_cmdbuffer[NUM_CHAN]; /* Buffer holding command ids */ int ht_cmdcount[NUM_CHAN]; /* Count of command digits recieved */ uint32 ht_sense[NUM_CHAN * 2]; /* Sense data for unit */ @@ -175,9 +178,9 @@ UNIT hta_unit[] = { }; MTAB ht_mod[] = { - {MTUF_WLK, 0, "write enabled", "WRITEENABLED", NULL, NULL, + {MTUF_WLK, 0, "write enabled", "WRITEENABLED", NULL, NULL, NULL, "Write ring in place"}, - {MTUF_WLK, MTUF_WLK, "write locked", "LOCKED", NULL, NULL, + {MTUF_WLK, MTUF_WLK, "write locked", "LOCKED", NULL, NULL, NULL, "no Write ring in place"}, {MTAB_XTD | MTAB_VUN, 0, "FORMAT", "FORMAT", &sim_tape_set_fmt, &sim_tape_show_fmt, NULL, @@ -205,7 +208,7 @@ DEVICE hta_dev = { #if NUM_DEVS_HT > 1 DEVICE htb_dev = { - "HTB", &hta_unit[11], NULL, ht_mod, + "HTB", &hta_unit[NUM_UNITS_HT + 1], NULL, ht_mod, NUM_UNITS_HT + 1, 8, 15, 1, 8, 8, NULL, NULL, &ht_reset, &ht_boot, &ht_attach, &ht_detach, &ht_dib, DEV_BUF_NUM(1) | DEV_DISABLE | DEV_DEBUG, 0, dev_debug, @@ -460,7 +463,7 @@ t_stat ht_srv(UNIT * uptr) ctlr->u5 |= HT_NOTRDY; } - if (uptr->u6 > uptr->hwmark) { + if (uptr->u6 > (int32)uptr->hwmark) { chan_set(chan, DEV_REOR|CTL_END); sim_activate(uptr, us_to_ticks(50)); return SCPE_OK; @@ -468,7 +471,7 @@ t_stat ht_srv(UNIT * uptr) ch = ht_buffer[GET_DEV_BUF(dptr->flags)][uptr->u6++]; sim_debug(DEBUG_DATA, dptr, "data %02o\n", ch); switch(chan_write_char(chan, &ch, - (uptr->u6 > uptr->hwmark)?DEV_REOR:0)) { + (uptr->u6 > (int32)uptr->hwmark)?DEV_REOR:0)) { case TIME_ERROR: /* Nop flag as timming error */ ht_tape_posterr(uptr, DATA_RESPONSE); diff --git a/I7000/i7000_lpr.c b/I7000/i7000_lpr.c index dcedf1d..bd697e2 100644 --- a/I7000/i7000_lpr.c +++ b/I7000/i7000_lpr.c @@ -241,7 +241,7 @@ print_line(UNIT * uptr, int chan, int unit) sim_putchar(out[j++]); } uptr->u4++; - if (uptr->u4 > uptr->capac) { + if (uptr->u4 > (int32)uptr->capac) { uptr->u4 = 1; } @@ -259,7 +259,7 @@ print_line(UNIT * uptr, int chan, int unit) if (uptr->flags & ECHO) sim_putchar('\n'); uptr->u4++; - if (uptr->u4 > uptr->capac) { + if (uptr->u4 > (int32)uptr->capac) { uptr->u4 = 1; } } diff --git a/I7000/i7000_mt.c b/I7000/i7000_mt.c index 19d3ac4..666f9cb 100644 --- a/I7000/i7000_mt.c +++ b/I7000/i7000_mt.c @@ -205,18 +205,18 @@ UNIT mta_unit[] = { }; MTAB mt_mod[] = { - {MTUF_WLK, 0, "write enabled", "WRITEENABLED", NULL, NULL, + {MTUF_WLK, 0, "write enabled", "WRITEENABLED", NULL, NULL, NULL, "Write ring in place"}, - {MTUF_WLK, MTUF_WLK, "write locked", "LOCKED", NULL, NULL, + {MTUF_WLK, MTUF_WLK, "write locked", "LOCKED", NULL, NULL, NULL, "No write ring in place"}, - {MTUF_LDN, 0, "high density", "HIGH", &mt_tape_density, NULL, + {MTUF_LDN, 0, "high density", "HIGH", &mt_tape_density, NULL, NULL, "556 BPI"}, - {MTUF_LDN, MTUF_LDN, "low density", "LOW", &mt_tape_density, NULL, + {MTUF_LDN, MTUF_LDN, "low density", "LOW", &mt_tape_density, NULL, NULL, "200 BPI"}, #ifdef I7090 - {MTUF_ONLINE, 0, "offline", "OFFLINE", NULL, NULL, + {MTUF_ONLINE, 0, "offline", "OFFLINE", NULL, NULL, NULL, "Tape offline"}, - {MTUF_ONLINE, MTUF_ONLINE, "online", "ONLINE", NULL, NULL, + {MTUF_ONLINE, MTUF_ONLINE, "online", "ONLINE", NULL, NULL, NULL, "Tape Online"}, #endif {MTAB_XTD | MTAB_VUN, 0, "FORMAT", "FORMAT", @@ -592,7 +592,7 @@ mt_read_buff(UNIT * uptr, int cmd, DEVICE * dptr, t_value *word) mode = 0100; *word = 0; - for(i = CHARSPERWORD-1; i >= 0 && uptr->u6 < uptr->hwmark; i--) { + for(i = CHARSPERWORD-1; i >= 0 && uptr->u6 < (int32)uptr->hwmark; i--) { ch = mt_buffer[bufnum][uptr->u6++]; /* Do BCD translation */ if ((parity_table[ch & 077] ^ (ch & 0100) ^ mode) == 0) { @@ -706,7 +706,7 @@ t_stat mt_srv(UNIT * uptr) uptr->u5 |= MT_RDY; } else if (cmd == MT_RDS || cmd == MT_RDSB) { /* Keep moving until end of block */ - if (uptr->u6 < uptr->hwmark ) { + if (uptr->u6 < (int32)uptr->hwmark ) { int i = (uptr->hwmark-uptr->u6) * ((uptr->flags & MTUF_LDN) ?LT:HT); uptr->u5 |= MT_SKIP; @@ -874,9 +874,9 @@ t_stat mt_srv(UNIT * uptr) /* Convert one word. */ switch (chan_write_char(chan, &ch, #ifdef I7010 - (uptr->u6 >= uptr->hwmark) ? DEV_REOR : 0)) { + (uptr->u6 >= (int32)uptr->hwmark) ? DEV_REOR : 0)) { #else - /*(uptr->u6 >= uptr->hwmark) ? DEV_REOR :*/ 0)) { + /*(uptr->u6 >= (int32)uptr->hwmark) ? DEV_REOR :*/ 0)) { #endif case END_RECORD: sim_debug(DEBUG_DATA, dptr, "Read unit=%d EOR\n", unit); @@ -884,7 +884,7 @@ t_stat mt_srv(UNIT * uptr) #ifndef I7010 uptr->u5 |= MT_EOR; #endif - if (uptr->u6 < uptr->hwmark) { + if (uptr->u6 < (int32)uptr->hwmark) { #ifdef I7010 sim_activate(uptr, (uptr->hwmark-uptr->u6) * 20); #else @@ -910,7 +910,7 @@ t_stat mt_srv(UNIT * uptr) case DATA_OK: sim_debug(DEBUG_DATA, dptr, "Read data unit=%d %d %02o\n", unit, uptr->u6, ch); - if (uptr->u6 >= uptr->hwmark) { /* In IRG */ + if (uptr->u6 >= (int32)uptr->hwmark) { /* In IRG */ #ifndef I7010 uptr->u5 |= MT_EOR; #endif @@ -1032,10 +1032,10 @@ t_stat mt_srv(UNIT * uptr) /* Convert one word. */ switch (chan_write_char(chan, &ch, - (uptr->u6 >= uptr->hwmark) ? DEV_REOR : 0)) { + (uptr->u6 >= (int32)uptr->hwmark) ? DEV_REOR : 0)) { case END_RECORD: sim_debug(DEBUG_DATA, dptr, "Read unit=%d EOR\n", unit); - if (uptr->u6 >= uptr->hwmark) { + if (uptr->u6 >= (int32)uptr->hwmark) { uptr->u5 &= ~MT_CMDMSK; uptr->u5 |= MT_SKIP; sim_activate(uptr, @@ -1048,7 +1048,7 @@ t_stat mt_srv(UNIT * uptr) case DATA_OK: sim_debug(DEBUG_DATA, dptr, "Read data unit=%d %d %02o\n", unit, uptr->u6, ch); - if (uptr->u6 >= uptr->hwmark) { /* In IRG */ + if (uptr->u6 >= (int32)uptr->hwmark) { /* In IRG */ sim_activate(uptr, (uptr->flags & MTUF_LDN) ? us_to_ticks(4250): us_to_ticks(2500)); @@ -1259,7 +1259,7 @@ t_stat mt_reset(DEVICE * dptr) { UNIT *uptr = dptr->units; - int i; + uint32 i; for (i = 0; i < dptr->numunits; i++) { sim_tape_set_dens (uptr, ((uptr->flags & MTUF_LDN) ? MT_DENS_200 : MT_DENS_556), diff --git a/I7000/i7010_chan.c b/I7000/i7010_chan.c index d0f4c71..3b8093b 100644 --- a/I7000/i7010_chan.c +++ b/I7000/i7010_chan.c @@ -131,9 +131,9 @@ DEVICE chan_dev = { NULL, NULL, &chan_help, NULL, NULL, &chan_description }; -struct { +struct urec_t { uint16 addr; - char *name; + const char *name; } urec_devs[] = { {0100, "CR"}, {0200, "LP"}, @@ -230,7 +230,7 @@ t_stat chan_issue_cmd(uint16 chan, uint16 dcmd, uint16 dev) { DEVICE **dptr; DIB *dibp; - int j; + uint32 j; UNIT *uptr; for (dptr = sim_devices; *dptr != NULL; dptr++) { diff --git a/I7000/i7010_cpu.c b/I7000/i7010_cpu.c index 8bc90e0..6ca4108 100644 --- a/I7000/i7010_cpu.c +++ b/I7000/i7010_cpu.c @@ -154,12 +154,7 @@ int cycle_time = 45; /* Cycle time in 100ns */ int32 hst_p = 0; /* History pointer */ int32 hst_lnt = 0; /* History length */ struct InstHistory *hst = NULL; /* History stack */ -extern uint32 sim_brk_summ; -extern uint32 sim_brk_types; -extern uint32 sim_brk_dflt; extern UNIT chan_unit[]; -extern int32 sim_interval; -extern const char sim_six_to_ascii[64]; /* CPU data structures @@ -343,7 +338,7 @@ uint8 FetchP(uint32 MA) { if (MAR > 100000) MAR -= 100000; } - if (prot_enb && high_addr > 0 && MAR > high_addr) { + if (prot_enb && (high_addr > 0) && (MAR > (uint32)high_addr)) { fault = STOP_PROT; return 0; } @@ -373,7 +368,7 @@ uint8 ReadP(uint32 MA) { if (MAR > 100000) MAR -= 100000; } - if (prot_enb && high_addr > 0 && MAR > high_addr) { + if (prot_enb && (high_addr > 0) && (MAR > (uint32)high_addr)) { fault = STOP_PROT; return 0; } @@ -382,8 +377,8 @@ uint8 ReadP(uint32 MA) { fault = STOP_PROT; return 0; } - if ((low_addr >= 0 && MAR < low_addr) || - (high_addr > 0 && MAR > high_addr)) { + if (((low_addr >= 0) && (MAR < (uint32)low_addr)) || + ((high_addr > 0) && (MAR > (uint32)high_addr))) { fault = STOP_PROT; return 0; } @@ -407,7 +402,7 @@ void WriteP(uint32 MA, uint8 v) { if (MAR > 100000) MAR -= 100000; } - if (prot_enb && high_addr > 0 && MAR > high_addr) { + if (prot_enb && (high_addr > 0) && (MAR > (uint32)high_addr)) { fault = STOP_PROT; return; } @@ -416,8 +411,8 @@ void WriteP(uint32 MA, uint8 v) { fault = STOP_PROT; return; } - if ((low_addr >= 0 && MAR < low_addr) || - (high_addr > 0 && MAR > high_addr)) { + if (((low_addr >= 0) && (MAR < (uint32)low_addr)) || + ((high_addr > 0) && (MAR > (uint32)high_addr))) { fault = STOP_PROT; return; } @@ -441,7 +436,7 @@ void ReplaceMask(uint32 MA, uint8 v, uint8 mask) { if (MAR > 100000) MAR -= 100000; } - if (prot_enb && high_addr > 0 && MAR > high_addr) { + if (prot_enb && (high_addr > 0) && (MAR > (uint32)high_addr)) { fault = STOP_PROT; return; } @@ -450,8 +445,8 @@ void ReplaceMask(uint32 MA, uint8 v, uint8 mask) { fault = STOP_PROT; return; } - if ((low_addr >= 0 && MAR < low_addr) || - (high_addr > 0 && MAR > high_addr)) { + if (((low_addr >= 0) && (MAR < (uint32)low_addr)) || + ((high_addr > 0) && (MAR > (uint32)high_addr))) { fault = STOP_PROT; return; } @@ -477,7 +472,7 @@ void SetBit(uint32 MA, uint8 v) { if (MAR > 100000) MAR -= 100000; } - if (prot_enb && high_addr > 0 && MAR > high_addr) { + if (prot_enb && (high_addr > 0) && (MAR > (uint32)high_addr)) { fault = STOP_PROT; return; } @@ -486,8 +481,8 @@ void SetBit(uint32 MA, uint8 v) { fault = STOP_PROT; return; } - if ((low_addr >= 0 && MAR < low_addr) || - (high_addr > 0 && MAR > high_addr)) { + if (((low_addr >= 0) && (MAR < (uint32)low_addr)) || + ((high_addr > 0) && (MAR > (uint32)high_addr))) { fault = STOP_PROT; return; } @@ -511,7 +506,7 @@ void ClrBit(uint32 MA, uint8 v) { if (MAR > 100000) MAR -= 100000; } - if (prot_enb && high_addr > 0 && MAR > high_addr) { + if (prot_enb && (high_addr > 0) && (MAR > (uint32)high_addr)) { fault = STOP_PROT; return; } @@ -520,8 +515,8 @@ void ClrBit(uint32 MA, uint8 v) { fault = STOP_PROT; return; } - if ((low_addr >= 0 && MAR < low_addr) || - (high_addr > 0 && MAR > high_addr)) { + if (((low_addr >= 0) && (MAR < (uint32)low_addr)) || + ((high_addr > 0) && (MAR > (uint32)high_addr))) { fault = STOP_PROT; return; } @@ -3813,7 +3808,7 @@ cpu_set_hist(UNIT * uptr, int32 val, CONST char *cptr, void *desc) hst = NULL; } if (lnt) { - hst = calloc(sizeof(struct InstHistory), lnt); + hst = (struct InstHistory *)calloc(sizeof(struct InstHistory), lnt); if (hst == NULL) return SCPE_MEM; @@ -3832,9 +3827,6 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc) t_stat r; t_value sim_eval[15]; struct InstHistory *h; - extern char mem_to_ascii[]; - extern t_stat fprint_sym(FILE * ofile, t_addr addr, - t_value * val, UNIT * uptr, int32 sw); if (hst_lnt == 0) return SCPE_NOFNC; /* enabled? */ diff --git a/I7000/i7010_defs.h b/I7000/i7010_defs.h index 2f0496c..01aa545 100644 --- a/I7000/i7010_defs.h +++ b/I7000/i7010_defs.h @@ -28,7 +28,7 @@ /* Memory */ #define AMASK 0x1ffff #define BBIT 0x80000000 -#define MEM_ADDR_OK(x) ((x & AMASK) < MEMSIZE) +#define MEM_ADDR_OK(x) ((uint32)(x & AMASK) < MEMSIZE) extern uint8 M[MAXMEMSIZE]; #define WM 0200 /* Word mark in memory */ diff --git a/I7000/i7010_sys.c b/I7000/i7010_sys.c index 2a0809d..425a81e 100644 --- a/I7000/i7010_sys.c +++ b/I7000/i7010_sys.c @@ -226,7 +226,7 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) typedef struct _opcode { uint16 opbase; - char *name; + const char *name; uint8 type; } t_opcode; @@ -525,7 +525,7 @@ t_opcode base_ops[] = { {0, NULL, TYPE_BE}, }; -char *chname[] = { +const char *chname[] = { "*", "1", "2", "3", "4" }; diff --git a/I7000/i701_cpu.c b/I7000/i701_cpu.c index eac12df..53e71d0 100644 --- a/I7000/i701_cpu.c +++ b/I7000/i701_cpu.c @@ -136,9 +136,6 @@ int cycle_time = 120; /* Cycle time of 12us */ int32 hst_p = 0; /* History pointer */ int32 hst_lnt = 0; /* History length */ struct InstHistory *hst = NULL; /* History stack */ -extern uint32 sim_brk_summ; -extern uint32 sim_brk_types; -extern uint32 sim_brk_dflt; extern uint32 drum_addr; uint32 hsdrm_addr; extern UNIT chan_unit[]; @@ -188,8 +185,6 @@ DEVICE cpu_dev = { NULL, 0, 0, NULL, NULL, NULL, &cpu_help, NULL, NULL, &cpu_description }; - -extern int32 sim_interval; /* Simulate instructions */ t_stat @@ -839,7 +834,7 @@ cpu_set_hist(UNIT * uptr, int32 val, CONST char *cptr, void *desc) hst = NULL; } if (lnt) { - hst = calloc(sizeof(struct InstHistory), lnt); + hst = (struct InstHistory *)calloc(sizeof(struct InstHistory), lnt); if (hst == NULL) return SCPE_MEM; @@ -858,8 +853,6 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc) t_stat r; t_value sim_eval; struct InstHistory *h; - extern t_stat fprint_sym(FILE * ofile, t_addr addr, - t_value * val, UNIT * uptr, int32 sw); if (hst_lnt == 0) return SCPE_NOFNC; /* enabled? */ diff --git a/I7000/i701_sys.c b/I7000/i701_sys.c index 5d9dbfe..6c3c46a 100644 --- a/I7000/i701_sys.c +++ b/I7000/i701_sys.c @@ -119,11 +119,6 @@ DEBTAB crd_debug[] = { {"CARD", DEBUG_CARD}, {0, 0} }; - -/* Character conversion tables */ -extern const char sim_six_to_ascii[64]; -extern const char sim_ascii_to_six[128]; - /* Load a card image file into memory. */ @@ -136,14 +131,7 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) int dlen = 0; char *p; - p = strrchr(fnam, '.'); - - if (p == NULL) - return SCPE_ARG; - - p++; - - if (strcasecmp(p, "crd") == 0) { + if (match_ext(fnam, "crd")) { int firstcard = 1; uint16 buf[80]; t_uint64 lbuff[24]; @@ -180,7 +168,7 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) dlen--; } } - } else if (strcasecmp(p, "oct") == 0) { + } else if (match_ext(fnam, "oct")) { char buf[81]; while (fgets(buf, 80, fileref) != 0) { @@ -196,7 +184,7 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) M[addr++] = wd; } } - } else if (strcasecmp(p, "txt") == 0) { + } else if (match_ext(fnam, "txt")) { char buf[81]; while (fgets(buf, 80, fileref) != 0) { @@ -205,10 +193,10 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) for(addr = 0; *p >= '0' && *p <= '7'; p++) addr = (addr << 3) + *p - '0'; while(*p == ' ' || *p == '\t') p++; - if(strncasecmp(p, "BCD", 3) == 0) { + if(sim_strncasecmp(p, "BCD", 3) == 0) { p += 4; parse_sym(++p, addr, &cpu_unit, &M[addr], SWMASK('C')); - } else if (strncasecmp(p, "OCT", 3) == 0) { + } else if (sim_strncasecmp(p, "OCT", 3) == 0) { p += 4; for(; *p == ' ' || *p == '\t'; p++); parse_sym(p, addr, &cpu_unit, &M[addr], 0); @@ -267,7 +255,7 @@ t_opcode base_ops[] = { {0, NULL} }; -char *chname[] = { "*" }; +const char *chname[] = { "*" }; @@ -355,7 +343,7 @@ fprint_sym(FILE * of, t_addr addr, t_value * val, UNIT * uptr, int32 sw) if ((inst >> 18) & 0400000L) fputc('-', of); fprint_val(of, (inst >> 18) & 0000000007777L, 8, 12, PV_RZRO); - op = (inst >> 12); + op = (int)(inst >> 12); fputs(" lt ", of); if (op != (040 + 13)) op &= 037; diff --git a/I7000/i7070_chan.c b/I7000/i7070_chan.c index e6afe5b..01de469 100644 --- a/I7000/i7070_chan.c +++ b/I7000/i7070_chan.c @@ -244,7 +244,7 @@ t_stat chan_issue_cmd(uint16 chan, uint16 dcmd, uint16 dev) { DEVICE **dptr; DIB *dibp; - int j; + uint32 j; UNIT *uptr; for (dptr = sim_devices; *dptr != NULL; dptr++) { diff --git a/I7000/i7070_cpu.c b/I7000/i7070_cpu.c index c969c96..90b98f8 100644 --- a/I7000/i7070_cpu.c +++ b/I7000/i7070_cpu.c @@ -132,9 +132,6 @@ int cycle_time = 20; /* Cycle time of 12us */ int32 hst_p = 0; /* History pointer */ int32 hst_lnt = 0; /* History length */ struct InstHistory *hst = NULL; /* History stack */ -extern uint32 sim_brk_summ; -extern uint32 sim_brk_types; -extern uint32 sim_brk_dflt; void (*sim_vm_init) (void) = &mem_init; @@ -191,8 +188,6 @@ DEVICE cpu_dev = { NULL, NULL, &cpu_help, NULL, NULL, &cpu_description }; - -extern int32 sim_interval; uint32 dscale[4][16] = { {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 0,0,0,0,0,0}, {0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 0,0,0,0,0,0}, @@ -498,7 +493,7 @@ sim_instr(void) } } else { if(dec_add(&AC[op2], MBR)) - inds |= 1 << (4 * (3 - op2)); /* Set overflow */ + inds |= 1LL << (4 * (3 - op2)); /* Set overflow */ } AC[op2] &= DMASK; if (sign & 8) @@ -545,7 +540,7 @@ sim_instr(void) } } else { if(dec_add(&temp, DMASK&AC[op2])) - inds |= 1 << (4 * (3 - op2)); /* Set overflow */ + inds |= 1LL << (4 * (3 - op2)); /* Set overflow */ } /* Put results back */ @@ -1554,7 +1549,7 @@ sim_instr(void) break; } MBR |= ((t_uint64)sign) << 40; - upd_idx(&MBR, temp); + upd_idx(&MBR, (uint32)temp); WriteP(IX, MBR); if (hst_lnt) { /* history enabled? */ hst[hst_p].after = MBR; @@ -1761,7 +1756,7 @@ sim_instr(void) temp = M[IX]; utmp = dec_bin_idx(temp); do { - int dst, limit; + uint32 dst, limit; MBR = ReadP(MA++); /* Grab next RDW */ get_rdw(MBR, &dst, &limit); while(dst <= limit) { @@ -1780,7 +1775,7 @@ sim_instr(void) temp = M[IX]; utmp = dec_bin_idx(temp); do { - int src, limit; + uint32 src, limit; MBR = ReadP(MA++); /* Grab next RDW */ get_rdw(MBR, &src, &limit); while(src <= limit) { @@ -1801,7 +1796,7 @@ sim_instr(void) temp = M[IX]; utmp = dec_bin_idx(temp); do { - int dst, limit; + uint32 dst, limit; MBR = ReadP(MA++); /* Grab next RDW */ get_rdw(MBR, &dst, &limit); while(dst <= limit) { @@ -1856,7 +1851,7 @@ sim_instr(void) temp = M[IX]; utmp = dec_bin_idx(temp); do { - int src, limit; + uint32 src, limit; MBR = ReadP(MA++); /* Grab next RDW */ get_rdw(MBR, &src, &limit); while(src <= limit) { @@ -1894,7 +1889,7 @@ sim_instr(void) temp = M[98]; utmp = dec_bin_idx(temp); do { - int src, limit; + uint32 src, limit; MBR = ReadP(MA++); /* Grab next RDW */ get_rdw(MBR, &src, &limit); while(src <= limit) { @@ -2569,7 +2564,7 @@ uint32 dec_bin_lim(t_uint64 a, uint32 b) { } /* Extract information from a RDW */ -int get_rdw(t_uint64 a, int *base, int *limit) { +int get_rdw(t_uint64 a, uint32 *base, uint32 *limit) { *base = dec_bin_idx(a); *limit = dec_bin_lim(a, *base); return (a >> 40); @@ -2879,7 +2874,7 @@ cpu_set_hist(UNIT * uptr, int32 val, CONST char *cptr, void *desc) hst = NULL; } if (lnt) { - hst = calloc(sizeof(struct InstHistory), lnt); + hst = (struct InstHistory *)calloc(sizeof(struct InstHistory), lnt); if (hst == NULL) return SCPE_MEM; @@ -2898,8 +2893,6 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc) t_stat r; t_value sim_eval; struct InstHistory *h; - extern t_stat fprint_sym(FILE * ofile, t_addr addr, - t_value * val, UNIT * uptr, int32 sw); if (hst_lnt == 0) return SCPE_NOFNC; /* enabled? */ diff --git a/I7000/i7070_defs.h b/I7000/i7070_defs.h index 09e7e2e..74f1e54 100644 --- a/I7000/i7070_defs.h +++ b/I7000/i7070_defs.h @@ -99,7 +99,7 @@ void div_step(t_uint64 b); void bin_dec(t_uint64 *a, uint32 b, int s, int l); uint32 dec_bin_idx(t_uint64 a); uint32 dec_bin_lim(t_uint64 a, uint32 b); -int get_rdw(t_uint64 a, int *base, int *limit); +int get_rdw(t_uint64 a, uint32 *base, uint32 *limit); void upd_idx(t_uint64 *a, uint32 b); int scan_irq(); diff --git a/I7000/i7070_sys.c b/I7000/i7070_sys.c index c2aad17..2ee73dc 100644 --- a/I7000/i7070_sys.c +++ b/I7000/i7070_sys.c @@ -159,11 +159,6 @@ DEBTAB crd_debug[] = { {0, 0} }; - -/* Character conversion tables */ -extern const char sim_six_to_ascii[64]; -extern const char sim_ascii_to_six[128]; - const char mem_to_ascii[64] = { ' ', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '=', '\'', ':', '>', 's', @@ -232,7 +227,7 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) typedef struct _opcode { uint16 opbase; - char *name; + const char *name; uint8 type; } t_opcode; @@ -491,7 +486,7 @@ t_opcode sub_ops[] = { }; -char *chname[11] = { +const char *chname[11] = { "*", "1", "2", "3", "4", "A", "B", "C", "D" }; diff --git a/I7000/i7080_chan.c b/I7000/i7080_chan.c index ac5d9a4..346dbad 100644 --- a/I7000/i7080_chan.c +++ b/I7000/i7080_chan.c @@ -254,7 +254,7 @@ t_stat chan_issue_cmd(uint16 chan, uint16 dcmd, uint16 dev) { DEVICE **dptr; DIB *dibp; - int j; + unsigned int j; UNIT *uptr; for (dptr = sim_devices; *dptr != NULL; dptr++) { @@ -354,9 +354,9 @@ int chan_zero_reccnt(int chan) { } /* Return next channel data address, advance address by 5 if channel */ -int32 chan_next_addr(int chan) { +uint32 chan_next_addr(int chan) { int unit; - int32 addr = 0; + uint32 addr = 0; switch(CHAN_G_TYPE(chan_unit[chan].flags)) { case CHAN_754: case CHAN_UREC: @@ -381,7 +381,7 @@ chan_proc() int chan; int cmask; int unit; - int32 addr; + uint32 addr; /* Scan channels looking for work */ for (chan = 0; chan < NUM_CHAN; chan++) { @@ -1111,7 +1111,7 @@ chan_read_char(int chan, uint8 * data, int flags) M[caddr[chan]] = CHR_BLANK; if (chan_dev.dctrl & (0x0100 << chan)) sim_debug(DEBUG_DATA, &chan_dev, - "%d > %02o (%d)\n", chan, *data, ch); + "%d > %02o (%d)\n", chan, *data, *data); caddr[chan]++; if ((cmd[chan] & CHAN_NOREC && (caddr[chan] % 19999) == 0)) { chan_flags[chan] |= DEV_WEOR; diff --git a/I7000/i7080_cpu.c b/I7000/i7080_cpu.c index 1176e8d..7f905a5 100644 --- a/I7000/i7080_cpu.c +++ b/I7000/i7080_cpu.c @@ -228,9 +228,6 @@ int cycle_time = 45; /* Cycle time is 4.5us */ int32 hst_p = 0; /* History pointer */ int32 hst_lnt = 0; /* History length */ struct InstHistory *hst = NULL; /* History stack */ -extern uint32 sim_brk_summ; -extern uint32 sim_brk_types; -extern uint32 sim_brk_dflt; extern uint32 drum_addr; extern UNIT chan_unit[]; void (*sim_vm_init) (void) = &mem_init; @@ -312,8 +309,6 @@ DEVICE cpu_dev = { NULL, NULL, &cpu_help, NULL, NULL, &cpu_description }; - -extern int32 sim_interval; /* Quick ways to wrap addresses */ uint16 next_addr[6 * 256]; /* Next storage location */ @@ -583,7 +578,7 @@ stop_cpu: temp = 10000; break; } - while (IC >= temp) + while (IC >= (uint32)temp) IC -= temp; /* Resolve full address and register based on cpu mode */ switch (cpu_type) { @@ -3255,7 +3250,7 @@ cpu_set_size(UNIT * uptr, int32 val, CONST char *cptr, void *desc) size = val >> UNIT_V_MSIZE; size++; size *= 10000; - if ((size < 0) || (size > MAXMEMSIZE)) + if (size > MAXMEMSIZE) return SCPE_ARG; for (i = size; i < MEMSIZE; i++) mc |= M[i]; @@ -3294,7 +3289,7 @@ cpu_set_hist(UNIT * uptr, int32 val, CONST char *cptr, void *desc) hst = NULL; } if (lnt) { - hst = calloc(sizeof(struct InstHistory), lnt); + hst = (struct InstHistory *)calloc(sizeof(struct InstHistory), lnt); if (hst == NULL) return SCPE_MEM; @@ -3314,9 +3309,6 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc) t_stat r; t_value sim_eval[6]; struct InstHistory *h; - extern t_stat fprint_sym(FILE * ofile, t_addr addr, - t_value * val, UNIT * uptr, int32 sw); - extern char mem_to_ascii[64]; if (hst_lnt == 0) return SCPE_NOFNC; /* enabled? */ diff --git a/I7000/i7080_drum.c b/I7000/i7080_drum.c index 98241de..dee8342 100644 --- a/I7000/i7080_drum.c +++ b/I7000/i7080_drum.c @@ -74,7 +74,7 @@ uint32 drm_cmd(UNIT * uptr, uint16 cmd, uint16 dev) int addr = dev; addr -= drm_dib.addr * DRMCHARTRK; - if (addr > uptr->capac) + if (addr > (int32)uptr->capac) return SCPE_NODEV; if ((uptr->flags & UNIT_ATT) != 0) { switch (cmd) { @@ -107,7 +107,7 @@ uint32 drm_cmd(UNIT * uptr, uint16 cmd, uint16 dev) t_stat drm_srv(UNIT * uptr) { int chan = UNIT_G_CHAN(uptr->flags); - uint8 *buf = uptr->filebuf; + uint8 *buf = (uint8 *)uptr->filebuf; t_stat r; /* Channel has disconnected, abort current read. */ @@ -121,7 +121,7 @@ t_stat drm_srv(UNIT * uptr) /* Check if we have a address match */ if ((chan_flags[chan] & (STA_ACTIVE | DEV_SEL)) == (STA_ACTIVE | DEV_SEL) && (uptr->u5 & (DRMSTA_READ | DRMSTA_WRITE))) { - if (uptr->u6 > uptr->capac) { + if (uptr->u6 > (int32)uptr->capac) { uptr->u5 = DRMSTA_CMD; chan_set(chan, CHS_ATTN); sim_activate(uptr, DRMWORDTIME); diff --git a/I7000/i7080_sys.c b/I7000/i7080_sys.c index 34c9f1d..47eecb6 100644 --- a/I7000/i7080_sys.c +++ b/I7000/i7080_sys.c @@ -239,18 +239,10 @@ load_rec(uint8 *image) { t_stat sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) { - char *p; char buffer[160]; int i, j; - p = strrchr(fnam, '.'); - - if (p == NULL) - return SCPE_ARG; - - p++; - - if (strcasecmp(p, "crd") == 0) { + if (match_ext(fnam, "crd")) { uint8 image[80]; while (sim_fread(buffer, 1, 160, fileref) == 160) { @@ -265,7 +257,7 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) return SCPE_OK; } return SCPE_OK; - } else if (strcasecmp(p, "cbn") == 0) { + } else if (match_ext(fnam, "cbn")) { uint8 image[80]; while (sim_fread(buffer, 1, 160, fileref) == 160) { @@ -280,7 +272,7 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) return SCPE_OK; } return SCPE_OK; - } else if (strcasecmp(p, "dck") == 0) { + } else if (match_ext(fnam, "dck")) { extern char ascii_to_six[128]; while (fgets(buffer, 80, fileref) != 0) { uint8 image[80]; @@ -305,12 +297,12 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) typedef struct _opcode { uint32 opbase; - char *name; + const char *name; uint8 type; } t_opcode; -char *chname[11] = { +const char *chname[11] = { "*", "20", "21", "22", "23", "40", "41", "44", "45", "46", "47" }; diff --git a/I7000/i7090_cpu.c b/I7000/i7090_cpu.c index 6d15000..c3fd183 100644 --- a/I7000/i7090_cpu.c +++ b/I7000/i7090_cpu.c @@ -274,9 +274,6 @@ int cycle_time = 12; /* Cycle time in 100ns */ int32 hst_p = 0; /* History pointer */ int32 hst_lnt = 0; /* History length */ struct InstHistory *hst = NULL; /* History stack */ -extern uint32 sim_brk_summ; -extern uint32 sim_brk_types; -extern uint32 sim_brk_dflt; extern uint32 drum_addr; #define DP_FLOAT 1 @@ -387,8 +384,6 @@ DEVICE cpu_dev = { NULL, NULL, &cpu_help, NULL, NULL, &cpu_description }; - -extern int32 sim_interval; #define T_B 0x0001 /* Do load with indirection */ #define T_D 0x0002 /* Do ea, but no indirection */ @@ -707,7 +702,9 @@ sim_instr(void) { t_stat reason; t_uint64 temp = 0LL; +#ifdef I7090 t_uint64 ibr; +#endif uint16 opcode; uint16 MA; uint8 tag; @@ -750,7 +747,9 @@ sim_instr(void) iowait = 0; while (reason == 0) { /* loop until halted */ +#ifdef I7090 /* I704 did not have interrupts */ hltloop: +#endif /* If doing fast I/O don't sit in idle loop */ if (iowait && (cpu_unit.flags & UNIT_FASTIO)) sim_interval = 0; @@ -1053,7 +1052,6 @@ prottrap: if (opcode == OP_TIA) { char name[7]; int i; - extern char mem_to_ascii[]; ReadMem(0, SR); for (i = 5; i >= 0; i--) { int ch; @@ -3019,7 +3017,7 @@ prottrap: ReadMem(0, SR); MA = (uint16)(AMASK & SR); AC >>= 6; - AC |= SR & (077 << 30); + AC |= SR & (077LL << 30); shiftcnt--; } /* Save XR if tag set */ @@ -4140,7 +4138,7 @@ cpu_reset(DEVICE * dptr) TM = STM = CTM = nmode = smode = 0; FTM = 1; itrap = 1; - bcore = iotraps = baseaddr = 0; + iotraps = baseaddr = bcore = 0; ioflags = 0; interval_irq = dcheck = acoflag = mqoflag = iocheck = 0; sim_brk_types = sim_brk_dflt = SWMASK('E'); @@ -4263,7 +4261,7 @@ cpu_set_hist(UNIT * uptr, int32 val, CONST char *cptr, void *desc) hst = NULL; } if (lnt) { - hst = calloc(sizeof(struct InstHistory), lnt); + hst = (struct InstHistory *)calloc(sizeof(struct InstHistory), lnt); if (hst == NULL) return SCPE_MEM; @@ -4282,8 +4280,6 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc) t_stat r; t_value sim_eval; struct InstHistory *h; - extern t_stat fprint_sym(FILE * ofile, t_addr addr, - t_value * val, UNIT * uptr, int32 sw); if (hst_lnt == 0) return SCPE_NOFNC; /* enabled? */ diff --git a/I7000/i7090_drum.c b/I7000/i7090_drum.c index 73efd75..e5b6383 100644 --- a/I7000/i7090_drum.c +++ b/I7000/i7090_drum.c @@ -120,7 +120,7 @@ uint32 drm_cmd(UNIT * uptr, uint16 cmd, uint16 dev) t_stat drm_srv(UNIT * uptr) { int chan = UNIT_G_CHAN(uptr->flags); - t_uint64 *buf = uptr->filebuf; + t_uint64 *buf = (t_uint64*)uptr->filebuf; t_stat r; uptr->u6++; /* Adjust rotation */ @@ -179,7 +179,7 @@ t_stat drm_boot(int32 unit_num, DEVICE * dptr) { UNIT *uptr = &dptr->units[unit_num]; - t_uint64 *buf = uptr->filebuf; + t_uint64 *buf = (t_uint64*)uptr->filebuf; int addr; if ((uptr->flags & UNIT_ATT) == 0) diff --git a/I7000/i7090_hdrum.c b/I7000/i7090_hdrum.c index 1d0a4e7..925f8be 100644 --- a/I7000/i7090_hdrum.c +++ b/I7000/i7090_hdrum.c @@ -111,7 +111,7 @@ uint32 hsdrm_cmd(UNIT * uptr, uint16 cmd, uint16 dev) t_stat hsdrm_srv(UNIT * uptr) { int chan = UNIT_G_CHAN(uptr->flags); - t_uint64 *buf = uptr->filebuf; + t_uint64 *buf = (t_uint64 *)uptr->filebuf; t_stat r; /* Channel has disconnected, abort current read. */ diff --git a/I7000/i7090_sys.c b/I7000/i7090_sys.c index 8e5832e..f2b4a13 100644 --- a/I7000/i7090_sys.c +++ b/I7000/i7090_sys.c @@ -312,8 +312,8 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) } } } else if (match_ext(cptr, "oct")) { - while (fgets(buffer, 80, fileref) != 0) { - for(p = buffer; *p == ' ' || *p == '\t'; p++); + while (fgets((char *)buffer, 80, fileref) != 0) { + for(p = (char *)buffer; *p == ' ' || *p == '\t'; p++); /* Grab address */ for(addr = 0; *p >= '0' && *p <= '7'; p++) addr = (addr << 3) + *p - '0'; @@ -327,16 +327,16 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) } } else if (match_ext(cptr, "sym")) { - while (fgets(buffer, 80, fileref) != 0) { - for(p = buffer; *p == ' ' || *p == '\t'; p++); + while (fgets((char *)buffer, 80, fileref) != 0) { + for(p = (char *)buffer; *p == ' ' || *p == '\t'; p++); /* Grab address */ for(addr = 0; *p >= '0' && *p <= '7'; p++) addr = (addr << 3) + *p - '0'; while(*p == ' ' || *p == '\t') p++; - if(strncasecmp(p, "BCD", 3) == 0) { + if(sim_strncasecmp(p, "BCD", 3) == 0) { p += 4; parse_sym(++p, addr, &cpu_unit, &M[addr], SWMASK('C')); - } else if (strncasecmp(p, "OCT", 3) == 0) { + } else if (sim_strncasecmp(p, "OCT", 3) == 0) { p += 4; for(; *p == ' ' || *p == '\t'; p++); parse_sym(p, addr, &cpu_unit, &M[addr], 0); @@ -354,7 +354,7 @@ sim_load(FILE * fileref, CONST char *cptr, CONST char *fnam, int flag) typedef struct _opcode { uint16 opbase; - char *name; + const char *name; uint8 type; } t_opcode; @@ -714,7 +714,7 @@ t_opcode neg_760[] = { {0, NULL, TYPE_X} }; -char *chname[11] = { +const char *chname[11] = { "*", "A", "B", "C", "D", "E", "F", "G", "H" }; diff --git a/sim_card.c b/sim_card.c index 3e20731..0dae7c5 100644 --- a/sim_card.c +++ b/sim_card.c @@ -334,7 +334,7 @@ const uint8 sim_parity_table[64] = { struct card_formats { uint32 mode; - char *name; + const char *name; }; static struct card_formats fmts[] = { @@ -462,7 +462,7 @@ sim_hol_to_ebcdic(uint16 hol) { -static int cmpcard(char *p, char *s) { +static int cmpcard(const char *p, const char *s) { int i; if (p[0] != '~') return 0; @@ -477,7 +477,7 @@ static int cmpcard(char *p, char *s) { t_stat sim_read_card(UNIT * uptr) { - int i, j; + int i; char c; uint16 temp; int mode; diff --git a/sim_card.h b/sim_card.h index 6fe6eef..8a76d36 100644 --- a/sim_card.h +++ b/sim_card.h @@ -117,9 +117,9 @@ t_stat sim_card_show_fmt (FILE *st, UNIT *uptr, int32 val, CONST void *desc); t_stat sim_card_attach_help(FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr); /* Translation tables */ -const char sim_six_to_ascii[64]; -const char sim_ascii_to_six[128]; -const uint8 sim_parity_table[64]; +extern const char sim_six_to_ascii[64]; +extern const char sim_ascii_to_six[128]; +extern const uint8 sim_parity_table[64]; #ifdef __cplusplus }