[Simh] 3 patches for h316 version 37-1

theo engel theo.engel at hetnet.nl
Fri Jun 8 18:07:32 EDT 2007


Dear All,

While testing the real time clock handler, I found a small error in module 
h316_stddev.c. The index used to locate the real time clock memory location 
in memory is wrong.

I also add two patches, which I sent earlier (Dec 5 2006; for v36-1), but on 
which i did got a reaction. They are adapted to version v37-1. The code of 
the proposed 3 changes is shown in the attached file.

A short description of the other 2 problems:

1) While testing h316 magtape support with Honeywell's (ddp416/516) standard 
magtape drivers I found the problem:
When writing files with multiple records on a tape, the first record of the 
first file is ok, but of each of the following records the first 2 bytes 
(1st buffer word) are missing.
So of a 40 word recordbuffer, 39 words are written.

The standard driver (o$ma) does not execute an explicit OCP-stop-writing 
(which generates an reset ready), so the proposed solution is to add a reset 
ready when writing of the buffer is completed. With this change the problem 
is solved.

2) When writing is multiple print files to the lineprinter is stopped (to a 
single simulated lineprinter file) the very last printed record is not 
written to the file of the simulated lineprinter.
Although a small problem, it is caused by the fact that the current 
lineprinter module "prints" a line to the simulated printer when the next 
line to print is received. For the last line the next line to print is never 
received, so that last line is never printed. With the attached code change, 
a line is "printed" when the line is received for printing, which solves the 
problem.

Please have a look whether the changes can be included in a next release of 
h316.

With kind regards,
Theo Engel

-------------- next part --------------
3 patches made in simhv37-1 (June 8, 2007)

1) in module h316_stddev.c: the realtime clock handler uses wrong index into M to locate the rtc memory location
2) in module h316_lp.c: lineprinter driver does not print the very last line of a print file when multiple printfiles are written to a single simulated printerfile
3) in module h316_mt.c: in a multiple record tapefile, the 1st 2 bytes (1st word) is missing in all but the 1st record

patches:


