1: /
   2: /
   3: 
   4: / nroff1 -- text formatter
   5: 
   6: /	rts = 104000
   7:         signal = 48.
   8:         nop = 000240
   9: 
  10:         jmp     ibuf
  11: .data
  12: ibuf: /init code in ibuf+obuf
  13:         cmp     sp,$end
  14:         bhi     1f
  15:         jsr     r5,string; emes1
  16:         sys     exit
  17: 1:
  18:         clr     r0
  19:         jsr     pc,ttyn
  20:         cmpb    r0,$'x
  21:         bne     0f
  22:         inc     iflg
  23:         mov     $1,r0
  24:         jsr     pc,ttyn
  25: 0:
  26:         movb    r0,ttyx+8
  27:         clr     r0
  28:         jsr     pc,mesg
  29:         sys     open; ttyx; 2
  30:         bes     0f
  31:         mov     r0,ttyid
  32:         mov     r0,ttyod
  33: 0:
  34:         mov     ttyid,r0
  35:         sys     gtty; ttys
  36:         sys     signal; 1; place
  37:         sys     signal; 2; place
  38:         bit     $1,r0
  39:         beq     0f
  40:         sys     signal; 2; 1    /no deletes
  41:         sys     signal; 3; 1    /no quits
  42:         sys     signal; 1; 1    /allow hangup
  43: 0:
  44:         mov     $'%,rlist
  45:         mov     $"nl,rlist+2
  46:         mov     $"dn,rlist+4
  47:         mov     $"yr,rlist+6
  48:         mov     $"mo,rlist+8.
  49:         mov     $"dy,rlist+10.
  50:         mov     $"dw,rlist+12.
  51:         mov     $"hp,rlist+14.
  52:         mov     sp,r0
  53:         jsr     pc,makebf
  54:         sys     open; suffil; 0
  55:         bes     1f
  56:         mov     r0,suff
  57:         sys     seek; 20; 0
  58:         bes     1f
  59:         mov     suff,r0
  60:         sys     read; suftab; 2*26.
  61: 1:
  62:         clr     r0
  63:         mov     (sp)+,argc
  64:         dec     argc
  65:         ble     4f
  66: 1:
  67:         tst     (sp)+
  68:         mov     (sp),r4
  69:         cmpb    (r4)+,$'+
  70:         bne     2f
  71:         jsr     r5,pnum; pfrom
  72:         br      3f
  73: 2:
  74:         cmpb    -1(r4),$'-
  75:         bne     2f
  76:         tstb    (r4)
  77:         beq     4f
  78:         cmpb    (r4),$'m
  79:         bne     0f
  80:         mov     $nextf1,r0
  81:         tstb    (r4)+
  82: 8:
  83:         movb    (r4)+,(r0)+
  84:         bne     8b
  85:         inc     nx
  86:         inc     mflg
  87:         br      3f
  88: 0:
  89:         cmpb    (r4),$'r
  90:         bne     0f
  91:         tstb    (r4)+
  92:         movb    (r4)+,r0
  93:         beq     3f
  94:         jsr     pc,findr
  95:         mov     r1,-(sp)
  96:         mov     r4,ibufp
  97:         mov     $-1,eibuf
  98:         jsr     pc,atoi
  99:         mov     (sp)+,r1
 100:         mov     r0,(r1)
 101:         clr     ch
 102:         br      3f
 103: 0:
 104:         cmpb    (r4),$'s
 105:         bne     0f
 106:         inc     stop
 107:         br      3f
 108: 0:
 109:         cmpb    (r4),$'o
 110:         bne     0f
 111:         inc     old
 112:         br      3f
 113: 0:
 114:         cmpb    (r4),$'i
 115:         bne     0f
 116:         inc     stdi
 117:         br      3f
 118: 0:
 119:         cmpb    (r4),$'q
 120:         bne     0f
 121:         inc     quiet
 122:         br      3f
 123: 0:
 124:         cmpb    (r4),$'h
 125:         bne     0f
 126:         clr     slow
 127:         br      3f
 128: 0:
 129:         cmpb    (r4),$'n
 130:         bne     0f
 131:         inc     r4
 132:         jsr     r5,pnum; npn
 133:         br      3f
 134: 0:
 135:         jsr     r5,pnum; pto
 136: 3:
 137:         dec     argc
 138:         bgt     1b
 139: 2:
 140: 4:
 141: /	tst	index
 142: /	beq	1f
 143: /	sys	creat; indf; 666
 144: /	mov	r0,indid
 145: 1:
 146: /	mov	$nop,get1a
 147:         clr     init
 148:         mov     $ibuf,ibufp
 149:         mov     $ibuf,eibuf
 150:         mov     sp,argp
 151:         clr     r0
 152: 1:
 153:         movb    r0,trtab(r0)
 154:         inc     r0
 155:         cmp     r0,$128.
 156:         bne     1b
 157:         movb    $040,trtab+014
 158:         mov     sp,ssp
 159:         mov     $70.,vlist+6
 160:         jsr     pc,ctime
 161:         mov     $-1,nl
 162:         mov     $end,enda
 163:         clr     ioff
 164:         jmp     loop
 165: makebf:
 166:         tst     (r0)+
 167:         mov     (r0),r0
 168:         cmpb    (r0),$'a
 169:         bne     0f
 170:         mov     $bfn1,r0
 171:         mov     r0,7f
 172:         mov     r0,8f
 173:         mov     r0,9f
 174: /	mov	r0,place1
 175: 0:
 176:         sys     stat; 8:bfn; stbuf
 177:         bec     2f
 178:         sys     creat; 9:bfn; 600
 179:         bec     1f
 180: 2:
 181:         incb    bfn1+3
 182:         cmpb    bfn1+3,$'z
 183:         blos    0b
 184:         jmp     place
 185: 1:
 186:         mov     r0,ibf
 187:         mov     $blockend,r0
 188:         sub     $block,r0
 189:         cmp     r0,$1024.
 190:         blos    1f
 191:         4
 192: 1:
 193:         mov     r0,blocksize
 194:         clr     -(sp)
 195: 2:
 196:         mov     ibf,r0
 197:         sys     write; block; 1024.
 198:         inc     (sp)
 199:         cmp     (sp),nev
 200:         ble     2b
 201: 
 202:         mov     (sp)+,r3
 203:         mpy     $1024.,r3
 204:         mov     r3,nextb
 205:         mov     r3,first
 206:         mov     ibf,r0
 207:         sys     close
 208:         sys     open; 7:bfn; 2
 209:         jes     place
 210:         mov     r0,ibf
 211:         mov     r0,ibf1
 212:         cmp     $bfn1,7b
 213:         beq     1f
 214:         sys     unlink; bfn
 215: 1:
 216:         rts     pc
 217: 
 218: ctime:
 219:         sys     time
 220:         sub     $18000.,r1 /5hrs for est
 221:         sbc     r0
 222:         ashc    $-2,r0
 223:         div     $21600.,r0
 224:         inc     r0
 225:         mov     r0,dy
 226: /	mov	r1,fd
 227:         add     $3,r0
 228:         mov     r0,r1
 229:         sxt     r0
 230:         div     $7,r0
 231:         inc     r1
 232:         mov     r1,dw
 233: 3:
 234:         mov     yr,r1
 235:         sxt     r0
 236:         div     $4,r0
 237:         mov     $28.,ms+2
 238:         tst     r1
 239:         bne     0f
 240:         mov     $29.,ms+2
 241: 0:
 242:         clr     r0
 243: 1:
 244:         cmp     dy,ms(r0)
 245:         ble     2f
 246:         sub     ms(r0),dy
 247:         tst     (r0)+
 248:         cmp     r0,$24.
 249:         blt     1b
 250:         inc     yr
 251:         mov     yr,r1
 252:         br      3b
 253: 2:
 254:         asr     r0
 255:         inc     r0
 256:         mov     r0,mo
 257:         rts     pc
 258: ms: 31.;28.;31.;30.;31.;30.;31.;31.;30.;31.;30.;31.
 259: 
 260: pnum:
 261:         clr     -(sp)
 262:         clr     r3
 263: 1:
 264:         movb    (r4)+,r0
 265:         sub     $'0,r0
 266:         cmp     r0,$9
 267:         bhi     1f
 268:         inc     (sp)
 269:         mpy     $10.,r3
 270:         add     r0,r3
 271:         br      1b
 272: 1:
 273:         mov     r3,r0
 274:         tst     (sp)+
 275:         beq     2f
 276:         mov     r0,*(r5)+
 277: 1:
 278:         rts     r5
 279: 2:
 280:         tst     (r5)+
 281:         br      1b
 282: 
 283: emes1: <Too many files.\n\0>
 284: .even
 285: obuf=ibuf+512.
 286: .=ibuf+1024.
 287: .text
 288: loop:
 289:         clr     nlflg
 290:         clr     nflush
 291:         clr     nb
 292:         mov     ilistp,r1
 293:         jsr     pc,getch1
 294:         mov     r0,ch
 295:         cmp     ilistp,r1
 296:         beq     1f
 297:         tst     ejf
 298:         beq     1f
 299:         cmp     ilistp,ejl
 300:         bhi     1f
 301:         mov     ilistp,ejl
 302:         inc     nflush
 303:         jsr     pc,newline
 304:         br      loop
 305: 1:
 306:         jsr     pc,getchar
 307:         tst     pendt
 308:         bne     0f
 309:         tst     lit
 310:         ble     1f
 311:         cmp     frame,litlev
 312:         bhi     1f
 313:         dec     lit
 314:         br      0f
 315: 1:
 316:         cmpb    r0,cc
 317:         beq     3f
 318:         cmpb    r0,c2
 319:         beq     2f
 320:         cmpb    r0,tch
 321:         beq     4f
 322:         cmpb    r0,$002
 323:         beq     6f
 324: 0:
 325:         movb    r0,ch
 326:         jsr     pc,text
 327:         br      loop
 328: 4:
 329:         inc     tflg
 330:         inc     copyf
 331: 0:
 332:         jsr     pc,getchar
 333:         mov     r0,r5
 334:         jsr     pc,putchar
 335:         cmp     r5,$'\n
 336:         bne     0b
 337:         clr     tflg
 338:         clr     copyf
 339:         br      loop
 340: 2:
 341:         inc     nb
 342: 3:
 343:         jsr     pc,control
 344: 5:
 345:         jsr     pc,flushi
 346:         br      loop
 347: 6:
 348:         inc     raw
 349:         jsr     pc,get1
 350:         movb    r0,xpc
 351:         clr     nlflg
 352: 0:
 353:         jsr     pc,get1
 354:         cmpb    r0,xpc
 355:         beq     7f
 356:         jsr     pc,pchar2
 357:         br      0b
 358: 7:
 359:         clr     raw
 360:         jbr     loop
 361: 
 362: mesg:
 363:         tst     r0
 364:         bne     setsame
 365:         sys     stat; ttyx; stbuf
 366:         mov     stbuf+4,0f
 367:         mov     0f,1f
 368:         bic     $22,0f
 369:         sys     0;7f
 370: .data
 371: 7:      sys     chmod; ttyx; 0:..
 372: .text
 373:         rts     pc
 374: setsame:
 375:         sys     0;7f
 376: .data
 377: 7:      sys     chmod; ttyx; 1:..
 378: .text
 379:         rts     pc
 380: 
 381: stringfl:
 382:         jsr     pc,flush
 383: string:
 384:         mov     r0,-(sp)
 385:         mov     r1,-(sp)
 386:         mov     r2,-(sp)
 387:         mov     (r5)+,r1
 388:         mov     r1,r2
 389:         mov     r1,9f
 390: 1:
 391:         tstb    (r1)+
 392:         bne     1b
 393:         dec     r1
 394:         sub     r2,r1
 395:         mov     r1,1f
 396:         mov     ttyod,r0
 397:         cmp     r0,ibf
 398:         beq     2f
 399: 0:
 400:         sys     0;7f
 401: .data
 402: 7:      sys     write; 9:..; 1:..
 403: .text
 404:         bes     2f
 405: 1:
 406:         mov     (sp)+,r2
 407:         mov     (sp)+,r1
 408:         mov     (sp)+,r0
 409:         rts     r5
 410: 2:
 411:         sys     creat; tmfile; 666
 412:         bes     1b
 413:         mov     r0,ttyod
 414:         br      0b
 415: 
 416: flushi:
 417:         tst     nflush
 418:         bne     1f
 419:         clr     ch
 420:         tst     nlflg
 421:         bne     1f
 422:         tst     donef
 423:         beq     2f
 424:         cmp     $ilist,ilistp
 425:         beq     1f
 426: 2:
 427:         jsr     pc,getchar
 428:         br      flushi
 429: 1:
 430:         rts     pc
 431: 
 432: gettchar:
 433:         tst     ul
 434:         ble     getchar
 435:         tst     ulstate
 436:         beq     3f
 437:         tst     bsc
 438:         bgt     1f
 439:         tst     ulc
 440:         bgt     2f
 441:         clr     ulstate
 442:         br      3f
 443: 1:
 444:         dec     bsc
 445:         mov     $010,r0
 446:         rts     pc
 447: 2:
 448:         dec     ulc
 449:         mov     $'_,r0
 450:         rts     pc
 451: 3:
 452:         jsr     pc,getchar
 453:         cmp     r0,$016
 454:         beq     4f
 455:         cmp     r0,$017
 456:         beq     4f
 457:         cmp     r0,$'0
 458:         blt     1f
 459:         cmp     r0,$'9
 460:         ble     2f
 461:         cmp     r0,$'A
 462:         blt     1f
 463:         cmp     r0,$'Z
 464:         ble     2f
 465:         cmp     r0,$'a
 466:         blt     1f
 467:         cmp     r0,$'z
 468:         ble     2f
 469: 1:
 470:         tst     ulc
 471:         ble     4f
 472: 3:
 473:         mov     $1,ulstate
 474:         mov     r0,ch
 475:         br      gettchar
 476: 2:
 477:         inc     bsc
 478:         inc     ulc
 479: 4:
 480:         tst     r0
 481:         rts     pc
 482: 
 483: rtnch:
 484:         mov     ch,r0
 485:         clr     ch
 486:         tst     r0
 487:         rts     pc
 488: 
 489: getchar:
 490:         mov     r1,-(sp)
 491: 1:
 492:         jsr     pc,getch1
 493:         bmi     2f
 494:         cmpb    r0,fc
 495:         bne     2f
 496:         tst     copyf
 497:         bne     2f
 498:         jsr     pc,setfield
 499:         br      1b
 500: 2:
 501:         mov     (sp)+,r1
 502:         tst     r0
 503:         rts     pc
 504: getch1:
 505:         tst     ch
 506:         bne     rtnch
 507:         mov     r1,-(sp)
 508: 1:
 509:         jsr     pc,getch0
 510:         bmi     2f
 511:         tst     copyf
 512:         bne     2f
 513:         cmpb    r0,$030 /\w
 514:         bne     2f
 515:         jsr     r5,setwd;getch0
 516:         br      1b
 517: 2:
 518:         jsr     pc,width
 519:         add     r1,column
 520:         mov     (sp)+,r1
 521:         tst     r0
 522:         rts     pc
 523: 
 524: getch0:
 525:         tst     ch
 526:         bne     rtnch
 527: 1:
 528:         tst     nlflg
 529:         beq     1f
 530:         mov     $'\n,r0
 531:         rts     pc
 532: 1:
 533:         mov     r1,-(sp)
 534: 1:
 535:         jsr     pc,get1
 536:         cmpb    r0,eschar
 537:         bne     2f
 538:         jsr     pc,get1
 539:         jsr     r5,switch; esctab
 540:         cmpb    r0,$'\n
 541:         bne     3f
 542: /	clr	column
 543:         br      1b
 544: 2:
 545:         cmp     r0,$033  /prefix
 546:         bne     3f
 547:         jsr     pc,get1
 548:         jsr     r5,switch; pfxtab
 549: 3:
 550:         cmpb    r0,$376 /comment
 551:         bne     2f
 552: 0:
 553:         jsr     pc,get1
 554:         bmi     0b
 555:         cmpb    r0,$012
 556:         bne     0b
 557: 2:
 558:         cmpb    numc,r0
 559:         bne     2f
 560:         clr     r1
 561:         jsr     pc,setn
 562:         br      1b
 563: 2:
 564:         cmpb    r0,$372 /mark hor place
 565:         bne     2f
 566:         tst     copyf
 567:         bne     2f
 568:         mov     r0,r1
 569:         jsr     pc,setn
 570:         jsr     pc,findr
 571:         jeq     1b
 572:         mov     column,(r1)
 573:         jbr     1b
 574: 2:
 575:         cmpb    r0,$025 /text string
 576:         bne     2f
 577:         jsr     pc,setstr
 578:         br      1b
 579: 2:
 580:         cmpb    dolc,r0
 581:         bne     2f
 582:         jsr     pc,seta
 583:         br      1b
 584: 2:
 585:         cmpb    r0,$026 /font indicator
 586:         bne     2f
 587:         jsr     pc,get1
 588:         br      1b
 589: 2:
 590:         cmpb    r0,$027 /point size
 591:         bne     2f
 592:         jsr     pc,eatps
 593:         br      1b
 594: 2:
 595:         cmpb    r0,$021 /spead line
 596:         bne     2f
 597:         tst     copyf
 598:         bne     2f
 599:         inc     spread
 600:         br      1b
 601: 2:
 602:         cmpb    r0,$006 /repeat
 603:         bne     2f
 604:         jsr     pc,setrpt
 605:         br      1b
 606: 2:
 607:         cmp     r0,$'\n
 608:         bne     3f
 609:         inc     nlflg
 610:         clr     column
 611:         tst     ip
 612:         bne     3f
 613:         inc     iline
 614: 3:
 615:         mov     (sp)+,r1
 616:         tst     r0
 617:         rts     pc
 618: 
 619: eatps:
 620:         jsr     pc,get1
 621:         cmpb    r0,$'+
 622:         beq     0f
 623:         cmpb    r0,$'-
 624:         beq     0f
 625:         sub     $'0,r0
 626:         ble     1f
 627:         cmp     r0,$3
 628:         bgt     1f
 629: 0:
 630:         jsr     pc,get1
 631: 1:
 632:         rts     pc
 633: 
 634: .data
 635: esctab:
 636: .byte '*, 025  /text string
 637: .byte 'n, 034  /number char
 638: .byte '$, 020  /dollar char
 639: eschar:
 640: .byte '\\, 134 /backslash
 641: .byte 'e,  013 /printable escape char
 642: .byte 'f, 026  /font indicator
 643: .byte 's, 027  /point size
 644: .byte '&, 037 /filler
 645: .byte 't, 011  /hor tab
 646: .byte '!, 024  /transparent char
 647: .byte 'p, 021  /spread line
 648: .byte 'c, 005 /interrupted text
 649: .byte 'k, 372 /mk hor
 650: / 014 hidden tab replacement character
 651: .byte ' , 014 /\(space)
 652: .byte 'x, 016  /SO (extra chars)
 653: .byte 'y, 017  /SI (normal characters)
 654: .byte 'l, 0177 /delete
 655: .byte 'd, 032  /hlf (down)
 656: .byte 'u, 035  /hlr (up)
 657: .byte 'r, 036  /flr (reverse)
 658: .byte 'a, 001  /leader char
 659: .byte ':, 003 /lem char
 660: .byte '?, 002 /raw trans
 661: .byte '", 376 /comment
 662: .byte 'w, 030  /width size char
 663: .byte 0, 0
 664: .text
 665: 
 666: pfxtab:
 667:    .byte '7, 036  /flr
 668:    .byte '8, 035  /hlr
 669:    .byte '9, 032  /hlf
 670:    .byte '1, 026  /set hor tabs
 671:    .byte '2, 027  /clr hor tabs
 672:    .byte 0,0
 673: pfxtab1:
 674: 
 675: switch:
 676:         mov     r1,-(sp)
 677:         mov     (r5)+,r1
 678: 1:
 679:         cmpb    (r1)+,r0
 680:         beq     1f
 681:         tstb    (r1)+
 682:         bne     1b
 683:         cmp     r1,$pfxtab
 684:         ble     0f
 685:         cmp     r1,$pfxtab1
 686:         bgt     0f
 687:         mov     $037,r0
 688: 0:
 689:         mov     (sp)+,r1
 690:         rts     r5
 691: 1:
 692:         movb    (r1)+,r0
 693:         mov     (sp)+,r1
 694:         rts     r5
 695: 
 696: get1:
 697:         tst     nspace
 698:         ble     1f
 699:         dec     nspace
 700:         mov     rchar,r0
 701:         rts     pc
 702: 1:
 703:         mov     r1,-(sp)
 704: 4:
 705:         tst     cp
 706:         beq     2f
 707:         movb    *cp,r0
 708:         bne     1f
 709:         clr     cp
 710:         br      4b
 711: 1:
 712:         inc     cp
 713:         br      8f
 714: 2:
 715:         tst     ap
 716:         beq     2f
 717:         movb    *ap,r0
 718:         bne     1f
 719:         clr     ap
 720:         br      4b
 721: 1:
 722:         inc     ap
 723:         br      8f
 724: 2:
 725:         cmp     $-1,ip
 726:         bne     1f
 727:         jsr     pc,rdtty
 728:         br      8f
 729: 1:
 730:         tst     ip
 731:         beq     5f
 732:         jsr     pc,rbf
 733:         br      8f
 734: 5:
 735:         tst     donef
 736:         beq     0f
 737:         jmp     done
 738: 0:
 739:         tst     nx
 740:         bne     0f
 741: 3:
 742:         mov     ibufp,r1
 743:         cmp     r1,eibuf
 744:         bne     3f
 745:         cmp     r1,$-1
 746:         beq     3f
 747: 0:
 748:         tst     nfo
 749:         bne     2f
 750: 1:
 751:         jsr     pc,nextfile
 752:         bne     3b
 753: 2:
 754:         clr     nx
 755:         mov     ifile,r0
 756:         sys     read; ibuf; 512.
 757:         bes     1b
 758:         tst     r0
 759:         beq     1b
 760:         mov     $ibuf,r1
 761:         add     r1,r0
 762:         mov     r0,eibuf
 763: 3:
 764:         movb    (r1)+,r0
 765:         bic     $!377,r0
 766:         inc     ioff
 767:         mov     r1,ibufp
 768:         tst     raw
 769:         bne     6f
 770:         cmpb    r0,$040
 771:         bhis    8f
 772:         mov     r0,-(sp)
 773:         mov     cbits,r0
 774:         mov     cbits+2,r1
 775:         ashc    (sp),r0
 776:         bmi     0f
 777:         clr     (sp)
 778: 0:
 779:         mov     (sp)+,r0
 780: 8:
 781:         tst     raw1
 782:         bne     6f
 783:         cmp     r0,$004
 784:         beq     4b
 785:         tst     copyf
 786:         bne     6f
 787:         cmpb    r0,$011 /tab
 788:         bne     0f
 789:         mov     tabc,rchar
 790:         br      1f
 791: 0:
 792:         cmpb    r0,$001
 793:         bne     6f
 794:         mov     dotc,rchar
 795: 1:
 796:         cmpb    r0,fc
 797:         beq     6f
 798:         cmpb    r0,padc
 799:         beq     6f
 800:         mov     (sp)+,r1
 801:         mov     $tabtab,r0
 802:         inc     nspace
 803: 1:
 804:         tst     (r0)
 805:         jeq     get1
 806:         cmp     column,(r0)+
 807:         bge     1b
 808:         mov     -(r0),nspace
 809:         sub     column,nspace
 810:         jbr     get1
 811: 6:
 812: /get1a:	br	7f
 813:         tst     init
 814:         bne     7f
 815:         tst     r0
 816:         jeq     4b
 817: 7:
 818:         mov     (sp)+,r1
 819:         tst     r0
 820:         rts     pc
 821: cbits: 040743;20 /001,007-012,033 (soh,bel,bs,tab,nl,so,si,esc)
 822: /cbits: 041743;20 /001,006-012,033 (soh,ack,bel,bs,tab,nl,so,si,esc)
 823: 
 824: edone:
 825:         mov     $stk,frame
 826:         clr     ip
 827: done:
 828:         clr     app
 829:         clr     ds
 830:         mov     em,r0
 831:         beq     0f
 832:         clr     em
 833:         mov     pc,donef
 834:         mov     frame,-(sp)
 835:         jsr     pc,cont1
 836:         cmp     (sp)+,frame
 837:         bne     1f
 838: 0:
 839:         tst     nfo
 840:         beq     3f
 841:         clr     op
 842:         clr     mflg
 843:         tst     woff
 844:         beq     0f
 845:         clr     r0
 846:         jsr     pc,wbt
 847: 0:
 848:         clr     pendnf
 849:         tst     pendw
 850:         beq     0f
 851:         clr     *pendw
 852:         clr     pendw
 853: 0:
 854:         cmp     $1,donef
 855:         beq     done1
 856:         mov     $1,donef
 857:         clr     ip
 858:         mov     $ilist,ilistp
 859:         jsr     pc,rbreak
 860:         inc     nflush
 861:         mov     $ilist,r0
 862:         jsr     pc,eject
 863: 1:
 864:         mov     ssp,sp
 865:         jmp     loop
 866: done1:
 867: /	tst	pendb
 868: /	bne	0b
 869:         tst     nl
 870:         beq     1f
 871:         jsr     pc,newline
 872:         br      1b
 873: 1:
 874: 3:
 875: done2:
 876:         jsr     pc,flush
 877: place:
 878:         sys     signal; 2; 1
 879:         tst     quiet
 880:         beq     1f
 881:         bis     $10,ttym
 882:         mov     ttyid,r0
 883:         sys     stty; ttys
 884: 1:
 885:         mov     $1,r0
 886:         jsr     pc,mesg
 887:         mov     outid,r0
 888:         sys     close
 889:         sys     wait
 890:         sys     exit
 891: 
 892: nextfile:
 893:         mov     ifile,r0
 894:         beq     1f
 895:         sys     close
 896: 1:
 897:         tst     nx
 898:         beq     2f
 899:         mov     $nextf,r0
 900:         br      3f
 901: 2:
 902:         cmp     ifp,$ifl
 903:         beq     1f
 904:         jsr     pc,popf
 905:         bne     nextfile
 906:         tst     pc
 907:         rts     pc
 908: 1:
 909:         dec     argc
 910:         blt     4f
 911:         mov     *argp,r0
 912:         add     $2,argp
 913: 3:
 914:         mov     r0,5f
 915:         cmpb    (r0)+,$'-
 916:         bne     0f
 917:         tstb    (r0)
 918:         bne     0f
 919:         clr     r0
 920:         br      1f
 921: 0:
 922:         sys     0;7f
 923: .data
 924: 7:      sys     open; 5:..; 0
 925: .text
 926:         bec     1f
 927:         sub     mflg,nfo
 928:         jgt     done
 929:         jsr     r5,string; omes
 930:         mov     5b,8f
 931:         jmp     7f
 932: .data
 933: 7:      jsr     r5,string; 8:..
 934:         jmp     6f
 935: .text
 936: 6:
 937:         jsr     r5,string; 9f
 938:         jbr     done
 939: 1:
 940:         clr     iline
 941:         inc     nfo
 942:         mov     r0,ifile
 943:         clr     ioff
 944:         rts     pc
 945: 4:
 946:         sub     mflg,nfo
 947:         beq     0f
 948:         tst     stdi
 949:         jeq     done
 950: 0:
 951:         clr     iline
 952:         clr     mflg
 953:         inc     nfo
 954:         clr     stdi
 955:         clr     ifile
 956:         clr     ioff
 957:         rts     pc
 958: omes: <Cannot open: \0>
 959: 9: <\n\0>
 960: .even
 961: 
 962: popf:
 963:         clr     -(sp)
 964:         mov     ifp,r1
 965:         cmp     r1,$ifl
 966:         beq     1f
 967:         sub     $2,ifp
 968:         mov     -(r1),ifile
 969:         mov     [offl-ifl](r1),ioff
 970:         mov     ioff,0f
 971:         bic     $777,0f
 972:         mov     ifile,r0
 973:         beq     4f
 974:         sys     0;7f
 975: .data
 976: 7:      sys     seek; 0:..; 0
 977: .text
 978:         bes     2f
 979:         mov     ifile,r0
 980:         sys     read; ibuf; 512.
 981:         bes     2f
 982:         add     $ibuf,r0
 983:         mov     r0,eibuf
 984:         sub     ioff,0b
 985:         mov     $ibuf,ibufp
 986:         mov     ifile,r0
 987:         jsr     pc,ttyn
 988:         cmpb    r0,$'x
 989:         bne     1f
 990:         sub     0b,ibufp
 991:         cmp     ibufp,eibuf
 992:         blo     1f
 993: 2:
 994:         inc     (sp)
 995: 1:
 996:         tst     (sp)+
 997:         rts     pc
 998: 4:
 999:         jsr     pc,restbuf
