diff --git a/SEL32/sel32_chan.c b/SEL32/sel32_chan.c index 4cfb0fb..ce198b2 100644 --- a/SEL32/sel32_chan.c +++ b/SEL32/sel32_chan.c @@ -578,7 +578,6 @@ int chan_read_byte(uint16 chsa, uint8 *data) /* test end of write byte I/O (device read) */ int test_write_byte_end(uint16 chsa) { - int chan = get_chan(chsa); /* get the channel number */ CHANP *chp = find_chanp_ptr(chsa); /* get channel prog pointer */ /* see if at end of buffer */ @@ -698,7 +697,6 @@ void set_devwake(uint16 chsa, uint16 flags) /* post interrupt for specified channel */ void set_devattn(uint16 chsa, uint16 flags) { - int chan = get_chan(chsa); /* get the channel number */ CHANP *chp = find_chanp_ptr(chsa); /* get channel prog pointer */ sim_debug(DEBUG_EXP, &cpu_dev, "set_devattn chsa %04x, flags %04x\n", chsa, flags); @@ -713,7 +711,6 @@ void set_devattn(uint16 chsa, uint16 flags) /* channel operation completed */ void chan_end(uint16 chsa, uint16 flags) { - int chan = get_chan(chsa); /* get the channel number */ uint32 chan_icb = find_int_icb(chsa); /* get icb address */ CHANP *chp = find_chanp_ptr(chsa); /* get channel prog pointer */ @@ -726,7 +723,7 @@ void chan_end(uint16 chsa, uint16 flags) { } chp->chan_status |= STATUS_CEND; /* set channel end */ chp->chan_status |= ((uint16)flags); /* add in the callers flags */ -// chp->ccw_cmd = 0; /* reset the completed channel command */ +// chp->ccw_cmd = 0; /* reset the completed channel command */ sim_debug(DEBUG_EXP, &cpu_dev, "chan_end SLI test chsa %04x ccw_flags %04x count %04x status %04x\n", chsa, chp->ccw_flags, chp->ccw_count, chp->chan_status); @@ -1306,13 +1303,13 @@ t_stat rsctlxio(uint16 lchsa, uint32 *status) { /* reset controller XIO */ int chan = get_chan(lchsa); uint32 spadent; uint16 chsa; - CHANP *chp; +// CHANP *chp; /* get the device entry for the logical channel in SPAD */ spadent = SPAD[chan]; /* get spad device entry for logical channel */ chan = (spadent & 0x7f00) >> 8; /* get real channel */ chsa = (chan << 8) | (lchsa & 0xff); /* merge sa to real channel */ - chp = find_chanp_ptr(chsa); /* find the chanp pointer */ +// chp = find_chanp_ptr(chsa); /* find the chanp pointer */ *status = 0; /* not busy, no CC */ sim_debug(DEBUG_CMD, &cpu_dev, "rsctlxio chsa %04x chan %04x\n", chsa, chan); diff --git a/SEL32/sel32_clk.c b/SEL32/sel32_clk.c index 4a7ec7a..57f4cd9 100644 --- a/SEL32/sel32_clk.c +++ b/SEL32/sel32_clk.c @@ -127,7 +127,7 @@ t_stat rtc_srv (UNIT *uptr) /* level = interrupt level */ void rtc_setup(uint32 ss, uint32 level) { - uint32 val = SPAD[level+0x80]; /* get SPAD value for interrupt vector */ +// uint32 val = SPAD[level+0x80]; /* get SPAD value for interrupt vector */ uint32 addr = SPAD[0xf1] + (level<<2); /* vector address in SPAD */ rtc_lvl = level; /* save the interrupt level */ diff --git a/SEL32/sel32_com.c b/SEL32/sel32_com.c index 167f129..1d402da 100644 --- a/SEL32/sel32_com.c +++ b/SEL32/sel32_com.c @@ -364,14 +364,14 @@ DEVICE coml_dev = { /* 8-line serial routines */ void coml_ini(UNIT *uptr, t_bool f) { - int unit; - uint16 chsa; +// int unit; +// uint16 chsa; - unit = uptr - coml_unit; /* unit # */ - chsa = GET_UADDR(uptr->u3); /* get channel/sub-addr */ +// unit = uptr - coml_unit; /* unit # */ +// chsa = GET_UADDR(uptr->u3); /* get channel/sub-addr */ /* maybe do someting here on master channel init */ - uptr->u5 = SNS_RDY|SNS_ONLN; /* status is online & ready */ + uptr->u5 = SNS_RDY|SNS_ONLN; /* status is online & ready */ } /* 8-line serial routines */ @@ -380,7 +380,7 @@ void com_ini(UNIT *uptr, t_bool f) DEVICE *dptr = find_dev_from_unit(uptr); sim_debug(DEBUG_CMD, &com_dev, "COM init device %s controller 0x7e00\n", dptr->name); - sim_activate(uptr, 1000); /* time increment */ + sim_activate(uptr, 1000); /* time increment */ } /* called from sel32_chan to start an I/O operation */ @@ -645,7 +645,7 @@ t_stat comi_srv(UNIT *uptr) int32 newln, ln, c; uint16 chsa = GET_UADDR(uptr->u3); /* get channel/sub-addr */ int cmd = uptr->u3 & 0xff; - uint32 cln = (uptr - coml_unit) & 0x7; /* use line # 0-7 for 8-15 */ +// uint32 cln = (uptr - coml_unit) & 0x7; /* use line # 0-7 for 8-15 */ ln = uptr - com_unit; /* line # */ sim_debug(DEBUG_CMD, &com_dev, "comi_srv entry chsa %04x line %04x cmd %02x\n", chsa, ln, cmd); @@ -666,12 +666,13 @@ t_stat comi_srv(UNIT *uptr) newln = tmxr_poll_conn(&com_desc); /* look for connect */ if (newln >= 0) { /* rcv enb pending? */ uint16 chsa = GET_UADDR(coml_unit[newln].u3); /* get channel/sub-addr */ - int chan = ((chsa >> 8) & 0x7f); /* get the channel number */ - UNIT *comlp = coml_unit+ln; /* get uptr for coml line */ - int cmd = comlp->u3 & 0xff; /* get the active cmd */ +// int chan = ((chsa >> 8) & 0x7f); /* get the channel number */ +// UNIT *comlp = coml_unit+ln; /* get uptr for coml line */ +// int cmd = comlp->u3 & 0xff; /* get the active cmd */ //fprintf(stderr, "comi_srv poll chsa %04x new line %04x\r\n", chsa, newln); com_ldsc[newln].rcve = 1; /* enable rcv */ - com_ldsc[newln+8].xmte = 1; /* enable xmt for output line */ +//BAD com_ldsc[newln+8].xmte = 1; /* enable xmt for output line */ + com_ldsc[newln].xmte = 1; /* enable xmt for output line */ com_sta[newln] &= ~COML_REP; /* clr pending */ /* send attention to OS here for this channel */ /* need to get chsa here for the channel */ diff --git a/SEL32/sel32_con.c b/SEL32/sel32_con.c index a64e6ca..3dd7136 100644 --- a/SEL32/sel32_con.c +++ b/SEL32/sel32_con.c @@ -152,7 +152,7 @@ DEVICE con_dev = { /* initialize the console chan/unit */ void con_ini(UNIT *uptr, t_bool f) { int unit = (uptr - con_unit); /* unit 0 */ - DEVICE *dptr = find_dev_from_unit(uptr); +// DEVICE *dptr = find_dev_from_unit(uptr); con_data[unit].incnt = 0; /* no input data */ uptr->u5 = SNS_RDY|SNS_ONLN; /* status is online & ready */ @@ -399,7 +399,7 @@ t_stat con_srvi(UNIT *uptr) { } } else { if (ch == '?') { - int chan = ((chsa >> 8) & 0x7f); /* get the channel number */ +// int chan = ((chsa >> 8) & 0x7f); /* get the channel number */ /* set ring bit? */ set_devwake(chsa, SNS_ATTN|SNS_DEVEND|SNS_CHNEND); /* tell user */ } diff --git a/SEL32/sel32_cpu.c b/SEL32/sel32_cpu.c index 69c5439..20111d0 100644 --- a/SEL32/sel32_cpu.c +++ b/SEL32/sel32_cpu.c @@ -653,15 +653,15 @@ int base_mode[] = { #define MAX32 32 /* 32/77 map limit */ #define MAX256 256 /* 32/27 and 32/87 map limit */ #define MAX2048 2048 /* 32/67, V6, and V9 map limit */ -#define RMB(x) ((M[x>>2]>>(8*(7-(x&3))))&0xff) /* read memory addressed byte */ -#define RMH(x) (x&2?(M[x>>2]&RMASK):(M[x>>2]>>16)&RMASK) /* read memory addressed halfword */ -#define RMW(x) (M[x>>2]) /* read memory addressed word */ -#define WMW(x,y) (M[x>>2]=y) /* write memory addressed word */ +#define RMB(x) ((M[(x)>>2]>>(8*(7-(x&3))))&0xff) /* read memory addressed byte */ +#define RMH(x) ((x)&2?(M[(x)>>2]&RMASK):(M[(x)>>2]>>16)&RMASK) /* read memory addressed halfword */ +#define RMW(x) (M[(x)>>2]) /* read memory addressed word */ +#define WMW(x,y) (M[(x)>>2]=y) /* write memory addressed word */ /* write halfword to memory address */ -#define WMH(x,y) (x&2?(M[x>>2]=(M[x>>]&LMASK)|(y&RMASK)):(M[>>2]=(M[x>>2]&RMASK)|(y<<16))) +#define WMH(x,y) ((x)&2?(M[(x)>>2]=(M[(x)>>]&LMASK)|((y)&RMASK)):(M[(x)>>2]=(M[(x)>>2]&RMASK)|((y)<<16))) /* write halfword map register to MAP cache address */ -#define WMR(x,y) (x&2?(MAPC[x>>2]=(MAPC[x>>2]&LMASK)|(y&RMASK)):(MAPC[x>>2]=(MAPC[x>>2]&RMASK)|(y<<16))) -#define RMR(x) (x&2?(MAPC[x>>2]&RMASK):(MAPC[x>>2]>>16)&RMASK) /* read map register halfword */ +#define WMR(x,y) ((x)&2?(MAPC[(x)>>2]=(MAPC[(x)>>2]&LMASK)|((y)&RMASK)):(MAPC[(x)>>2]=(MAPC[(x)>>2]&RMASK)|((y)<<16))) +#define RMR(x) ((x)&2?(MAPC[(x)>>2]&RMASK):(MAPC[(x)>>2]>>16)&RMASK) /* read map register halfword */ /* set up the map registers for the current task in the cpu */ /* the PSD bpix and cpix are used to setup the maps */ @@ -977,7 +977,7 @@ skipcpix: */ t_stat RealAddr(uint32 addr, uint32 *realaddr, uint32 *prot) { - uint32 word, index, map, mask, raddr, mpl, offset; + uint32 word, index, map, raddr, mpl, offset; *prot = 0; /* show unprotected memory as default */ /* unmapped mode is unprotected */ @@ -1132,7 +1132,8 @@ t_stat RealAddr(uint32 addr, uint32 *realaddr, uint32 *prot) } if ((TLB[index] & 0x04000000) == 0) { /* is HIT bit on */ - uint32 nix, msdl, midl; + uint32 nix, msdl; +//NU uint32 midl; sim_debug(DEBUG_EXP, &cpu_dev, "MEMORY %08x MPL %08x MPL[0] %08x MPL[1] %08x MPL[%04x] %08x %08x\n", @@ -1140,7 +1141,7 @@ t_stat RealAddr(uint32 addr, uint32 *realaddr, uint32 *prot) msdl = RMW(mpl+CPIXBA+4); /* get mpl entry wd 1 for given cpix */ if ((msdl & MASK24) >= (MEMSIZE*4)) /* see if address is within our memory */ return NPMEM; /* no, non present memory error */ - midl = RMW(mpl+CPIXBA); /* get midl entry for given cpix */ +//NU midl = RMW(mpl+CPIXBA); /* get midl entry for given cpix */ #ifdef DO_DYNAMIC_DEBUG /* start debugging */ cpu_dev.dctrl |= (DEBUG_INST | DEBUG_CMD | DEBUG_EXP | DEBUG_IRQ); @@ -1396,8 +1397,8 @@ t_stat sim_instr(void) { uint32 sreg; /* Source reg in from bits 9-11 reg-reg instructions */ uint32 ix; /* index register */ uint32 dbl; /* Double word */ - uint32 ovr; /* Overflow flag */ - uint32 stopnext = 0; /* Stop on next instruction */ + uint32 ovr=0; /* Overflow flag */ +//FORSTEP uint32 stopnext = 0; /* Stop on next instruction */ uint32 skipinstr = 0; /* Skip test for interrupt on this instruction */ uint32 drop_nop = 0; /* Set if right hw instruction is a nop */ uint32 int_icb; /* interrupt context block address */ @@ -1408,7 +1409,9 @@ t_stat sim_instr(void) { int32 int32a; /* temp int */ int32 int32b; /* temp int */ int32 int32c; /* temp int */ +#ifdef DO_DYNAMIC_DEBUG int32 event = 0; +#endif wait_loop: while (reason == 0) { /* loop until halted */ @@ -1417,7 +1420,7 @@ wait_loop: reason = sim_process_event(); /* process */ if (reason != SCPE_OK) { if (reason == SCPE_STEP) { -//*FORSTEP*/ stopnext = 1; +//FORSTEP stopnext = 1; break; } else break; /* process */ @@ -2673,25 +2676,25 @@ tbr: /* handle basemode TBR too * } temp = (PSD1+2) & 0x01fffffe; /* save AEXP bit and PC from PSD1 in to frame */ - if (TRAPME = Mem_write(cfp, &temp)) { /* Save the PSD into memory */ + if ((TRAPME = Mem_write(cfp, &temp))) { /* Save the PSD into memory */ goto newpsd; /* memory write error or map fault */ } temp = 0x00000000; /* show frame created by CALL instr */ - if (TRAPME = Mem_write(cfp+4, &temp)) { /* Save zero into memory */ + if ((TRAPME = Mem_write(cfp+4, &temp))) { /* Save zero into memory */ goto newpsd; /* memory write error or map fault */ } /* Save BR 0-7 to stack */ for (ix=0; ix<8; ix++) { - if (TRAPME = Mem_write(cfp+(4*ix)+8, &BR[ix])) { /* Save into memory */ + if ((TRAPME = Mem_write(cfp+(4*ix)+8, &BR[ix]))) { /* Save into memory */ goto newpsd; /* memory write error or map fault */ } } /* save GPR 2-8 to stack */ for (ix=2; ix<8; ix++) { - if (TRAPME = Mem_write(cfp+(4*ix)+32, &GPR[ix])) { /* Save into memory */ + if ((TRAPME = Mem_write(cfp+(4*ix)+32, &GPR[ix]))) { /* Save into memory */ goto newpsd; /* memory write error or map fault */ } } @@ -3518,7 +3521,7 @@ doovr4: if (int64a > 0x7fffffff) /* if more than 31 bits, we have an error */ goto doovr3; if (((dest & D32LMASK) != 0 && (dest & D32LMASK) != D32LMASK) || - ((dest & D32LMASK) == D32LMASK) && ((dest & D32RMASK) == 0)) { /* test for overflow */ + (((dest & D32LMASK) == D32LMASK) && ((dest & D32RMASK) == 0))) { /* test for overflow */ doovr3: dest = (((t_uint64)GPR[reg]) << 32);/* insert upper reg value */ dest |= (t_uint64)GPR[reg+1]; /* get low order reg value */ @@ -3604,12 +3607,12 @@ doovr3: } temp = (PSD1+4) & 0x01fffffe; /* save AEXP bit and PC from PSD1 into frame */ - if (TRAPME = Mem_write(cfp, &temp)) { /* Save the PSD into memory */ + if ((TRAPME = Mem_write(cfp, &temp))) { /* Save the PSD into memory */ goto newpsd; /* memory write error or map fault */ } temp = 0x80000000; /* show frame created by BSUBM instr */ - if (TRAPME = Mem_write(cfp+4, &temp)) { /* Save zero into memory */ + if ((TRAPME = Mem_write(cfp+4, &temp))) { /* Save zero into memory */ goto newpsd; /* memory write error or map fault */ } @@ -3620,7 +3623,7 @@ doovr3: goto newpsd; /* go execute the trap now */ } - if (TRAPME = Mem_read(temp, &addr)) /* get the word from memory */ + if ((TRAPME = Mem_read(temp, &addr))) /* get the word from memory */ goto newpsd; /* memory read error or map fault */ BR[1] = addr; /* effective address contents to BR 1 */ @@ -3642,25 +3645,25 @@ doovr3: } temp = (PSD1+4) & 0x01fffffe; /* save AEXP bit and PC from PSD1 in to frame */ - if (TRAPME = Mem_write(cfp, &temp)) { /* Save the PSD into memory */ + if ((TRAPME = Mem_write(cfp, &temp))) { /* Save the PSD into memory */ goto newpsd; /* memory write error or map fault */ } temp = 0x00000000; /* show frame created by CALL instr */ - if (TRAPME = Mem_write(cfp+4, &temp)) { /* Save zero into memory */ + if ((TRAPME = Mem_write(cfp+4, &temp))) { /* Save zero into memory */ goto newpsd; /* memory write error or map fault */ } /* save the BRs 0-7 on stack */ for (ix=0; ix<8; ix++) { - if (TRAPME = Mem_write(cfp+(4*ix)+8, &BR[ix])) { /* Save into memory */ + if ((TRAPME = Mem_write(cfp+(4*ix)+8, &BR[ix]))) { /* Save into memory */ goto newpsd; /* memory write error or map fault */ } } /* save GPRs 2-7 on stack */ for (ix=2; ix<8; ix++) { - if (TRAPME = Mem_write(cfp+(4*ix)+32, &GPR[ix])) { /* Save into memory */ + if ((TRAPME = Mem_write(cfp+(4*ix)+32, &GPR[ix]))) { /* Save into memory */ goto newpsd; /* memory write error or map fault */ } } @@ -3672,7 +3675,7 @@ doovr3: goto newpsd; /* go execute the trap now */ } - if (TRAPME = Mem_read(temp, &addr)) /* get the word from memory */ + if ((TRAPME = Mem_read(temp, &addr))) /* get the word from memory */ goto newpsd; /* memory read error or map fault */ BR[1] = addr; /* effective address contents to BR 1 */ @@ -4335,7 +4338,7 @@ meoa: /* merge point for eor, and, or */ if (int64a > 0x7fffffff) /* if more than 31 bits, we have an error */ goto doovr; if (((dest & D32LMASK) != 0 && (dest & D32LMASK) != D32LMASK) || - ((dest & D32LMASK) == D32LMASK) && ((dest & D32RMASK) == 0)) { /* test for overflow */ + (((dest & D32LMASK) == D32LMASK) && ((dest & D32RMASK) == 0))) { /* test for overflow */ doovr: dest = (((t_uint64)GPR[reg]) << 32);/* insert upper reg value */ dest |= (t_uint64)GPR[reg+1]; /* get low order reg value */ @@ -5182,11 +5185,12 @@ doovr2: uint32 status = 0; /* status returned from device */ uint32 device = (opr >> 3) & 0x7f; /* get device code */ uint32 prior = device; /* interrupt priority */ + uint32 maxlev = 0x5f; /* max lev for all but 32/27 in diags */ + t = SPAD[prior+0x80]; /* get spad entry for interrupt */ addr = SPAD[0xf1] + (prior<<2); /* vector address in SPAD */ addr = M[addr>>2]; /* get the interrupt context block addr */ prior = (opr >> 3) & 0x7f; /* get priority level */ - uint32 maxlev = 0x5f; /* max lev for all but 32/27 in diags */ if (CPU_MODEL <= MODEL_27) { maxlev = 0x6f; /* 27 uses 112 */ } @@ -5349,7 +5353,6 @@ syscheck: t = SPAD[lchan]; /* get spad entry for channel */ if ((t == 0 || t == 0xffffffff) || /* if not set up, system check */ ((t & 0x0f000000) != 0x0f000000)) { /* class in bits 4-7 */ -syscheckf: //fprintf(stderr, "SYSCHK XIO lchan %.4x spad %.8x\r\n", lchan, t); TRAPME = SYSTEMCHK_TRAP; /* trap condition if F class */ TRAPSTATUS |= BIT0; /* class F error bit */ @@ -5754,7 +5757,9 @@ newpsd: /* we get here from a LPSD, LPSDCM, INTR, or TRAP */ if (TRAPME) { +#ifdef DO_DYNAMIC_DEBUG static int pvcnt = 0; +#endif /* SPAD location 0xf0 has trap vector base address */ uint32 tta = SPAD[0xf0]; /* get trap table address in memory */ uint32 tvl; /* trap vector location */ @@ -5842,14 +5847,14 @@ newpsd: sim_debug(DEBUG_EXP, &cpu_dev, "At TRAP %04x IR %08x PSD1 %08x PSD2 %08x CPUSTATUS %08x ovr %02x drop_nop %02x\n", TRAPME, IR, PSD1, PSD2, CPUSTATUS, ovr, drop_nop); - sim_debug(DEBUG_EXP, &cpu_dev, - "tvl %08x, tta %08x status %08x\n", tvl, tta, CPUSTATUS); tta = tta + (TRAPME - 0x80); /* tta has mem addr of trap vector */ if (modes & BASEBIT) tvl = M[tta>>2] & 0xFFFFFC; /* get 24 bit trap vector address from trap vector loc */ else tvl = M[tta>>2] & 0x7FFFC; /* get 19 bit trap vector address from trap vector loc */ + sim_debug(DEBUG_EXP, &cpu_dev, + "tvl %08x, tta %08x status %08x\n", tvl, tta, CPUSTATUS); if (tvl == 0 || (CPUSTATUS & 0x40) == 0) { /* vector is zero or software has not enabled traps yet */ /* execute a trap halt */ diff --git a/SEL32/sel32_disk.c b/SEL32/sel32_disk.c index c8c7c29..af9e255 100644 --- a/SEL32/sel32_disk.c +++ b/SEL32/sel32_disk.c @@ -681,7 +681,7 @@ t_stat disk_srv(UNIT * uptr) data->cyl--; /* seek 1 cyl */ sim_activate(uptr, 200); } - if (data->cyl < 0) /* test for less than zero */ + if ((int32)data->cyl < 0) /* test for less than zero */ data->cyl = 0; /* make zero */ } sim_debug(DEBUG_DETAIL, dptr, "dsk_srv seek next unit=%02x %02x %04x\n", @@ -970,7 +970,7 @@ t_stat disk_attach(UNIT *uptr, CONST char *file) int type = GET_TYPE(uptr->flags); DEVICE *dptr = find_dev_from_unit(uptr); t_stat r; - uint16 tsize; /* track size in bytes */ +// uint16 tsize; /* track size in bytes */ uint16 ssize; /* sector size in bytes */ struct ddata_t *data; // uint8 buff[1024]; @@ -993,7 +993,7 @@ t_stat disk_attach(UNIT *uptr, CONST char *file) uptr->DDATA = (void *)data; /* save pointer to structure in DDATA */ /* track size in bytes is sectors/track times words/sector time 4 bytse/word */ - tsize = disk_type[type].spt * disk_type[type].ssiz * 4; /* get track size in bytes */ +// tsize = disk_type[type].spt * disk_type[type].ssiz * 4; /* get track size in bytes */ uptr->capac = disk_type[type].taus * disk_type[type].spau; /* disk capacity in sectors */ ssize = disk_type[type].ssiz * 4; /* disk sector size in bytes */ diff --git a/SEL32/sel32_fltpt.c b/SEL32/sel32_fltpt.c index 620bc85..9aebc2b 100644 --- a/SEL32/sel32_fltpt.c +++ b/SEL32/sel32_fltpt.c @@ -909,7 +909,7 @@ setcc: /* multiply register double by memory double */ t_uint64 s_mpfd(t_uint64 reg, t_uint64 mem, uint32 *cc) { t_uint64 tr1, tr2, tl1, tl2, dblreg; - uint32 CC = 0, temp, temp2, sign = 0; + uint32 CC = 0, temp = 0, temp2, sign = 0; uint32 expm, expr; t_uint64 dtemp1, dtemp2; @@ -1039,7 +1039,7 @@ setcc: /* divide register double by memory double */ t_uint64 s_dvfd(t_uint64 reg, t_uint64 mem, uint32 *cc) { - t_uint64 tr1, tr2, tl1, tl2, dblreg; + t_uint64 tr1, /*tr2,*/ tl1, /*tl2,*/ dblreg; uint32 CC = 0, temp, temp2, sign = 0; uint32 expm, expr; t_uint64 dtemp1, dtemp2; @@ -1094,8 +1094,8 @@ t_uint64 s_dvfd(t_uint64 reg, t_uint64 mem, uint32 *cc) { tl1 = (mem >> 32) & D32RMASK; /* get left half of operator */ tr1 = mem & D32RMASK; /* get right half of operator */ - tl2 = (reg >> 32) & D32RMASK; /* get left half of operand */ - tr2 = reg & D32RMASK; /* get right half of operand */ +// tl2 = (reg >> 32) & D32RMASK; /* get left half of operand */ +// tr2 = reg & D32RMASK; /* get right half of operand */ dtemp2 = reg / tl1; /* operand / left half of operator */ dtemp2 = (dtemp2 & D32RMASK) << 32; /* move quotient to upper 32 bits */ diff --git a/SEL32/sel32_hsdp.c b/SEL32/sel32_hsdp.c index 156fc69..60436ee 100644 --- a/SEL32/sel32_hsdp.c +++ b/SEL32/sel32_hsdp.c @@ -702,7 +702,7 @@ t_stat hsdp_srv(UNIT * uptr) data->cyl--; /* seek 1 cyl */ sim_activate(uptr, 200); } - if (data->cyl < 0) /* test for less than zero */ + if ((int32)data->cyl < 0) /* test for less than zero */ data->cyl = 0; /* make zero */ } sim_debug(DEBUG_DETAIL, dptr, "dsk_srv seek next unit=%02x %02x %04x\n", @@ -991,7 +991,7 @@ t_stat hsdp_attach(UNIT *uptr, CONST char *file) int type = GET_TYPE(uptr->flags); DEVICE *dptr = find_dev_from_unit(uptr); t_stat r; - uint16 tsize; /* track size in bytes */ +// uint16 tsize; /* track size in bytes */ uint16 ssize; /* sector size in bytes */ struct ddata_t *data; // uint8 buff[1024]; @@ -1014,7 +1014,7 @@ t_stat hsdp_attach(UNIT *uptr, CONST char *file) uptr->DDATA = (void *)data; /* save pointer to structure in DDATA */ /* track size in bytes is sectors/track times words/sector time 4 bytse/word */ - tsize = hsdp_type[type].spt * hsdp_type[type].ssiz * 4; /* get track size in bytes */ +// tsize = hsdp_type[type].spt * hsdp_type[type].ssiz * 4; /* get track size in bytes */ uptr->capac = hsdp_type[type].taus * hsdp_type[type].spau; /* disk capacity in sectors */ ssize = hsdp_type[type].ssiz * 4; /* disk sector size in bytes */ diff --git a/SEL32/sel32_scfi.c b/SEL32/sel32_scfi.c index b9e6100..f6ccb2f 100644 --- a/SEL32/sel32_scfi.c +++ b/SEL32/sel32_scfi.c @@ -570,9 +570,9 @@ t_stat scfi_srv(UNIT *uptr) int dlen = 0; /* total bytes processed */ int i; uint8 ch; - int tsize = scfi_type[type].spt * scfi_type[type].ssiz*4; /* get track size in bytes */ +// int tsize = scfi_type[type].spt * scfi_type[type].ssiz*4; /* get track size in bytes */ uint16 ssize = scfi_type[type].ssiz*4; /* Size of one sector in bytes */ - int32 tstart; /* Location of start of cyl/track/sect in data */ + int32 tstart = 0; /* Location of start of cyl/track/sect in data */ uint8 buf2[768]; uint8 buf[768]; @@ -915,7 +915,7 @@ t_stat scfi_reset(DEVICE * dptr) /* create the disk file for the specified device */ int scfi_format(UNIT *uptr) { - struct ddata_t *data = (struct ddata_t *)uptr->up7; +// struct ddata_t *data = (struct ddata_t *)uptr->up7; uint16 addr = GET_UADDR(uptr->u3); int type = GET_TYPE(uptr->flags); DEVICE *dptr = find_dev_from_unit(uptr); @@ -977,7 +977,7 @@ t_stat scfi_attach(UNIT *uptr, CONST char *file) { int type = GET_TYPE(uptr->flags); DEVICE *dptr = find_dev_from_unit(uptr); t_stat r; - uint16 tsize; /* track size in bytes */ +// uint16 tsize; /* track size in bytes */ uint16 ssize; /* sector size in bytes */ struct ddata_t *data; uint8 buff[1024]; @@ -1000,7 +1000,7 @@ t_stat scfi_attach(UNIT *uptr, CONST char *file) { uptr->up7 = (void *)data; /* save pointer to structure in up7 */ /* track size in bytes is sectors/track times words/sector time 4 bytse/word */ - tsize = scfi_type[type].spt * scfi_type[type].ssiz * 4; /* get track size in bytes */ +// tsize = scfi_type[type].spt * scfi_type[type].ssiz * 4; /* get track size in bytes */ uptr->capac = scfi_type[type].taus * scfi_type[type].spau; /* disk capacity in sectors */ ssize = scfi_type[type].ssiz * 4; /* disk sector size in bytes */ uptr->capac *= ssize; /* disk capacity in bytes */ diff --git a/SEL32/sel32_sys.c b/SEL32/sel32_sys.c index 3a2f1a7..42b9345 100644 --- a/SEL32/sel32_sys.c +++ b/SEL32/sel32_sys.c @@ -837,7 +837,6 @@ int fprint_inst(FILE *of, uint32 val, int32 sw) ((inst&0xfc00) != 0x5800) && ((inst&0xfc00) != 0x5c00) && ((inst&0xfc00) != 0xcc00) && - ((inst&0xfc00) != 0xcc08) && ((inst&0xfc00) != 0x8000)) fputc(fc_type[i], of); /* Fall through */ @@ -999,7 +998,8 @@ t_stat fprint_sym (FILE *of, t_addr addr, t_value *val, UNIT *uptr, int32 sw) int i; int l = 4; /* default to full words */ int rdx = 16; /* default radex is hex */ - uint32 num, tmp=*val; + uint32 num; +// uint32 tmp=*val; /* for debug */ if (addr & 0x02) l = 2; diff --git a/SEL32/taptools/README.md b/SEL32/taptools/README.md index c3d1171..67a9676 100644 --- a/SEL32/taptools/README.md +++ b/SEL32/taptools/README.md @@ -80,6 +80,26 @@ sdtfmgrcopy - This program reads a MPX 1.x filemgr save tape or a to the file bootfil1 output - directory/files extracted to current directory +diagcopy - This program reads a SEL diagnostic boot tape and splits + the contents into multiple files. The first tape record + is 204 bytes of boot code and is put into the file bootcode. + The following records in the file contains the diagnostic + overlay program (DOL) and are in 7680 byte block. The last + record can be <= 7680 bytes. The data is put into the file + dolfile. The 2nd file on the tape contains the diagnostic + auto execute file. It is a MPX blocked file where the first + word of each 768 char block contains 0x0003f3b8. It can be + read using the deblk utility in the taptools directory. + The following diagnostic files on the tape are written to + files named diagfileNN where NN is relative file number on + the tape. These records are all multiple of 768 bytes each + and contain binary programs. + input - diag.tap file to dump + output - stdout filelist and sizes + output - if tape contains a valid diag image, it will be + output to files bootfile, cmdfile, dolfile and + to diagfileNN, where NN is 3 or larger. + tapdump - This program reads a metadata .tap file and prints a side by side hexdump of the file contents. The records are displayed as 256 byte chuncks. After each record if 256 diff --git a/SEL32/taptools/deblk.c b/SEL32/taptools/deblk.c index a9f9ad8..5964949 100644 --- a/SEL32/taptools/deblk.c +++ b/SEL32/taptools/deblk.c @@ -477,6 +477,25 @@ int n; } } else + /* test for a diag blocked ascii file */ + /* test 1st 2 byte of file for zero */ + if ((si[0] == 0) && (si[1] == 3) && (i == 0xf3b8)) { + filetype |= blocked; /* we have blocked file */ + bin = 6; /* where we start for data block */ + + /* see if we have compressed data */ + if ((si[bin + 2] == 0xbf) || (si[bin + 2] == 0x9f)) + { + filetype |= compress; /* data is compressed */ + bcnt = 0; /* no data in buffer */ + } + else + { + /* data is not compressed, just ascii without newlines */ + filetype |= ascii; /* blocked ascii data */ + } + } + else { /* data is unblocked, see if compressed or not */ if ((si[ubin] == 0xbf) || (si[ubin] == 0x9f)) diff --git a/SEL32/taptools/diagcopy.c b/SEL32/taptools/diagcopy.c new file mode 100644 index 0000000..0415d3f --- /dev/null +++ b/SEL32/taptools/diagcopy.c @@ -0,0 +1,279 @@ +/* + * diagcopy.c + * + * This program scans a diag metatape file and prints file count and + * sizes. In addition, it creates a boot directory for the boot code, + * a cmd directory for the cmd file, and a diag directory with a file + * for each defined diagnostic. The file must be a bootable diagnostic + * tape in .tap format. The output files are non .tap format, i.e. just + * binary output of each file. + * input - stdin or specified filename + * output - stdout + */ + +#include +#include +#include +#include +#include +#include +#include + +int lfilen, filen = 1; +int diag = 0; +int EOFcnt = 0; +int count=0, lcount=0; +int size=0, tsize=0; +int size_512K = 512 * 1024; +int ln; +int inp, outp; +int smd = 0; +#define PRINTABLE(x) ((x < 32) || (x > 126)) ? '.' : x + +/* get a line of input. */ +int getloi(char *s, int lim) +{ + int c, i; + int32_t n1, n2, hc, tc, n; + + errno = 0; + /* read the byte count in 32 bit word as header */ + n1 = read(inp, (char *)(&hc), (size_t)sizeof(hc)); + if (n1 <= 0) + hc = -1; /* at EOM on disk file */ + + /* check for EOF & EOM on tape data */ + if (hc & 0xffff0000) /* check for garbage, assume EOM */ + hc = -1; /* at EOM on disk file */ + + /* check for EOF & EOM on tape data */ + if (hc == 0) { + /* we are at tape EOF */ + if (++EOFcnt < 2) { /* if 1st EOF, print file info */ +// printf("EOF found after file %d\n", filen); + lfilen = filen; + filen++; /* set next file number */ + smd = 1; /* look for smd again */ + } + count = 0; /* file record count back to zero */ + lcount = 0; /* last record count back to zero */ + tsize += size; /* add to total tape size */ + size = 0; /* file size back to zero */ + ln = -1; /* set ln to -1 showing we are at EOF */ + + /* we have EOF */ + return 0; /* return EOF on tape data */ + } + if (hc == -1) { + printf("EOM found after file %d\n", filen); + return -1; /* at EOM on disk file */ + } + + /* read the data */ + n = read(inp, s, (size_t)hc); + /* read the byte count in 32 bit word as trailer */ + n2 = read(inp, (char *)(&tc), (size_t)sizeof(tc)); + count++; /* bump record count */ + size += n; /* update bytes read */ + EOFcnt = 0; /* not an EOF */ + if (n != ln) { + ln = n; + lcount = count; + } + /* return bytes in buffer */ + return n; +} + +int main (int argc, char *argv[]) +{ + char *buf; + size_t size_512K = 512 * 1024; + size_t buf_size = 512 * 1024; + char *cp, *np; + int ll; + char path[64], command[128]; + int boot = 0; + int dol = 0; + int sdt = 0; + + if (argc != 2) { + printf("usage: %s infile\n", argv[0]); + exit(1); + } /* end of if */ + + if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { + printf("%s: fopen: unable to open input file %s\n", argv[0], argv[1]); + return (1); + } + outp = -1; + + /* get a 512k buffer */ + if ((buf = malloc(buf_size)) == NULL) { + //fprintf(stderr, "Can't allocate memory for tscan\n"); + printf("Can't allocate memory for tscan\n"); + return (4); + } + /* init counts */ + ln = -2; /* look for 2 eof */ + count = 0; + size = 0; + tsize = 0; + lcount = 0; + filen = 1; + lfilen = 0; + printf("\nfile %d:\n", filen); + + /* get lines until eof */ + while ((ll=getloi(buf, buf_size)) != EOF) { + printf("got ll = %d filen %d\n", ll, filen); + if (ll == 204) { + diag = 1; /* process diag boot record */ + printf("process diag ll = %d\n", ll); + } + if ((dol == 1) || ((ll == 7680) && (diag))) { + dol = 1; /* process DOL record */ + printf("process dol ll = %d\n", ll); + } + + if (ll == 0) { + /* eof found, process new file */ + printf("\nfile complete %d:\n", filen); + break; + //continue; /* go look for another SDT bootfile or SMD entry */ + } else + if (ll == 1920) { + printf("File is a MPX SDT tape and can not be processed!\n"); + break; + } else + if (ll == 4608) { + printf("File is a MPX filemgr save tape and can not be processed!\n"); + break; + } else + if ((diag == 0) && (ll != 204)) { + printf("File type is unknown and can not be processed!\n"); + break; + } else { + int cc = 0; + unsigned int curchar; + char filename[16]; + int i, j, m; + + /* A diag tape has a 204 byte boot loader in the first record. */ + /* It is followed by multiple 7680 byte records of the diagnostic */ + /* overlay loader (DOL) */ + + if (diag == 1) { + int no, ct = 0;; + /* get more diag data */ + /* open output file, create it if necessary */ + if (outp == -1) { + sprintf(filename, "bootfile\0"); + if ((outp = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { + printf("Can't open bootfile\n"); + close(inp); + free(buf); + return (3); + } + } + printf("got2 ll = %d writing to bootfile -> %s\n", ll, filename); + no = write(outp, buf, ll); + if (no != ll) + printf("write (%d) != read (%d) on file bootfile\n", no, ll); + close(outp); + outp = -1; + + /* now put the rest of the code in another file */ + sprintf(filename, "dolfile"); + if ((outp = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { + printf("Can't open dolfile\n"); + close(inp); + free(buf); + return (3); + } + /* get lines until eof */ + while ((ll=getloi(buf, buf_size)) > 0) { + ct++; + no = write(outp, buf, ll); + if (no != ll) + printf("write (%d) != read (%d) on file dolfile\n", no, ll); + } + diag = 2; + close(outp); + outp = -1; + printf("wrote %d records to dolfile %s\n", ct, filename); + continue; /* go look for diag command file */ + } else + if (diag == 2) { + /* read the command file in and write to cmdfile */ + int no, ct = 0;; + /* get more data */ + /* open output file, create it if necessary */ + if (outp == -1) { + sprintf(filename, "cmdfile\0"); + if ((outp = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { + printf("Can't open cmdfile\n"); + close(inp); + free(buf); + return (3); + } + } + printf("got2 ll = %d writing to cmdfile -> %s\n", ll, filename); + no = write(outp, buf, ll); + if (no != ll) + printf("write (%d) != read (%d) on file cmdfile\n", no, ll); + + /* now put the rest of the code in the file */ + /* get lines until eof */ + while ((ll=getloi(buf, buf_size)) > 0) { + ct++; + no = write(outp, buf, ll); + if (no != ll) + printf("write (%d) != read (%d) on file cmdfile\n", no, ll); + } + diag = 3; + close(outp); + outp = -1; + printf("wrote %d records to cmdfile %s\n", ct, filename); + continue; /* go look for diag command file */ + } else + if (diag == 3) { + /* read the diag file in and write to diagfile */ + int no, ct = 0;; + /* get more data */ + /* open output file, create it if necessary */ + if (outp == -1) { + sprintf(filename, "diagfile%02d\0", filen); + if ((outp = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { + printf("Can't open %s\n", filename); + close(inp); + free(buf); + return (3); + } + } + printf("got2 ll = %d writing to %s\n", ll, filename); + no = write(outp, buf, ll); + if (no != ll) + printf("write (%d) != read (%d) on file %s\n", no, ll, filename); + + /* now put the rest of the code in the file */ + /* get lines until eof */ + while ((ll=getloi(buf, buf_size)) > 0) { + ct++; + no = write(outp, buf, ll); + if (no != ll) + printf("write (%d) != read (%d) on file %s\n", no, ll, filename); + } + close(outp); + outp = -1; + printf("wrote %d records to cmdfile %s\n", ct, filename); + continue; /* go look for diag command file */ + } /* read cmd file records */ + } /* process read of tape */ + } /* end of getloi read */ +dostop: + close(inp); + free(buf); + if (outp >= 0) + close(outp); + exit(0); +} diff --git a/SEL32/taptools/fmgrcopy.c b/SEL32/taptools/fmgrcopy.c index 6db7aa4..2c53ed4 100644 --- a/SEL32/taptools/fmgrcopy.c +++ b/SEL32/taptools/fmgrcopy.c @@ -2,9 +2,9 @@ * fmgrcopy.c * * This program scans a metatape file and prints file count and sizes. - * In addition, it creats a director for each username specified in + * In addition, it creats a directory for each username specified in * the filemanager tape and then creates a file containing the file - * contents. The file must be an filemgr save tape and not an SDT + * contents. The file must be a filemgr save tape and not an SDT * tape. * input - stdin or specified filename * output - stdout diff --git a/SEL32/taptools/makefile b/SEL32/taptools/makefile index e40be52..1dc5cef 100644 --- a/SEL32/taptools/makefile +++ b/SEL32/taptools/makefile @@ -33,6 +33,7 @@ PROGS = \ $(ROOT)/tapscan \ $(ROOT)/eomtap \ $(ROOT)/volmcopy \ + $(ROOT)/diagcopy \ $(ROOT)/ddump \ $(ROOT)/deblk \ $(ROOT)/mpxblk \ @@ -116,6 +117,12 @@ $B/volmcopy: $D volmcopy.c @cp $(@F) $B @echo $(@F) installed in $B +$B/diagcopy: $D diagcopy.c + @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ + @chmod 755 $@ + @cp $(@F) $B + @echo $(@F) installed in $B + $B/ddump: $D ddump.c @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ @chmod 755 $@ diff --git a/SEL32/taptools/sdtfmgrcopy.c b/SEL32/taptools/sdtfmgrcopy.c index 9267a65..76e308b 100644 --- a/SEL32/taptools/sdtfmgrcopy.c +++ b/SEL32/taptools/sdtfmgrcopy.c @@ -1,7 +1,7 @@ /* * sdtfmgrcopy.c * - * This program scans a metatape file and prints file count * and sizes. + * This program scans a metatape file and prints file count and sizes. * input - stdin or specified filename * output - stdout */ diff --git a/SEL32/tests/diag.ini b/SEL32/tests/diag.ini index 6746238..39f12f5 100644 --- a/SEL32/tests/diag.ini +++ b/SEL32/tests/diag.ini @@ -1,4 +1,5 @@ set debug -n sel.log +set RTC 50 set CPU 32/27 4M ;set CPU 32/67 4M ;set CPU 32/87 4M @@ -9,7 +10,8 @@ set CPU 32/27 4M ;set mta debug=cmd;detail;exp;data ;set mta debug=inst;cmd;detail;exp ;set inq debug=cmd;detail -;set cpu debug=cmd;exp;inst +;set cpu debug=exp +;set cpu debug=inst;cmd;exp;irq ;set cpu debug=cmd;exp;inst;detail;data ;set cpu debug=cmd;exp;inst;detail ;set cpu debug=cmd;exp;irq @@ -17,7 +19,7 @@ set CPU 32/27 4M ;set con debug=cmd;exp ;set con debug=cmd;exp;data ;set mta debug=cmd;exp;inst;data;detail -;set mta debug=cmd +;set mta debug=cmd;exp ;set dma debug=cmd;exp;detail;data ;set dma debug=cmd;exp;detail;data ; @@ -49,10 +51,11 @@ at mta0 diag.tap ;at mta2 output.tap ;at dma0 diagdisk ;bo dma0 -set history=10000 +;set history=10000 deposit CSW 0 ; uncomment next line to get diag loader prompt ;deposit bootr[0] ffffffff deposit bootr[1] 0 deposit bootr[2] 0 +; Boot from mag tape bo mta0 diff --git a/SEL32/tests/sel32_test.ini b/SEL32/tests/sel32_test.ini index fdee4c7..0f9393b 100644 --- a/SEL32/tests/sel32_test.ini +++ b/SEL32/tests/sel32_test.ini @@ -1,6 +1,7 @@ cd %~p0 set debug -n sel.log -set CPU 32/67 4M +;set CPU 32/67 4M +set CPU 32/27 4M set coml0 enable set coml1 enable set coml2 enable