1: / tap3 -- dec-tape lod/dmp 2: 3: gettape: 4: mov $dir,r1 5: clr -(sp) 6: 1: 7: tst (r1) 8: beq 2f 9: jsr r5,decode; name 10: cmp rnarg,$2 11: ble 4f 12: mov $name,r2 13: mov *parg,r3 14: 3: 15: tstb (r3) 16: beq 3f 17: cmpb (r2)+,(r3)+ 18: beq 3b 19: br 2f 20: 3: 21: tstb (r2) 22: beq 4f 23: cmpb (r2),$'/ 24: bne 2f 25: 4: 26: mov r1,-(sp) 27: jsr pc,*(r5) 28: mov (sp)+,r1 29: inc (sp) 30: 2: 31: add $dirsiz,r1 32: cmp r1,edir 33: blo 1b 34: tst (sp)+ 35: bne 2f 36: cmp rnarg,$2 37: ble 2f 38: mov *parg,r1 39: jsr pc,pstr 40: jsr r5,mesg 41: < not found\n\0>; .even 42: 2: 43: dec narg 44: add $2,parg 45: cmp narg,$2 46: bgt gettape 47: tst (r5)+ 48: rts r5 49: 50: delete: 51: jsr r5,verify; 'd 52: rts pc 53: jsr pc,clrent 54: rts pc 55: 56: numb: 57: mov r1,-(sp) 58: mov r0,-(sp) 59: clr r0 60: br 1f 61: 62: numbx: 63: mov r1,-(sp) 64: mov r0,-(sp) 65: movb size0(r1),r0 66: 1: 67: mov $catlb,r2 68: 1: 69: mov $" ,(r2)+ 70: cmp r2,$catlb+12. 71: blo 1b 72: cmp (r5),$2 73: bne 1f 74: mov $"00,-2(r2) 75: 1: 76: mov (sp)+,r1 77: jsr pc,numb2 78: mov (r5)+,r0 79: sub r0,r2 80: mov r2,0f 81: mov r0,0f+2 82: mov $1,r0 83: sys 0; 9f 84: .data 85: 9: 86: sys write; 0:..; .. 87: .text 88: mov (sp)+,r1 89: rts r5 90: 91: numb1: 92: clr r0 93: numb2: 94: div $10.,r0 95: mov r1,-(sp) 96: mov r0,r1 97: beq 1f 98: jsr pc,numb1 99: 1: 100: mov (sp)+,r0 101: add $'0,r0 102: movb r0,(r2)+ 103: rts pc 104: 105: update: 106: jsr pc,bitmap 107: mov $dir,r1 108: 1: 109: tst (r1) 110: beq 2f 111: bit $100000,mode(r1) 112: beq 2f 113: tstb size0(r1) 114: bne 9f 115: tst size1(r1) 116: beq 2f 117: 9: 118: mov ndentd8,-(sp) 119: inc (sp) 120: movb size0(r1),r2 121: mov size1(r1),r3 122: add $511.,r3 123: adc r2 124: ashc $-9,r2 125: mov r3,size 126: 3: 127: mov (sp),r2 128: mov size,r3 129: 4: 130: jsr pc,bitcalc 131: inc r2 132: bitb (sp)+,map(r0) 133: bne 4f 134: sob r3,4b 135: mov (sp)+,tapea(r1) 136: jsr pc,setmap 137: br 2f 138: 4: 139: inc (sp) 140: br 3b 141: 2: 142: add $dirsiz,r1 143: cmp r1,edir 144: blo 1b 145: jsr pc,wrdir 146: 147: update1: 148: mov $dir,r1 149: clr -(sp) 150: mov $-1,-(sp) 151: 1: 152: tst (r1) 153: beq 2f 154: bit $100000,mode(r1) 155: beq 2f 156: cmp tapea(r1),(sp) 157: bhis 2f 158: mov tapea(r1),(sp) 159: mov r1,2(sp) 160: 2: 161: add $dirsiz,r1 162: cmp r1,edir 163: blo 1b 164: tst (sp)+ 165: mov (sp)+,r1 166: bne 1f 167: rts pc 168: 1: 169: bic $100000,mode(r1) 170: movb size0(r1),mss 171: mov size1(r1),r2 172: bne 4f 173: tst mss 174: beq update1 175: 4: 176: jsr r5,decode; name 177: mov tapea(r1),r0 178: jsr pc,wseek 179: clr r3 180: sys open; name; 0 181: bes phserr 182: mov r0,r3 183: 3: 184: tst mss 185: bne 4f 186: cmp r2,$512. 187: blo 3f 188: 4: 189: mov r3,r0 190: sys read; tapeb; 512. 191: bes phserr 192: cmp r0,$512. 193: bne phserr 194: jsr pc,twrite 195: sub $512.,r2 196: sbc mss 197: br 3b 198: 3: 199: mov r2,0f 200: beq 3f 201: mov r3,r0 202: sys 0; 9f 203: .data 204: 9: 205: sys read; tapeb; 0:.. 206: .text 207: bes phserr 208: cmp r0,0b 209: bne phserr 210: jsr pc,twrite 211: 3: 212: mov r3,r0 213: sys read; tapeb; 512. 214: bes phserr 215: tst r0 216: bne phserr 217: mov r3,r0 218: sys close 219: 2: 220: jmp update1 221: 222: phserr: 223: mov r1,-(sp) 224: mov $name,r1 225: jsr pc,pstr 226: jsr r5,mesg 227: < -- Phase error\n\0>; .even 228: mov (sp)+,r1 229: clr time0(r1) / time 230: beq 2b 231: sys close 232: br 2b 233: 234: bitmap: 235: mov $map,r0 236: 1: 237: clr (r0)+ 238: cmp r0,$emap 239: blo 1b 240: mov $dir,r1 241: 1: 242: tst (r1) 243: beq 2f 244: bit $100000,mode(r1) 245: bne 2f 246: tst size1(r1) 247: bne 3f 248: tstb size0(r1) 249: beq 2f 250: 3: 251: jsr pc,setmap 252: 2: 253: add $dirsiz,r1 254: cmp r1,edir 255: blo 1b 256: rts pc 257: 258: setmap: 259: movb size0(r1),r2 260: mov size1(r1),r3 261: add $511.,r3 262: adc r2 263: ashc $-9.,r2 264: mov tapea(r1),r2 265: 1: 266: jsr pc,bitcalc 267: bitb (sp),map(r0) 268: bne maperr 269: bisb (sp)+,map(r0) 270: inc r2 271: sob r3,1b 272: rts pc 273: 274: bitcalc: 275: mov (sp),-(sp) 276: cmp r2,tapsiz 277: bhis maperr 278: mov r2,r0 279: bic $!7,r0 280: mov r0,-(sp) 281: mov $1,r0 282: als (sp)+,r0 283: mov r0,2(sp) 284: mov r2,r0 285: ash $-3,r0 286: bic $160000,r0 287: rts pc 288: 289: maperr: 290: jsr r5,mesg 291: <Tape overflow\n\0>; .even 292: jmp done 293: 294: usage: 295: jsr pc,bitmap 296: mov $dir,r2 297: 1: 298: tst (r2) 299: beq 2f 300: inc nentr 301: 2: 302: add $dirsiz,r2 303: cmp r2,edir 304: blo 1b 305: mov ndentd8,r2 306: inc r2 307: mov tapsiz,r3 308: dec r3 309: sub ndentd8,r3 310: 1: 311: jsr pc,bitcalc 312: bitb (sp)+,map(r0) 313: beq 2f 314: inc nused 315: mov r2,lused 316: br 3f 317: 2: 318: inc nfree 319: tstb flm 320: bne 1f 321: 3: 322: inc r2 323: sob r3,1b 324: 1: 325: mov nentr,r0 326: jsr r5,numb; 4 327: jsr r5,mesg 328: < entries\n\0>; .even 329: mov nused,r0 330: jsr r5,numb; 4 331: jsr r5,mesg 332: < used\n\0>; .even 333: tstb flm 334: bne 1f 335: mov nfree,r0 336: jsr r5,numb; 4 337: jsr r5,mesg 338: < free\n\0>; .even 339: 1: 340: mov lused,r0 341: jsr r5,numb; 4 342: jsr r5,mesg 343: < last\n\0>; .even 344: rts pc 345: 346: taboc: 347: tstb flv 348: beq 4f 349: mov mode(r1),r0 350: mov r0,-(sp) 351: ash $-6,r0 352: bit $40,r0 353: jsr pc,pmod 354: mov (sp),r0 355: ash $-3,r0 356: bit $200,r0 357: jsr pc,pmod 358: mov (sp)+,r0 359: bit $1000,r0 360: jsr pc,pmod 361: clr r0 362: bisb uid(r1),r0 363: jsr r5,numb; 4 364: clr r0 365: bisb gid(r1),r0 366: jsr r5,numb; 4 367: mov tapea(r1),r0 368: jsr r5,numb; 5 369: mov size1(r1),r0 370: jsr r5,numbx; 9. 371: mov r1,-(sp) 372: add $time0,(sp) 373: jsr pc,_localtime 374: mov r0,(sp) 375: mov 10.(r0),r0 376: jsr r5,numb; 3 377: mov $'/,r0 378: jsr pc,putc 379: mov (sp),r0 380: mov 8.(r0),r0 381: inc r0 382: jsr r5,numb; 2 383: mov $'/,r0 384: jsr pc,putc 385: mov (sp),r0 386: mov 6(r0),r0 387: jsr r5,numb; 2 388: mov (sp),r0 389: mov 4(r0),r0 390: jsr r5,numb; 3 391: mov $':,r0 392: jsr pc,putc 393: mov (sp)+,r0 394: mov 2(r0),r0 395: jsr r5,numb; 2 396: mov $' ,r0 397: jsr pc,putc 398: 4: 399: mov $name,r1 400: jsr pc,pstr 401: jsr r5,mesg 402: <\n\0> 403: rts pc 404: 405: pmod: 406: beq 1f 407: mov $'s,-(sp) 408: br 2f 409: 1: 410: bit $1,r0 411: beq 1f 412: mov $'x,-(sp) 413: br 2f 414: 1: 415: mov $'-,-(sp) 416: 2: 417: bit $2,r0 418: beq 1f 419: mov $'w,-(sp) 420: br 2f 421: 1: 422: mov $'-,-(sp) 423: 2: 424: bit $4,r0 425: beq 1f 426: mov $'r,r0 427: br 2f 428: 1: 429: mov $'-,r0 430: 2: 431: jsr pc,putc 432: mov (sp)+,r0 433: jsr pc,putc 434: mov (sp)+,r0 435: jsr pc,putc 436: rts pc 437: 438: xtract: 439: movb size0(r1),mss 440: bne 2f 441: tst size1(r1) 442: beq 1f 443: 2: 444: jsr r5,verify; 'x 445: rts pc 446: mov size1(r1),r3 447: mov tapea(r1),r0 448: jsr pc,rseek 449: sys unlink; name 450: mov mode(r1),0f 451: sys 0; 9f 452: .data 453: 9: 454: sys creat; name; 0:.. 455: .text 456: bes crterr 457: mov r0,r2 458: 2: 459: tst mss 460: bne 3f 461: cmp r3,$512. 462: blo 2f 463: 3: 464: jsr pc,tread 465: mov r2,r0 466: sys write; tapeb; 512. 467: bes crterr1 468: cmp r0,$512. 469: bne crterr1 470: sub r0,r3 471: sbc mss 472: br 2b 473: 2: 474: mov r3,0f 475: beq 2f 476: jsr pc,tread 477: mov r2,r0 478: sys 0; 9f 479: .data 480: 9: 481: sys write; tapeb; 0:.. 482: .text 483: bes crterr1 484: cmp r0,0b 485: bne crterr1 486: 2: 487: mov r2,r0 488: sys close 489: movb gid(r1),0f+1 490: movb uid(r1),0f 491: sys 0; 9f 492: .data 493: 9: 494: sys chown; name; 0:.. 495: .text 496: mov time0(r1),r0 497: mov r1,-(sp) 498: mov time1(r1),r1 499: / sys 0; 9f 500: .data 501: 9: 502: sys smdate; name 503: .text 504: mov (sp)+,r1 505: 1: 506: rts pc 507: 508: crterr1: 509: clr r0 510: mov r1,-(sp) 511: clr r1 512: / sys smdate; name 513: mov (sp)+,r1 514: mov r2,r0 515: sys close 516: 517: crterr: 518: mov $name,r1 519: jsr pc,pstr 520: jsr r5,mesg 521: < -- create error\n\0>; .even 522: rts pc