1000:         br      1b
1001: 
1002: savebuf:
1003:         mov     $ibuf,r0
1004:         mov     $xbuf,r1
1005:         mov     ibufp,xbufp
1006:         mov     eibuf,xeibuf
1007: 1:
1008:         mov     (r0)+,(r1)+
1009:         cmp     r0,eibuf
1010:         blo     1b
1011:         rts     pc
1012: 
1013: restbuf:
1014:         mov     $xbuf,r0
1015:         mov     $ibuf,r1
1016:         mov     xbufp,ibufp
1017:         mov     xeibuf,eibuf
1018: 1:
1019:         mov     (r0)+,(r1)+
1020:         cmp     r1,eibuf
1021:         blo     1b
1022:         rts     pc
1023: 
1024: putchar:
1025:         bic     $!377,r0
1026:         beq     2f
1027:         tstb    r0
1028:         bmi     pchar2
1029:         cmpb    r0,$013 /\e
1030:         bne     0f
1031:         tst     op
1032:         bne     0f
1033:         movb    eschar,r0
1034:         br      putchar
1035: 0:
1036:         movb    trtab(r0),r0
1037:         cmp     r0,$'
1038:         bne     1f
1039:         inc     nsp
1040: 2:
1041:         rts     pc
1042: 1:
1043:         cmp     r0,$'\n
1044:         bne     1f
1045:         clr     nsp
1046:         clr     ocol
1047:         br      pchar1
1048: 1:
1049:         mov     $011,-(sp)
1050: 1:
1051:         tst     nsp
1052:         beq     2f
1053:         tst     slow
1054:         bne     4f
1055:         tst     op
1056:         bne     4f
1057:         jsr     pc,dsp
1058:         cmp     nsp,r1
1059:         blt     4f
1060:         mov     $011,(sp)
1061:         cmp     r1,$1
1062:         bgt     8f
1063:         mov     $040,(sp)
1064:         dec     nsp
1065:         br      9f
1066: 8:
1067:         sub     r1,nsp
1068: 9:
1069:         mov     r0,-(sp)
1070: 3:
1071:         mov     2(sp),r0
1072:         jsr     pc,pchar1
1073:         mov     (sp)+,r0
1074:         br      1b
1075: 4:
1076:         mov     r0,-(sp)
1077:         mov     $' ,r0
1078:         jsr     pc,pchar1
1079:         mov     (sp)+,r0
1080:         dec     nsp
1081:         bne     4b
1082: 2:
1083:         tst     (sp)+
1084:         cmp     r0,$026
1085:         blt     2f
1086:         cmp     r0,$037
1087:         beq     3f
1088:         bgt     2f
1089:         mov     r0,-(sp)
1090:         jsr     r5, switch; unpfx
1091:         cmp     (sp)+,r0
1092:         beq     2f
1093:         mov     r0,-(sp)
1094:         mov     $033,r0  /prefix
1095:         jsr     pc,pchar1
1096:         dec     ocol
1097:         mov     (sp)+,r0
1098: 2:
1099: pchar1:
1100:         cmp     r0,$011
1101:         bne     1f
1102:         jsr     pc,dsp
1103:         br      2f
1104: 1:
1105:         jsr     pc,width
1106: 2:
1107:         add     r1,ocol
1108: pchar2:
1109:         tst     op
1110:         beq     1f
1111:         mov     op,r1
1112:         jsr     pc,wbf
1113:         mov     r1,op
1114:         br      3f
1115: 1:
1116:         tst     tflg
1117:         bne     1f
1118:         cmp     pn,pfrom
1119:         blt     3f
1120:         clr     pfrom
1121: 1:
1122:         movb    r0,*obufp
1123:         inc     obufp
1124:         cmp     obufp,$obuf+512.
1125:         beq     flush
1126: 3:
1127:         rts     pc
1128: 
1129: dsp:
1130:         clr     r1
1131: 1:
1132:         add     $8.,r1
1133:         cmp     ocol,r1
1134:         bgt     1b
1135:         sub     ocol,r1
1136:         bne     2f
1137:         mov     $8.,r1
1138: 2:
1139:         rts     pc
1140: 
1141: unpfx:
1142:    .byte 032, '9
1143:    .byte 035, '8
1144:    .byte 036, '7
1145:    .byte 031, '3
1146:    .byte 030, '4
1147:    .byte 026, '1
1148:    .byte 027, '2
1149:    .byte 0,0
1150: 
1151: flush:
1152:         mov     obufp,r0
1153:         sub     $obuf,r0
1154:         mov     r0,0f
1155:         mov     outid,r0
1156:         sys     0;7f
1157: .data
1158: 7:      sys     write; obuf; 0:0
1159: .text
1160:         jes     place
1161:         inc     toolate
1162:         mov     $obuf,obufp
1163:         rts     pc
1164: 
1165: rdtty:
1166: /	mov	sp,r1
1167: /	sys	signal; 2; rdtty1
1168:         clr     r0
1169:         sys     read; char; 1
1170:         tst     r0
1171:         bne     2f
1172: rdtty1:
1173: /	mov	r1,sp
1174:         jsr     pc,popi
1175: rdtty2:
1176:         clr     tty
1177:         tst     quiet
1178:         beq     0f
1179:         bis     $10,ttym
1180:         mov     ttyid,r0
1181:         sys     stty; ttys
1182: 0:
1183:         clr     r0
1184: 1:
1185: /	sys	signal; 2; place
1186:         rts pc
1187: 2:
1188:         mov     char,r0
1189:         cmpb    r0,$'\n
1190:         beq     3f
1191:         mov     $1,tty
1192:         br      1b
1193: 3:
1194:         inc     tty
1195:         cmp     tty,$3
1196:         beq     rdtty1
1197:         br      1b
1198: 
1199: ttyn:
1200:         mov     r1,-(sp)
1201:         mov     $'x,-(sp)
1202:         clr     -(sp)
1203:         sys     fstat; ybuf
1204:         bes     3f
1205:         mov     ybuf+2,(sp)
1206:         sys     open; dev; 0
1207:         bes     3f
1208:         mov     r0,r1
1209: 1:
1210:         mov     r1,r0
1211:         sys     read; ybuf; 16.
1212:         bes     2f
1213:         cmp     r0,$16.
1214:         bne     2f
1215:         mov     $ybuf,r0
1216:         cmp     (r0)+,(sp)
1217:         bne     1b
1218:         cmp     (r0)+,$"tt
1219:         bne     1b
1220:         cmpb    (r0)+,$'y
1221:         bne     1b
1222:         tstb    (r0)+
1223:         beq     1b
1224:         cmpb    (r0),$'\0
1225:         bne     1b
1226:         movb    -(r0),2(sp)
1227: 2:
1228:         mov     r1,r0
1229:         sys     close
1230: 3:
1231:         tst     (sp)+
1232:         movb    (sp)+,r0
1233:         mov     (sp)+,r1
1234:         rts     pc
1235: dev:    </dev\0>
1236: .even
1237: 
1238: cont1:
1239:         mov     r0,-(sp)
1240:         mov     pc,r2
1241:         br      0f
1242: control:
1243:         jsr     pc,getchar
1244:         mov     r0,-(sp)
1245:         jsr     pc,getchar
1246:         cmpb    r0,$'\n
1247:         beq     8f
1248:         cmpb    r0,$' /
1249:         bne     9f
1250: 8:
1251:         mov     r0,ch
1252:         clr     r0
1253: 9:
1254:         swab    r0
1255:         bis     (sp),r0
1256:         clr     r2
1257: 0:
1258:         mov     $contab,r1
1259: 1:
1260:         mov     (r1)+,(sp)
1261:         bic     $100000,(sp)
1262:         cmp     r0,(sp)
1263:         bne     4f
1264:         mov     (r1),(sp)
1265:         tst     -(r1)
1266:         bpl     3f
1267:         clr     *nxf
1268:         tst     r2
1269:         bne     2f
1270:         jsr     pc,collect
1271: 2:
1272:         jsr     pc,flushi
1273:         jsr     pc,pushi
1274:         beq     5f
1275:         mov     (sp),ip
1276:         br      5f
1277: 3:
1278:         jmp     *(sp)+
1279: 4:
1280:         cmp     (r1)+,$-1
1281:         bne     1b
1282: 5:
1283:         tst     (sp)+
1284:         rts     pc
1285: 
1286: .data
1287: contab:
1288: <ad>; casead
1289: <bp>; casebp
1290: <pn>; casepn
1291: <br>; casebr
1292: <cc>; casecc
1293: <c2>; casec2
1294: <ce>; casece
1295: <fi>; casefi
1296: <in>; casein
1297: <li>; caseli
1298: <ll>; casell
1299: <ls>; casels
1300: <ns>; casens
1301: <rs>; casers
1302: <na>; casena
1303: <ne>; casene
1304: <nf>; casenf
1305: <pl>; casepl
1306: <sp>; casesp
1307: <lv>; casesv
1308: <sv>; casesv
1309: <os>; caseos
1310: <ta>; caseta
1311: <ti>; caseti
1312: <tr>; casetr
1313: <ul>; caseul
1314: <tl>; casetl
1315: <lt>; caselt
1316: <hc>; casehc
1317: <hy>; casehy
1318: <nh>; casenh
1319: <nm>; casenm
1320: <np>; casenp
1321: <nn>; casenn
1322: <ar>; casear
1323: <ro>; casero
1324: <RO>; caseroc
1325: <nx>; casenx
1326: <so>; caseso
1327: <po>; casepo
1328: <de>; casede
1329: <ds>; caseds
1330: <am>; caseam
1331: <as>; caseas
1332: <da>; caseda
1333: <di>; casedi
1334: <rm>; caserm
1335: <rn>; casern
1336: <ig>; caseig
1337: <tc>; casetc
1338: <ec>; caseec
1339: <eo>; caseeo
1340: <lc>; caselc
1341: <nc>; casenc
1342: <ev>; caseev
1343: <if>; caseif
1344: <wh>; casewh
1345: <ch>; casech
1346: <rd>; caserd
1347: <tm>; casetm
1348: <nr>; casenr
1349: <mk>; casemk
1350: <rt>; casert
1351: <ab>; casest
1352: <fl>; casefl
1353: <ex>; done
1354: <xh>; casexh
1355: <em>; caseem
1356: <fc>; casefc
1357: <af>; caseaf
1358: <pi>; casepi
1359: <hw>; casehw
1360: bnames: .=.+512.
1361: -1; -1
1362: .text

