1: / tap2 -- dec-tape lod/dmp 2: 3: pstr: 4: movb (r1)+,r0 5: beq 1f 6: jsr pc,putc 7: br pstr 8: 1: 9: rts pc 10: 11: mesg: 12: movb (r5)+,r0 13: beq 1f 14: jsr pc,putc 15: br mesg 16: 1: 17: inc r5 18: bic $1,r5 19: rts r5 20: 21: putc: 22: movb r0,ch 23: mov $1,r0 24: sys write; ch; 1 25: rts pc 26: 27: getc: 28: clr r0 29: sys read; ch; 1 30: movb ch,r0 31: rts pc 32: 33: clrdir: 34: mov $dir,r1 35: mov ndirent,r2 36: 1: 37: jsr pc,clrent 38: sob r2,1b 39: rts pc 40: 41: clrent: 42: mov r1,-(sp) 43: add $dirsiz,(sp) 44: 1: 45: clr (r1)+ 46: cmp r1,(sp) 47: blo 1b 48: tst (sp)+ 49: rts pc 50: 51: rddir: 52: clr sum 53: jsr pc,clrdir 54: clr r0 55: jsr pc,rseek 56: jsr pc,tread 57: mov tapeb+510.,r0 58: beq 1f 59: tstb flm 60: beq 1f 61: mov r0,ndirent 62: 1: 63: mov $dir,r1 64: mov ndirent,r2 65: 1: 66: bit $7,r2 67: bne 2f 68: jsr pc,tread 69: mov $tapeb,r3 70: 2: 71: mov r1,-(sp) 72: mov r3,-(sp) 73: mov $32.,r0 74: clr -(sp) 75: 2: 76: add (r3)+,(sp) 77: sob r0,2b 78: bis (sp),sum 79: tst (sp)+ 80: bne 2f 81: mov (sp),r3 82: tst (r3) 83: beq 2f 84: mov r3,0f 85: jsr pc,9f 86: .data 87: 9: 88: jsr r5,encode; 0:.. 89: rts pc 90: .text 91: add $32.,r3 92: mov r1,-(sp) 93: add $dirsiz,(sp) 94: tst (r1)+ / namep 95: 9: 96: mov (r3)+,(r1)+ 97: cmp r1,(sp) 98: blo 9b 99: tst (sp)+ 100: 2: 101: mov (sp)+,r3 102: add $64.,r3 103: mov (sp)+,r1 104: bic $100000,mode(r1) 105: add $dirsiz,r1 106: sob r2,1b 107: tst sum 108: beq 1f 109: jsr r5,mesg 110: <Directory checksum\n\0>; .even 111: tstb fli 112: bne 1f 113: jmp done 114: 1: 115: jsr pc,bitmap 116: rts pc 117: 118: wrdir: 119: clr r0 120: jsr pc,wseek 121: tstb flm 122: bne 1f 123: sys open; tboot; 0 124: bes 3f 125: br 2f 126: 1: 127: sys open; mboot; 0 128: bes 3f 129: 2: 130: mov r0,r1 131: sys read; tapeb; 512. 132: mov r1,r0 133: sys close 134: mov ndirent,tapeb+510. 135: 3: 136: jsr pc,twrite 137: mov $dir,r1 138: mov ndirent,r2 139: 1: 140: bit $7,r2 141: bne 2f 142: mov $256.,r0 143: mov $tapeb,r3 144: 3: 145: clr (r3)+ 146: sob r0,3b 147: mov $tapeb,r3 148: 2: 149: mov r3,-(sp) 150: tst (r1) 151: beq 2f 152: mov r3,0f 153: jsr pc,9f 154: .data 155: 9: 156: jsr r5,decode; 0:.. 157: rts pc 158: .text 159: 2: 160: add $32.,r3 161: mov r1,-(sp) 162: add $dirsiz,(sp) 163: tst (r1)+ 164: 9: 165: mov (r1)+,(r3)+ 166: cmp r1,(sp) 167: blo 9b 168: tst (sp)+ 169: mov (sp)+,r3 170: clr -(sp) 171: mov $31.,r0 172: 2: 173: sub (r3)+,(sp) 174: sob r0,2b 175: mov (sp)+,(r3)+ 176: dec r2 177: bit $7,r2 178: bne 1b 179: jsr pc,twrite 180: tst r2 181: bne 1b 182: rts pc 183: 184: tread: 185: mov fio,r0 186: sys read; tapeb; 512. 187: bes trderr 188: cmp r0,$512. 189: bne trderr 190: 1: 191: inc rseeka 192: rts pc 193: 194: trderr: 195: jsr r5,mesg 196: <Tape read error\n\0>; .even 197: tstb fli 198: beq 1f 199: mov $tapeb,r0 200: 2: 201: clr (r0)+ 202: cmp r0,$tapeb+512. 203: blo 2b 204: br 1b 205: 1: 206: jmp done 207: 208: twrite: 209: mov fio,r0 210: sys write; tapeb; 512. 211: bes twrerr 212: cmp r0,$512. 213: bne twrerr 214: inc wseeka 215: rts pc 216: 217: twrerr: 218: jsr r5,mesg 219: <Tape write error\n\0>; .even 220: jmp done 221: 222: rseek: 223: mov r0,rseeka 224: mov r0,0f 225: mov fio,r0 226: sys 0; 9f 227: .data 228: 9: 229: sys seek; 0:..; 3 230: .text 231: bes seekerr 232: rts pc 233: 234: wseek: 235: mov r0,-(sp) 236: sub wseeka,r0 237: bge 1f 238: neg r0 239: 1: 240: cmp r0,$25. / longest write seek 241: ble 1f 242: mov (sp),0f 243: beq 2f 244: dec 0f 245: 2: 246: mov fio,r0 247: sys 0; 9f 248: .data 249: 9: 250: sys seek; 0:..; 3 251: .text 252: mov fio,r0 253: sys read; wseeka; 1 254: 1: 255: mov (sp),wseeka 256: mov (sp)+,0f 257: mov fio,r0 258: sys 0; 9f 259: .data 260: 9: 261: sys seek; 0:..; 3 262: .text 263: bes seekerr 264: rts pc 265: 266: seekerr: 267: jsr r5,mesg 268: <Tape seek error\n\0>; .even 269: jmp done 270: 271: verify: 272: movb (r5)+,0f 273: inc r5 274: tstb flw 275: bne 1f 276: tstb flv 277: beq 2f 278: 1: 279: jsr pc,9f 280: .data 281: 9: 282: jsr r5,mesg 283: 0:<x \0>; .even 284: rts pc 285: .text 286: mov r1,-(sp) 287: mov $name,r1 288: jsr pc,pstr 289: mov (sp)+,r1 290: tstb flw 291: beq 1f 292: jsr r5,mesg 293: < \0> 294: jsr pc,getc 295: cmp r0,$'x 296: bne 3f 297: jsr pc,getc 298: jmp done 299: 3: 300: cmp r0,$'\n 301: beq 3f 302: cmp r0,$'y 303: bne 4f 304: jsr pc,getc 305: cmp r0,$'\n 306: beq 2f 307: 4: 308: jsr pc,getc 309: cmp r0,$'\n 310: bne 4b 311: br 1b 312: 1: 313: jsr r5,mesg 314: <\n\0> 315: 2: 316: tst (r5)+ 317: 3: 318: rts r5 319: 320: getfiles: 321: cmp narg,$2 322: bne 1f 323: mov $".\0,name 324: jsr pc,callout 325: 1: 326: cmp narg,$2 327: ble 1f 328: dec narg 329: mov *parg,r1 330: add $2,parg 331: mov $name,r2 332: 2: 333: movb (r1)+,(r2)+ 334: bne 2b 335: jsr pc,callout 336: br 1b 337: 1: 338: rts pc 339: 340: expand: 341: sys open; name; 0 342: bes fserr 343: mov r0,-(sp) 344: 1: 345: mov (sp),r0 346: sys read; catlb; 16. 347: bes fserr 348: tst r0 349: beq 1f 350: tst catlb 351: beq 1b 352: mov $name,r0 353: mov $catlb+2,r1 354: cmpb (r1),$'. 355: beq 1b 356: 2: 357: tstb (r0)+ 358: bne 2b 359: dec r0 360: mov r0,-(sp) 361: cmpb -1(r0),$'/ 362: beq 2f 363: movb $'/,(r0)+ 364: 2: 365: movb (r1)+,(r0)+ 366: bne 2b 367: jsr pc,callout 368: clrb *(sp)+ 369: br 1b 370: 1: 371: mov (sp)+,r0 372: sys close 373: rts pc 374: 375: fserr: 376: mov $name,r1 377: jsr pc,pstr 378: jsr r5,mesg 379: < -- Cannot open file\n\0>; .even 380: jmp done 381: 382: callout: 383: sys stat; name; statb 384: bes fserr 385: mov statb+4,r0 386: bic $!60000,r0 387: beq 1f 388: cmp r0,$40000 389: beq expand 390: rts pc 391: 1: 392: mov $dir,r1 393: clr -(sp) 394: 1: 395: tst (r1) 396: bne 3f 397: tst (sp) 398: bne 2f 399: mov r1,(sp) 400: 2: 401: add $dirsiz,r1 402: cmp r1,edir 403: blo 1b 404: mov (sp)+,r1 405: bne 4f 406: jsr r5,mesg 407: <Directory overflow\n\0>; .even 408: jmp done 409: 4: 410: jsr r5,verify; 'a 411: rts pc 412: jsr r5,encode; name 413: br 2f 414: 3: 415: jsr r5,decode; name1 416: mov $name,r2 417: mov $name1,r3 418: 3: 419: cmpb (r2)+,(r3) 420: bne 2b 421: tstb (r3)+ 422: bne 3b 423: tst (sp)+ 424: tstb flu 425: beq 3f 426: cmp time0(r1),statb+32. 427: blo 3f 428: bhi 1f 429: cmp time1(r1),statb+34. 430: bhis 1f 431: 3: 432: jsr r5,verify; 'r 433: rts pc 434: 2: 435: mov statb+4,mode(r1) 436: bis $100000,mode(r1) 437: movb statb+7,uid(r1) 438: movb statb+8,gid(r1) 439: tstb flf 440: beq 2f 441: clrb statb+9. 442: clr statb+10. 443: 2: 444: movb statb+9.,size0(r1) 445: mov statb+10.,size1(r1) 446: mov statb+32.,time0(r1) 447: mov statb+34.,time1(r1) 448: 1: 449: rts pc