Skip to content

Commit

Permalink
sigma: implement attention interrupt to sigma)mt.c
Browse files Browse the repository at this point in the history
  • Loading branch information
kenrector committed Jan 30, 2025
1 parent feb155f commit c6ca12c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions sigma/sigma_mt.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ int32 mt_rwtime = 10000; /* rewind latency */
int32 mt_ctime = 100; /* command latency */
int32 mt_time = 10; /* record latency */
uint32 mt_rwi = 0; /* rewind interrupts */
uint32 mt_atn = 0; /* attention interrupt */
t_mtrlnt mt_bptr;
t_mtrlnt mt_blim;
uint8 mt_xb[MT_MAXFR]; /* transfer buffer */
Expand Down Expand Up @@ -152,6 +153,8 @@ t_stat mt_map_err (UNIT *uptr, t_stat r);
int32 mt_clr_int (uint32 dva);
void mt_set_rwi (uint32 un);
void mt_clr_rwi (uint32 un);
void mt_set_atn (uint32 un);
void mt_clr_atn (uint32 un);

/* MT data structures
Expand Down Expand Up @@ -631,6 +634,10 @@ for (iu = 0; iu < MT_NUMDR; iu++) { /* rewind int? */
mt_clr_rwi ((uint32) iu);
return (iu | MTAI_INT);
}
if (mt_atn & (1u << iu)) {
mt_clr_atn ((uint32) iu);
return (iu | MTAI_INT);
}
}
return 0;
}
Expand All @@ -644,6 +651,15 @@ chan_set_dvi (mt_dib.dva); /* set INP */
return;
}

/* Set ATN interrupt */

void mt_set_atn (uint32 un)
{
mt_atn |= (1u << un);
chan_set_dvi (mt_dib.dva); /* set INP */
return;
}

/* Clear rewind interrupt */

void mt_clr_rwi (uint32 un)
Expand All @@ -656,6 +672,16 @@ else if (chan_chk_chi (mt_dib.dva) < 0) /* any int? */
return;
}

void mt_clr_atn (uint32 un)
{
mt_atn &= ~(1u << un);
if (mt_atn != 0) /* more? */
chan_set_dvi (mt_dib.dva);
else if (chan_chk_chi (mt_dib.dva) < 0) /* any int? */
chan_clr_chi (mt_dib.dva); /* clr INP */
return;
}

/* Reset routine */

t_stat mt_reset (DEVICE *dptr)
Expand Down Expand Up @@ -684,11 +710,14 @@ return SCPE_OK;
t_stat mt_attach (UNIT *uptr, CONST char *cptr)
{
t_stat r;
uint32 un = uptr - mt_unit;

r = sim_tape_attach (uptr, cptr);
if (r != SCPE_OK)
return r;
uptr->UST = MTDV_BOT;
if (sim_switches & SWMASK('A'))
mt_set_atn (un);
return r;
}

Expand Down

0 comments on commit c6ca12c

Please sign in to comment.