Defined functions

cbits defined in line 821; used 2 times
cont1 defined in line 1238; used 1 times
control defined in line 1242; used 1 times
dev defined in line 1235; used 1 times
done defined in line 827; used 5 times
done1 defined in line 866; used 1 times
done2 defined in line 875; never used
dsp defined in line 1129; used 2 times
eatps defined in line 619; used 1 times
edone defined in line 824; never used
flush defined in line 1151; used 3 times
flushi defined in line 416; used 3 times
get1 defined in line 696; used 11 times
getch0 defined in line 524; used 2 times
getch1 defined in line 504; used 2 times
getchar defined in line 489; used 7 times
gettchar defined in line 432; used 1 times
loop defined in line 288; used 7 times
mesg defined in line 362; used 2 times
nextfile defined in line 892; used 2 times
omes defined in line 958; used 1 times
pchar1 defined in line 1099; used 4 times
pchar2 defined in line 1108; used 2 times
pfxtab defined in line 666; used 2 times
pfxtab1 defined in line 673; used 1 times
place defined in line 877; used 5 times
popf defined in line 962; used 1 times
putchar defined in line 1024; used 2 times
rdtty defined in line 1165; used 1 times
rdtty1 defined in line 1172; used 1 times
rdtty2 defined in line 1175; never used
restbuf defined in line 1013; used 1 times
rtnch defined in line 483; used 2 times
savebuf defined in line 1002; never used
setsame defined in line 374; used 1 times
signal defined in line 7; used 6 times
string defined in line 383; used 4 times
stringfl defined in line 381; never used
switch defined in line 675; used 3 times
ttyn defined in line 1199; used 3 times
unpfx defined in line 1141; used 1 times

Defined variables

bnames defined in line 1360; never used
contab defined in line 1287; used 1 times
ctime defined in line 218; used 1 times
emes1 defined in line 283; used 1 times
  • in line 15
eschar defined in line 639; used 2 times
esctab defined in line 635; used 1 times
ibuf defined in line 12; used 12 times
makebf defined in line 165; used 1 times
  • in line 53
ms defined in line 258; used 4 times
obuf defined in line 285; used 4 times
pnum defined in line 260; used 3 times
Last modified: 1975-07-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 475
Valid CSS Valid XHTML 1.0 Strict