/* * Mag tape (TM-11) subroutine to perform any TM-11 function * * called by: * * mtop (cmd,buffer,count); * * where: * * 'cmd' is desired contents of MTC (command word) * 'buffer' is buffer address * 'count' is byte count for transfer operations * * */ #define MTS 0172520 /* TM-11 Status Word */ #define MTC 0172522 /* TM-11 Command Register */ #define MTBC 0172524 /* TM-11 Byte Count Register */ #define MTBA 0172526 /* TM-11 Bus Address Register */ #define EOF 042000 /* EOF bit in MTS */ #define ERROR 0100000 /* Error bit in MTC */ #define RWDST 02 /* Rewind status bit in MTS */ #define DONE 0200 /* Done bit in MTC */ int recnum; /* Record number; externally set */ struct { /* TM-11 dummy variables */ int mts; int mtc; int mtbc; int mtba; } mtop (cmd,buffer,count) { register tmp; /* Temporary for "return" statement */ /* * Wait for Previous (possibly manual) operations to finish */ while (MTS -> mts & RWDST); /* wait on rewind to finish */ while ((MTS -> mtc & DONE) == 0); /* Wait on controller ready */ /* * * Perform Mag Tape Operation ... * */ MTS -> mtbc = -count; /* Load Negative of Count */ MTS -> mtba = buffer; /* Load Buffer address */ MTS -> mtc = cmd; /* Load Command Word */ /* * * Wait on Control Unit ready * */ while ((MTS -> mtc & DONE) == 0); /* Note rewind will not cause wait */ /* * * Check for, and process, any errors which occur ... * */ if (MTS -> mtc < 0) { if (MTS -> mts & EOF) { /* EOF Errors are ok, just */ return (0); } /* return 0 bytes read */ else { /* Any other errors are nfg, print a message */ printf ("Mag Tape error -- Record #%d MTS=%o\n",recnum, MTS -> mts); flush(); } } /* * Compute number of bytes transferred, and return this value ... */ tmp = MTS -> mtba; tmp =- buffer; /* amount transferred */ return (tmp); }