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