pclx4:/usr/local/src/simhv37-1 # diff -b -C 10 ./H316 ../simhv37-1-org/H316
diff -b -C 10 ./H316/h316_stddev.c ../simhv37-1-org/H316/h316_stddev.c
*** ./H316/h316_stddev.c        Fri Jun  8 22:56:07 2007
--- ../simhv37-1-org/H316/h316_stddev.c Sun Oct  1 14:28:00 2006
***************
*** 822,843 ****
          }

  return dat;
  }

  /* Unit service */

  t_stat clk_svc (UNIT *uptr)
  {

! /* M[M_CLK] = M[M_CLK + 1] & DMASK;                         */
! M[M_CLK] = M[M_CLK] + 1 & DMASK;                        /* increment mem ctr ###############changed############### */
  if (M[M_CLK] == 0) SET_INT (INT_CLK);                   /* = 0? set flag */
  sim_activate (&clk_unit, sim_rtc_calb (clk_tps));       /* reactivate */
  return SCPE_OK;
  }

  /* Reset routine */

  t_stat clk_reset (DEVICE *dptr)
  {
  CLR_INT (INT_CLK);                                      /* clear ready, enb */
--- 822,842 ----
          }

  return dat;
  }

  /* Unit service */

  t_stat clk_svc (UNIT *uptr)
  {

! M[M_CLK] = M[M_CLK + 1] & DMASK;                        /* increment mem ctr */
  if (M[M_CLK] == 0) SET_INT (INT_CLK);                   /* = 0? set flag */
  sim_activate (&clk_unit, sim_rtc_calb (clk_tps));       /* reactivate */
  return SCPE_OK;
  }

  /* Reset routine */

  t_stat clk_reset (DEVICE *dptr)
  {
  CLR_INT (INT_CLK);                                      /* clear ready, enb */
diff -b -C 10 ./H316/h316_lp.c ../simhv37-1-org/H316/h316_lp.c
*** ./H316/h316_lp.c    Fri Jun  8 22:53:16 2007
--- ../simhv37-1-org/H316/h316_lp.c     Wed Jan 24 13:24:00 2007
***************
*** 289,339 ****
      if (lpt_eor) SET_INT (INT_LPT);                     /* end range? intr */
      else {
          lpt_rdy = 1;                                    /* set ready */
          SET_CH_REQ (ch);                                /* get more data */
          }
      }
  else lpt_rdy = 1;                                       /* IO, continue scan */
  if (lpt_dma && lpt_eor) SET_INT (INT_LPT);              /* end of range? */
  if (lpt_svcst & LPT_SVCSH) {                            /* shuttling */
      SET_INT (INT_LPT);                                  /* interrupt */
!     if (lpt_crpos == 0)
!               {                                               /* ********** ADDED ********* */
!                               /* output buf */                        /* ********** ADDED ********* */
!                               for (i = LPT_WIDTH - 1; i >= 0; i--)  {             /* backscan for blanks */ /* ********** ADDED ********* */
!                                               if (lpt_buf[i] != ' ') break;   /* ********** ADDED ********* */
!                               }                                                                               /* ********** ADDED ********* */
!                               lpt_buf[i + 1] = 0;                                             /* ********** ADDED ********* */
!                               fputs (lpt_buf, uptr->fileref);                     /* output buf */            /* ********** ADDED ********* */
!                               uptr->pos = ftell (uptr->fileref);                  /* update pos */            /* ********** ADDED ********* */
!                               for (i = 0; i < LPT_WIDTH; i++) lpt_buf[i] = ' ';   /* clear buf */                     /* ********** ADDED ********* */
!
!                               lpt_prdn = 1;       /* THIS statement was there, so not added ******************** */
!               }                                               /* ********** ADDED ********* */
      }
  if (lpt_svcst & LPT_SVCPA) {                            /* paper advance */
      SET_INT (INT_LPT);                                                                        /* interrupt */
!     /* ****************************** deleted ***
!       for (i = LPT_WIDTH - 1; i >= 0; i--)  {
          if (lpt_buf[i] != ' ') break;
          }
      lpt_buf[i + 1] = 0;
!     fputs (lpt_buf, uptr->fileref);
!       ***************************************** */
!
      fputs (lpt_cc[lpt_svcch & 03], uptr->fileref);      /* output eol */
      uptr->pos = ftell (uptr->fileref);                  /* update pos */
!
!       /* ****************************** deleted ***
!     for (i = 0; i < LPT_WIDTH; i++) lpt_buf[i] = ' ';
!       ***************************************** */
!
      }
  lpt_svcst = 0;
  return SCPE_OK;
  }

  /* Reset routine */

  t_stat lpt_reset (DEVICE *dptr)
  {
  int32 i;
--- 289,320 ----
      if (lpt_eor) SET_INT (INT_LPT);                     /* end range? intr */
      else {
          lpt_rdy = 1;                                    /* set ready */
          SET_CH_REQ (ch);                                /* get more data */
          }
      }
  else lpt_rdy = 1;                                       /* IO, continue scan */
  if (lpt_dma && lpt_eor) SET_INT (INT_LPT);              /* end of range? */
  if (lpt_svcst & LPT_SVCSH) {                            /* shuttling */
      SET_INT (INT_LPT);                                  /* interrupt */
!     if (lpt_crpos == 0) lpt_prdn = 1;
      }
  if (lpt_svcst & LPT_SVCPA) {                            /* paper advance */
      SET_INT (INT_LPT);                                  /* interrupt */
!     for (i = LPT_WIDTH - 1; i >= 0; i--)  {             /* backscan for blanks */
          if (lpt_buf[i] != ' ') break;
          }
      lpt_buf[i + 1] = 0;
!     fputs (lpt_buf, uptr->fileref);                     /* output buf */
      fputs (lpt_cc[lpt_svcch & 03], uptr->fileref);      /* output eol */
      uptr->pos = ftell (uptr->fileref);                  /* update pos */
!     for (i = 0; i < LPT_WIDTH; i++) lpt_buf[i] = ' ';   /* clear buf */
      }
  lpt_svcst = 0;
  return SCPE_OK;
  }

  /* Reset routine */

  t_stat lpt_reset (DEVICE *dptr)
  {
  int32 i;
diff -b -C 10 ./H316/h316_mt.c ../simhv37-1-org/H316/h316_mt.c
*** ./H316/h316_mt.c    Fri Jun  8 22:32:09 2007
--- ../simhv37-1-org/H316/h316_mt.c     Fri Feb 17 14:57:00 2006
***************
*** 425,445 ****
          uptr->FNC = uptr->FNC | FNC_2ND;                /* next state */
          sim_activate (uptr, mt_xtime);                  /* sched xfer */
          return SCPE_OK;                                 /* continue */

      case FNC_WBCD2 | FNC_2ND:                           /* write, word */
      case FNC_WBIN2 | FNC_2ND:
      case FNC_WBIN3 | FNC_2ND:
          if (mt_eor || mt_rdy) {                         /* done or no data? */
              if (!mt_rdy) mt_wrwd (uptr, mt_buf);        /* write last word */
              if (mt_ptr) {                               /* any data? */
-                                       mt_rdy = 0;                             /* **************ADDED****************** */
                  if (st = sim_tape_wrrecf (uptr, mtxb, mt_ptr))  /* write, err? */
                      r = mt_map_err (uptr, st);          /* map error */
                  }
              break;                                      /* sched end motion */
              }
          mt_wrwd (uptr, mt_buf);                         /* write word */
          sim_activate (uptr, mt_xtime);                  /* no, sched word */
          mt_updint (1, mt_mdirq);                        /* set ready */
          if (mt_dma) SET_CH_REQ (ch);                    /* DMC/DMA? req chan */
          return SCPE_OK;                                 /* continue */
--- 425,444 ----
pclx4:/usr/local/src/simhv37-1 #                                                                                


More information about the Simh mailing list