PDP8: Annotate fall through paths in switch statements

The code is a bit difficult to understand, but it represents the 'normal'
path for processing a DECtape word. The code always flows all the
way to the break.

For start of block, there's extra code to check for a timing error; but
then the first word is processed (case 0).

For a normal word, a 3-cycle data break is done - increment word
count and current address, check for word count overflow, put the
word in the buffer; but then check for end of block (case DTO_WCO).

If the word count has already overflowed,  just check for end of block.

So yes, the end of case 0 should be labeled 'fall through' as well.

FNC_WRIT has the same structure and needs the same comment.
This commit is contained in:
Bob Supnik 2017-03-30 07:12:57 -07:00 committed by Mark Pizzolato
parent c2c1f04e8a
commit c97f466457

View file

@ -802,7 +802,8 @@ switch (fnc) { /* at speed, check fnc *
fprintf (sim_deb, ">>DT%d: reading block %d %s%s\n", fprintf (sim_deb, ">>DT%d: reading block %d %s%s\n",
unum, blk, (dir? "backward": "forward"), unum, blk, (dir? "backward": "forward"),
((dtsa & DTA_MODE)? " continuous": " ")); ((dtsa & DTA_MODE)? " continuous": " "));
dt_substate = 0; /* fall through */ dt_substate = 0;
/* fall through */
case 0: /* normal read */ case 0: /* normal read */
M[DT_WC] = (M[DT_WC] + 1) & 07777; /* incr WC, CA */ M[DT_WC] = (M[DT_WC] + 1) & 07777; /* incr WC, CA */
M[DT_CA] = (M[DT_CA] + 1) & 07777; M[DT_CA] = (M[DT_CA] + 1) & 07777;
@ -815,6 +816,7 @@ switch (fnc) { /* at speed, check fnc *
M[ma] = dat; M[ma] = dat;
if (M[DT_WC] == 0) /* wc ovf? */ if (M[DT_WC] == 0) /* wc ovf? */
dt_substate = DTO_WCO; dt_substate = DTO_WCO;
/* fall through */
case DTO_WCO: /* wc ovf, not sob */ case DTO_WCO: /* wc ovf, not sob */
if (wrd != (dir? 0: DTU_BSIZE (uptr) - 1)) /* not last? */ if (wrd != (dir? 0: DTU_BSIZE (uptr) - 1)) /* not last? */
sim_activate (uptr, DT_WSIZE * dt_ltime); sim_activate (uptr, DT_WSIZE * dt_ltime);
@ -861,10 +863,12 @@ switch (fnc) { /* at speed, check fnc *
fprintf (sim_deb, ">>DT%d: writing block %d %s%s\n", unum, blk, fprintf (sim_deb, ">>DT%d: writing block %d %s%s\n", unum, blk,
(dir? "backward": "forward"), (dir? "backward": "forward"),
((dtsa & DTA_MODE)? " continuous": " ")); ((dtsa & DTA_MODE)? " continuous": " "));
dt_substate = 0; /* fall through */ dt_substate = 0;
/* fall through */
case 0: /* normal write */ case 0: /* normal write */
M[DT_WC] = (M[DT_WC] + 1) & 07777; /* incr WC, CA */ M[DT_WC] = (M[DT_WC] + 1) & 07777; /* incr WC, CA */
M[DT_CA] = (M[DT_CA] + 1) & 07777; M[DT_CA] = (M[DT_CA] + 1) & 07777;
/* fall through */
case DTO_WCO: /* wc ovflo */ case DTO_WCO: /* wc ovflo */
ma = DTB_GETMEX (dtsb) | M[DT_CA]; /* get mem addr */ ma = DTB_GETMEX (dtsb) | M[DT_CA]; /* get mem addr */
ba = (blk * DTU_BSIZE (uptr)) + wrd; /* buffer ptr */ ba = (blk * DTU_BSIZE (uptr)) + wrd; /* buffer ptr */