1: / unix DEC-tape time/mtrack track formatter 2: 3: nword = 256. 4: nblock = 578. 5: endz = 7200. 6: 7: ps = 177776 8: tcst = 177340 9: tccm = 177342 10: tcwc = 177344 11: tcba = 177346 12: tcdt = 177350 13: 14: mov r5,savr5 15: mov sp,savsp 16: 17: jsr pc,4(r5) 18: <ready drive 0 and type y\n\0>; .even 19: jsr pc,2(r5) 20: mov r0,-(sp) 21: mov $'\n,r0 22: jsr pc,(r5) 23: cmp (sp)+,$'y 24: beq 1f 25: rts pc 26: 1: 27: clr r0 28: mov $cobtab,r1 29: 1: 30: jsr pc,bcomobv 31: mov r2,(r1)+ 32: inc r0 33: cmp r0,$512. 34: bne 1b 35: 36: mov $buffer,r0 37: 1: 38: mov $-1,(r0)+ 39: cmp r0,$buffer+nword+nword 40: blo 1b 41: 42: mov savr5,r5 43: jsr pc,2(r5) 44: 45: mov $340,ps 46: mov $tcdt,r5 47: mov $13,tccm 48: jsr pc,flag 49: 50: / 8Kch for end zone 51: 52: mov $endz,r4 53: 1: 54: jsr r0,mtrack; 101101 55: dec r4 56: bne 1b 57: 58: / foreward guard 59: 60: mov $199.,r4 61: 1: 62: jsr r0,mtrack; 10101 63: dec r4 64: bne 1b 65: 66: / blocks 67: 68: mov $nblock,r3 69: 1: 70: jsr r0,mtrack; 10101 71: jsr r0,mtrack; 10110 72: jsr r0,mtrack; 11010 73: jsr r0,mtrack; 01000 74: jsr r0,mtrack; 01000 75: jsr r0,mtrack; 01000 76: jsr r0,mtrack; 01000 77: mov $nword-4,r4 78: 2: 79: jsr r0,mtrack; 111000 80: dec r4 81: bne 2b 82: jsr r0,mtrack; 111011 83: jsr r0,mtrack; 111011 84: jsr r0,mtrack; 111011 85: jsr r0,mtrack; 111011 86: jsr r0,mtrack; 101001 87: jsr r0,mtrack; 100101 88: jsr r0,mtrack; 10101 89: dec r3 90: bne 1b 91: 92: / rear guard 93: 94: mov $199.,r4 95: 1: 96: jsr r0,mtrack; 10101 97: dec r4 98: bne 1b 99: 100: / rear end zone 101: 102: mov $endz,r4 103: 1: 104: jsr r0,mtrack; 10010 105: dec r4 106: bne 1b 107: clr tccm 108: 109: / end of mtrack pass 110: / go back 12 blocks 111: 112: mov $12.,r0 113: mov $4002,tccm 114: 1: 115: incb tccm 116: jsr pc,flag 117: dec r0 118: bne 1b 119: 120: / put comobv(nblock-1) in everything 121: / up to end zone 122: 123: mov $nblock-1,r0 124: mov r0,bn 125: jsr pc,comobv 126: mov $17,tccm 127: jsr pc,flag 128: 1: 129: movb r1,tcst 130: mov r0,(r5) 131: jsr pc,flag1 132: br 1b 133: 134: / reverse pass put in 135: / foreward and reverse 136: / block numbers 137: 138: mov $4017,tccm 139: jsr pc,flag 140: 1: 141: mov $nword+3.,r4 142: 2: 143: clrb tcst 144: clr (r5) 145: jsr pc,flag 146: dec r4 147: bne 2b 148: 149: clrb tcst 150: clr (r5) 151: mov bn,r0 152: jsr pc,comobv 153: jsr pc,flag 154: movb r1,tcst 155: mov r0,(r5) 156: jsr pc,flag 157: dec bn 158: blt check 159: clrb tcst 160: clr (r5) 161: jsr pc,flag 162: clrb tcst 163: clr (r5) 164: jsr pc,flag 165: clrb tcst 166: mov bn,(r5) 167: jsr pc,flag 168: clrb tcst 169: clr (r5) 170: jsr pc,flag 171: clrb tcst 172: clr (r5) 173: jsr pc,flag 174: br 1b 175: 176: / foreward pass 177: / confirm block numbers 178: / write all 1's in data 179: 180: check: 181: clrb tcst 182: clr (r5) 183: jsr pc,flag1 184: br check 185: clr r4 186: 1: 187: mov $3,tccm 188: jsr pc,flag 189: cmp (r5),r4 190: bne error1 191: mov $-nword,tcwc 192: mov $buffer,tcba 193: mov $15,tccm 194: jsr pc,flag 195: inc r4 196: cmp r4,$nblock 197: bne 1b 198: mov $3,tccm 199: jsr pc,flag1 200: br error2 201: 202: / reverse pass 203: / confirm block numbers 204: / read data and compare 205: / to all 1's 206: 207: 1: 208: mov $4003,tccm 209: jsr pc,flag 210: dec r4 211: cmp r4,(r5) 212: bne error3 213: mov $-nword,tcwc 214: mov $buffer,tcba 215: mov $4005,tccm 216: jsr pc,compare 217: jsr pc,flag 218: tst r4 219: bne 1b 220: mov $4003,tccm 221: jsr pc,flag1 222: br error4 223: jsr pc,compare 224: mov savr5,r5 225: mov savsp,sp 226: rts pc 227: 228: error1: 229: mov $1,r0 230: br 1f 231: error2: 232: mov $1,r0 233: br 1f 234: error3: 235: mov $3,r0 236: br 1f 237: error4: 238: mov $4,r0 239: br 1f 240: error5: 241: mov $5,r0 242: br 1f 243: error6: 244: mov $6,r0 245: br 1f 246: error7: 247: mov $7,r0 248: 1: 249: mov $1,tccm 250: mov savr5,r5 251: mov savsp,sp 252: jsr pc,4(r5) 253: <tcf: error\n\0>; .even 254: rts pc 255: 256: compare: 257: mov r0,-(sp) 258: mov $buffer,r0 259: 1: 260: cmp (r0)+,$-1 261: bne error5 262: cmp r0,$buffer+nword+nword 263: blo 1b 264: mov (sp)+,r0 265: rts pc 266: 267: mtrack: 268: mov (r0)+,(r5) 269: jsr pc,flag 270: rts r0 271: 272: flag: 273: bit $100200,tccm 274: beq flag 275: blt error6 276: rts pc 277: 278: flag1: 279: bit $100200,tccm 280: beq flag1 281: bge 1f 282: tst tcst 283: bge error7 284: add $2,(sp) 285: 1: 286: rts pc 287: 288: comobv: 289: mov r0,r4 290: bic $!777,r0 291: asl r0 292: mov cobtab(r0),r0 293: swab r0 294: clr r1 295: ror r0 296: rol r1 297: asl r0 298: asl r0 299: rol r1 300: swab r4 301: bic $177401,r4 302: bis cobtab(r4),r0 303: rts pc 304: 305: bcomobv: 306: mov r0,r2 307: bic $!70,r2 308: mov r0,r3 309: mov $6.,r4 310: 1: 311: asr r3 312: dec r4 313: bne 1b 314: bic $!7,r3 315: bis r3,r2 316: mov r0,r3 317: mov $6.,r4 318: 1: 319: asl r3 320: dec r4 321: bne 1b 322: bic $!700,r3 323: bis r3,r2 324: com r2 325: bic $!777,r2 326: rts pc 327: 328: bn: .=.+2 329: savr5: .=.+2 330: savsp: .=.+2 331: cobtab: .=.+1024. 332: buffer: .=.+nword+nword