Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sigma: implement attention interrupt to sigma)mt.c #445

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading