1: / 2: / 3: 4: / roff4 -- runoff 5: 6: text: 7: / inc tottext 8: clr ulstate 9: clr wch 10: clr wne 11: tst ce 12: bne nofill 13: tst fi 14: beq nofill 15: jsr pc,getchar 16: 2: 17: mov r0,ch 18: cmp $' ,r0 19: bne 2f 20: jsr pc,rbreak 21: 1: 22: jsr pc,getchar 23: cmp $' ,r0 24: bne 2b 25: inc un 26: br 1b 27: 2: 28: cmp r0,$'\n 29: bne 2f 30: jsr pc,rbreak 31: clr ch 32: jsr pc,nline 33: br 4f 34: 2: 35: tst wch 36: bne 3f 37: jsr pc,getword 38: br 4f 39: 3: 40: jsr pc,movword 41: bne 2b 42: jsr pc,adjust 43: br 2b 44: 4: 45: dec ul 46: bge 1f 47: clr ul 48: 1: 49: rts pc 50: 51: nofill: 52: jsr pc,rbreak 53: 1: 54: jsr pc,gettchar 55: cmp r0,$'\n 56: beq 1f 57: jsr pc,width 58: add r1,ne 59: jsr pc,storeline 60: br 1b 61: 1: 62: tst ce 63: ble 2f 64: dec ce 65: mov nel,r0 66: asr r0 67: bpl 1f 68: clr r0 69: 1: 70: add r0,un 71: tst numbmod 72: beq 2f 73: add $2,un 74: 2: 75: clr fac 76: clr fmq 77: mov $1000,nwd 78: mov $' ,r0 79: jsr pc,storeline 80: jsr pc,rbreak 81: dec ul 82: bpl 2f 83: clr ul 84: 2: 85: rts pc 86: 87: adjust: 88: mov r2,-(sp) 89: mov r3,-(sp) 90: clr r2 91: clr r3 92: tst ad 93: beq 1f 94: mov nwd,r0 95: dec r0 96: ble 1f 97: mov nel,r3 98: ble 1f 99: dvd r0,r2 100: 1: 101: mov r3,fac 102: mov r2,fmq 103: mov (sp)+,r3 104: mov (sp)+,r2 105: jsr pc,rbreak 106: rts pc 107: 108: fill: 109: mov fmq,r0 110: 1: 111: inc r0 112: dec nc 113: cmpb (r2)+,$' 114: beq 1b 115: dec r2 116: bit $1,totout 117: beq 2f 118: inc fac 119: cmp fac,nwd 120: blt 1f 121: inc r0 122: br 1f 123: 2: 124: dec fac 125: bmi 1f 126: inc r0 127: 1: 128: jsr pc,space 129: movb (r2),r0 130: rts pc 131: 132: movword: 133: mov wch,wordend 134: mov wordp,r4 135: add r4,wordend 136: tst nwd 137: bne 2f 138: 1: 139: movb (r4)+,r0 140: cmp r0,$' 141: bne 1f 142: dec wch 143: jsr pc,width 144: sub r1,wne 145: br 1b 146: 1: 147: dec r4 148: 2: 149: cmp wne,nel 150: ble 1f 151: cmp nel,$4 152: ble 1f 153: mov ls,r0 154: add nl,r0 155: cmp r0,bl 156: bgt 2f 157: mov ls,r0 158: asl r0 159: add nl,r0 160: cmp r0,bl 161: bgt 1f 162: 2: 163: jsr pc,hyphen 164: 1: 165: clr nhyph 166: mov wch,-(sp) 167: 1: 168: movb (r4)+,r0 169: cmp r0,$'- 170: bne 2f 171: movb (r4),r2 172: jsr pc,alph2 173: bne 2f 174: bisb $200,(r4) 175: 2: 176: tst r0 177: bpl 2f 178: bic $!177,r0 179: mov r4,r3 180: sub $4,r3 181: cmp r3,$word 182: blo 2f 183: movb (r3),r2 184: bic $!177,r2 185: jsr pc,alph2 186: beq 3f 187: cmp nel,$2 188: ble 2f 189: 3: 190: mov r0,-(sp) 191: clr r0 192: jsr pc,storeline 193: mov (sp)+,r0 194: inc nhyph 195: 2: 196: jsr pc,width 197: sub r1,wne 198: jsr pc,storeline 199: dec wch 200: bne 1b 201: tst nel 202: blt 1f 203: inc nwd 204: tst (sp)+ 205: clz 206: rts pc 207: 1: 208: mov linep,r3 209: 1: 210: tst nhyph 211: bne 2f 212: tst nwd 213: beq 3f 214: cmp wch,(sp) 215: beq 4f 216: 2: 217: movb -(r3),r0 218: bne 2f 219: dec nhyph 220: bne 5f 221: tst nwd 222: beq 6f 223: 5: 224: tst nel 225: ble 2f 226: 6: 227: cmpb -1(r3),$'- 228: beq 3f 229: movb $'-,(r3) 230: dec nel 231: inc ne 232: br 3f 233: 2: 234: dec nc 235: tstb (r3) 236: beq 1b 237: jsr pc,width 238: sub r1,ne 239: add r1,nel 240: inc wch 241: dec r4 242: add r1,wne 243: br 1b 244: 3: 245: inc nwd 246: 4: 247: mov r4,wordp 248: bicb $!177,(r4) 249: cmp r4,$word 250: bge 4f 251: 4 252: 4: 253: tst (sp)+ 254: sez 255: rts pc 256: 257: topbot: 258: mov pl,r0 259: bne 1f 260: clr bl 261: rts pc 262: 1: 263: sub ma3,r0 264: sub ma4,r0 265: sub hx,r0 266: mov r0,bl 267: mov ma1,r0 268: add ma2,r0 269: add hx,r0 270: cmp r0,bl 271: blt 1f 272: mov $2,r0 273: mov r0,ma1 274: mov r0,ma2 275: mov r0,ma3 276: mov r0,ma4 277: mov $66.,pl 278: br topbot 279: 1: 280: cmp nl,bl 281: ble 1f 282: mov bl,nl 283: 1: 284: rts pc 285: 286: width: 287: cmp r0,ohc 288: beq 2f 289: tst r0 290: beq 2f 291: cmp r0,$0177 292: beq 2f 293: cmp r0,$010 294: bne 1f 295: mov $-1,r1 296: rts pc 297: 1: 298: cmp $' ,r0 299: bgt 2f 300: mov $1,r1 301: rts pc 302: 2: 303: clr r1 304: rts pc 305: 306: headin: 307: jsr pc,skipcont 308: mov nextb,r1 309: mov r1,*(r5)+ 310: jsr pc,gettchar 311: cmp r0,$'\n 312: beq 2f 313: mov r0,r2 314: 1: 315: jsr pc,gettchar 316: cmp r0,$'\n 317: beq 2f 318: cmp r0,r2 319: bne 3f 320: clr r0 321: 3: 322: jsr pc,wbf 323: br 1b 324: 2: 325: clr r0 326: jsr pc,wbf 327: mov r1,nextb 328: mov ll,llh 329: rts r5 330: 331: headout: 332: tst hx 333: bne 0f 334: tst (r5)+ 335: rts r5 336: 0: 337: clr -(sp) 338: mov *(r5),r2 339: mov ibf1,nfile 340: jsr r5,headseg; width 341: mov r0,-(sp) 342: jsr r5,headseg; width 343: mov r0,-(sp) 344: jsr r5,headseg; width 345: mov r0,-(sp) 346: mov po,r0 347: jsr pc,space 348: tst numbmod 349: beq 1f 350: mov $5,r0 351: add ni,r0 352: mov r0,6(sp) 353: 1: 354: mov *(r5)+,r2 355: jsr r5,headseg; putchar 356: mov llh,r0 357: add 6(sp),r0 358: sub 2(sp),r0 359: asr r0 360: sub 4(sp),r0 361: bge 1f 362: clr r0 363: 1: 364: mov r0,-(sp) 365: jsr pc,space 366: jsr r5,headseg; putchar 367: mov llh,r0 368: sub (sp)+,r0 369: sub (sp)+,r0 370: sub (sp)+,r0 371: sub (sp)+,r0 372: add (sp)+,r0 373: jsr pc,space 374: jsr r5,headseg; putchar 375: jsr pc,newline 376: rts r5 377: 378: headseg: 379: clr -(sp) 380: 1: 381: mov r1,-(sp) 382: mov r2,r1 383: inc r2 384: jsr pc,rdsufb 385: mov (sp)+,r1 386: tstb r0 387: beq 1f 388: cmp r0,$'% 389: beq 2f 390: jsr pc,*(r5) 391: add r1,(sp) 392: br 1b 393: 2: 394: mov pn,r0 395: clr r1 396: tst ro 397: beq 2f 398: mov $ones,onesp 399: mov $fives,fivesp 400: jsr pc,roman 401: add r1,(sp) 402: br 1b 403: 2: 404: jsr pc,decml 405: add r1,(sp) 406: br 1b 407: 1: 408: mov (sp)+,r0 409: tst (r5)+ 410: rts r5 411: 412: space: 413: jsr r5,nlines; putchar 414: rts pc 415: 416: nlines: 417: mov r0,-(sp) 418: 1: 419: dec (sp) 420: blt 1f 421: mov $' ,r0 422: jsr pc,*(r5) 423: br 1b 424: 1: 425: cmp (r5)+,(sp)+ 426: rts r5 427: 428: decimal: 429: jsr pc,decml 430: tst (r5)+ 431: rts r5 432: 433: decml: 434: mov r2,-(sp) 435: mov r3,-(sp) 436: jsr pc,decml1 437: mov (sp)+,r3 438: mov (sp)+,r2 439: rts pc 440: 441: decml1: 442: mov r1,-(sp) 443: clr r2 444: mov r0,r3 445: dvd $10.,r2 446: mov r3,-(sp) 447: mov r2,r0 448: beq 1f 449: jsr pc,decml 450: mov r1,2(sp) 451: 1: 452: mov (sp)+,r0 453: add $'0,r0 454: jsr pc,*(r5) 455: add (sp)+,r1 456: rts pc 457: 458: roman: 459: mov r2,-(sp) 460: mov r3,-(sp) 461: jsr pc,roman1 462: mov (sp)+,r3 463: mov (sp)+,r2 464: rts pc 465: roman1: 466: clr r2 467: mov r0,r3 468: bne .+4 469: rts pc 470: mov r1,-(sp) 471: dvd $10.,r2 472: mov r3,-(sp) 473: mov r2,r0 474: inc onesp 475: inc fivesp 476: jsr pc,roman 477: mov r1,2(sp) 478: dec onesp 479: dec fivesp 480: clr r2 481: mov (sp)+,r3 482: dvd $5.,r2 483: cmp r3,$4 484: bne 1f 485: movb *onesp,r0 486: jsr pc,*(r5) 487: add r1,(sp) 488: tst r2 489: beq 2f 490: inc onesp 491: movb *onesp,r0 492: dec onesp 493: br 3f 494: 2: 495: movb *fivesp,r0 496: 3: 497: jsr pc,*(r5) 498: add (sp)+,r1 499: rts pc 500: 1: 501: tst r2 502: beq 2f 503: movb *fivesp,r0 504: jsr pc,*(r5) 505: add r1,(sp) 506: 2: 507: dec r3 508: blt 1f 509: movb *onesp,r0 510: jsr pc,*(r5) 511: add r1,(sp) 512: br 2b 513: 1: 514: mov (sp)+,r1 515: rts pc