1: / machine language assist 2: / for 11/45 or 11/70 CPUs 3: 4: .fpp = 1 5: 6: / non-UNIX instructions 7: mfpi = 6500^tst 8: mtpi = 6600^tst 9: mfpd = 106500^tst 10: mtpd = 106600^tst 11: spl = 230 12: ldfps = 170100^tst 13: stfps = 170200^tst 14: wait = 1 15: rtt = 6 16: reset = 5 17: 18: HIPRI = 300 19: HIGH = 6 20: 21: / Mag tape dump 22: / save registers in low core and 23: / write all core onto mag tape. 24: / entry is thru 44 abs 25: 26: .data 27: .globl dump 28: dump: 29: bit $1,SSR0 30: bne dump 31: 32: / save regs r0,r1,r2,r3,r4,r5,r6,KIA6 33: / starting at abs location 4 34: 35: mov r0,4 36: mov $6,r0 37: mov r1,(r0)+ 38: mov r2,(r0)+ 39: mov r3,(r0)+ 40: mov r4,(r0)+ 41: mov r5,(r0)+ 42: mov sp,(r0)+ 43: mov KDSA6,(r0)+ 44: 45: / dump all of core (ie to first mt error) 46: / onto mag tape. (9 track or 7 track 'binary') 47: 48: mov $MTC,r0 49: mov $60004,(r0)+ 50: clr 2(r0) 51: 1: 52: mov $-512.,(r0) 53: inc -(r0) 54: 2: 55: tstb (r0) 56: bge 2b 57: tst (r0)+ 58: bge 1b 59: reset 60: 61: / end of file and loop 62: 63: mov $60007,-(r0) 64: br . 65: 66: .globl start, _end, _edata, _etext, _main 67: 68: / 11/45 and 11/70 startup. 69: / entry is thru 0 abs. 70: / since core is shuffled, 71: / this code can be executed but once 72: 73: start: 74: inc $-1 75: bne . 76: reset 77: clr PS 78: 79: / set KI0 to physical 0 80: 81: mov $77406,r3 82: mov $KISA0,r0 83: mov $KISD0,r1 84: clr (r0)+ 85: mov r3,(r1)+ 86: 87: / set KI1-6 to eventual text resting place 88: 89: mov $_end+63.,r2 90: ash $-6,r2 91: bic $!1777,r2 92: 1: 93: mov r2,(r0)+ 94: mov r3,(r1)+ 95: add $200,r2 96: cmp r0,$KISA7 97: blos 1b 98: 99: / set KI7 to IO seg for escape 100: 101: mov $IO,-(r0) 102: 103: / set KD0-7 to physical 104: 105: mov $KDSA0,r0 106: mov $KDSD0,r1 107: clr r2 108: 1: 109: mov r2,(r0)+ 110: mov r3,(r1)+ 111: add $200,r2 112: cmp r0,$KDSA7 113: blos 1b 114: 115: / initialization 116: / get a temp (1-word) stack 117: / turn on segmentation 118: / copy text to I space 119: / clear bss in D space 120: 121: mov $stk+2,sp 122: mov $65,SSR3 / 22-bit, map, K+U sep 123: bit $20,SSR3 124: beq 1f 125: mov $70.,_cputype 126: 1: 127: inc SSR0 128: mov $_etext,r0 129: mov $_edata,r1 130: add $_etext-8192.,r1 131: 1: 132: mov -(r1),-(sp) 133: mtpi -(r0) 134: cmp r1,$_edata 135: bhi 1b 136: 1: 137: clr (r1)+ 138: cmp r1,$_end 139: blo 1b 140: 141: / use KI escape to set KD7 to IO seg 142: / set KD6 to first available core 143: 144: mov $IO,-(sp) 145: mtpi *$KDSA7 146: mov $_etext-8192.+63.,r2 147: ash $-6,r2 148: bic $!1777,r2 149: add KISA1,r2 150: mov r2,KDSA6 151: 152: / set up supervisor D registers 153: 154: mov $6,SISD0 155: mov $6,SISD1 156: 157: / set up real sp 158: / clear user block 159: 160: mov $_u+[usize*64.],sp 161: mov $_u,r0 162: 1: 163: clr (r0)+ 164: cmp r0,sp 165: blo 1b 166: / jsr pc,_isprof 167: 168: / set up previous mode and call main 169: / on return, enter user mode at 0R 170: 171: mov $30000,PS 172: jsr pc,_main 173: mov $170000,-(sp) 174: clr -(sp) 175: rtt 176: 177: .globl trap, call 178: .globl _trap 179: 180: / all traps and interrupts are 181: / vectored thru this routine. 182: 183: trap: 184: mov PS,saveps 185: tst nofault 186: bne 1f 187: mov SSR0,ssr 188: mov SSR1,ssr+2 189: mov SSR2,ssr+4 190: mov $1,SSR0 191: jsr r0,call1; _trap 192: / no return 193: 1: 194: mov $1,SSR0 195: mov nofault,(sp) 196: rtt 197: .text 198: 199: .globl _runrun, _swtch 200: call1: 201: mov saveps,-(sp) 202: spl 0 203: br 1f 204: 205: call: 206: mov PS,-(sp) 207: 1: 208: mov r1,-(sp) 209: mfpd sp 210: mov 4(sp),-(sp) 211: bic $!37,(sp) 212: bit $30000,PS 213: beq 1f 214: .if .fpp 215: mov $20,_u+4 / FP maint mode 216: .endif 217: jsr pc,*(r0)+ 218: 2: 219: spl HIGH 220: tstb _runrun 221: beq 2f 222: spl 0 223: jsr pc,_savfp 224: jsr pc,_swtch 225: br 2b 226: 2: 227: .if .fpp 228: mov $_u+4,r1 229: bit $20,(r1) 230: bne 2f 231: mov (r1)+,r0 232: ldfps r0 233: movf (r1)+,fr0 234: movf (r1)+,fr1 235: movf fr1,fr4 236: movf (r1)+,fr1 237: movf fr1,fr5 238: movf (r1)+,fr1 239: movf (r1)+,fr2 240: movf (r1)+,fr3 241: ldfps r0 242: 2: 243: .endif 244: tst (sp)+ 245: mtpd sp 246: br 2f 247: 1: 248: bis $30000,PS 249: jsr pc,*(r0)+ 250: cmp (sp)+,(sp)+ 251: 2: 252: mov (sp)+,r1 253: tst (sp)+ 254: mov (sp)+,r0 255: rtt 256: 257: .globl _savfp 258: _savfp: 259: .if .fpp 260: mov $_u+4,r1 261: bit $20,(r1) 262: beq 1f 263: stfps (r1)+ 264: movf fr0,(r1)+ 265: movf fr4,fr0 266: movf fr0,(r1)+ 267: movf fr5,fr0 268: movf fr0,(r1)+ 269: movf fr1,(r1)+ 270: movf fr2,(r1)+ 271: movf fr3,(r1)+ 272: 1: 273: .endif 274: rts pc 275: 276: .globl _incupc 277: _incupc: 278: mov r2,-(sp) 279: mov 6(sp),r2 / base of prof with base,leng,off,scale 280: mov 4(sp),r0 / pc 281: sub 4(r2),r0 / offset 282: clc 283: ror r0 284: mul 6(r2),r0 / scale 285: ashc $-14.,r0 286: inc r1 287: bic $1,r1 288: cmp r1,2(r2) / length 289: bhis 1f 290: add (r2),r1 / base 291: mov nofault,-(sp) 292: mov $2f,nofault 293: mfpd (r1) 294: inc (sp) 295: mtpd (r1) 296: br 3f 297: 2: 298: clr 6(r2) 299: 3: 300: mov (sp)+,nofault 301: 1: 302: mov (sp)+,r2 303: rts pc 304: 305: .globl _display 306: _display: 307: dec dispdly 308: bge 2f 309: clr dispdly 310: mov PS,-(sp) 311: mov $HIPRI,PS 312: mov CSW,r1 313: bit $1,r1 314: beq 1f 315: bis $30000,PS 316: dec r1 317: 1: 318: jsr pc,fuword 319: mov r0,CSW 320: mov (sp)+,PS 321: cmp r0,$-1 322: bne 2f 323: mov $120.,dispdly / 2 sec delay after CSW fault 324: 2: 325: rts pc 326: 327: / Character list get/put 328: 329: .globl _getc, _putc 330: .globl _cfreelist 331: 332: _getc: 333: mov 2(sp),r1 334: mov PS,-(sp) 335: mov r2,-(sp) 336: spl 5 337: mov 2(r1),r2 / first ptr 338: beq 9f / empty 339: movb (r2)+,r0 / character 340: bic $!377,r0 341: mov r2,2(r1) 342: dec (r1)+ / count 343: bne 1f 344: clr (r1)+ 345: clr (r1)+ / last block 346: br 2f 347: 1: 348: bit $7,r2 349: bne 3f 350: mov -10(r2),(r1) / next block 351: add $2,(r1) 352: 2: 353: dec r2 354: bic $7,r2 355: mov _cfreelist,(r2) 356: mov r2,_cfreelist 357: 3: 358: mov (sp)+,r2 359: mov (sp)+,PS 360: rts pc 361: 9: 362: clr 4(r1) 363: mov $-1,r0 364: mov (sp)+,r2 365: mov (sp)+,PS 366: rts pc 367: 368: _putc: 369: mov 2(sp),r0 370: mov 4(sp),r1 371: mov PS,-(sp) 372: mov r2,-(sp) 373: mov r3,-(sp) 374: spl 5 375: mov 4(r1),r2 / last ptr 376: bne 1f 377: mov _cfreelist,r2 378: beq 9f 379: mov (r2),_cfreelist 380: clr (r2)+ 381: mov r2,2(r1) / first ptr 382: br 2f 383: 1: 384: bit $7,r2 385: bne 2f 386: mov _cfreelist,r3 387: beq 9f 388: mov (r3),_cfreelist 389: mov r3,-10(r2) 390: mov r3,r2 391: clr (r2)+ 392: 2: 393: movb r0,(r2)+ 394: mov r2,4(r1) 395: inc (r1) / count 396: clr r0 397: mov (sp)+,r3 398: mov (sp)+,r2 399: mov (sp)+,PS 400: rts pc 401: 9: 402: mov pc,r0 403: mov (sp)+,r3 404: mov (sp)+,r2 405: mov (sp)+,PS 406: rts pc 407: 408: .globl _backup 409: .globl _regloc 410: _backup: 411: mov 2(sp),r0 412: movb ssr+2,r1 413: jsr pc,1f 414: movb ssr+3,r1 415: jsr pc,1f 416: movb _regloc+7,r1 417: asl r1 418: add r0,r1 419: mov ssr+4,(r1) 420: clr r0 421: 2: 422: rts pc 423: 1: 424: mov r1,-(sp) 425: asr (sp) 426: asr (sp) 427: asr (sp) 428: bic $!7,r1 429: movb _regloc(r1),r1 430: asl r1 431: add r0,r1 432: sub (sp)+,(r1) 433: rts pc 434: 435: 436: .globl _fubyte, _subyte 437: .globl _fuword, _suword 438: .globl _fuibyte, _suibyte 439: .globl _fuiword, _suiword 440: _fuibyte: 441: mov 2(sp),r1 442: bic $1,r1 443: jsr pc,giword 444: br 2f 445: 446: _fubyte: 447: mov 2(sp),r1 448: bic $1,r1 449: jsr pc,gword 450: 451: 2: 452: cmp r1,2(sp) 453: beq 1f 454: swab r0 455: 1: 456: bic $!377,r0 457: rts pc 458: 459: _suibyte: 460: mov 2(sp),r1 461: bic $1,r1 462: jsr pc,giword 463: mov r0,-(sp) 464: cmp r1,4(sp) 465: beq 1f 466: movb 6(sp),1(sp) 467: br 2f 468: 1: 469: movb 6(sp),(sp) 470: 2: 471: mov (sp)+,r0 472: jsr pc,piword 473: clr r0 474: rts pc 475: 476: _subyte: 477: mov 2(sp),r1 478: bic $1,r1 479: jsr pc,gword 480: mov r0,-(sp) 481: cmp r1,4(sp) 482: beq 1f 483: movb 6(sp),1(sp) 484: br 2f 485: 1: 486: movb 6(sp),(sp) 487: 2: 488: mov (sp)+,r0 489: jsr pc,pword 490: clr r0 491: rts pc 492: 493: _fuiword: 494: mov 2(sp),r1 495: fuiword: 496: jsr pc,giword 497: rts pc 498: 499: _fuword: 500: mov 2(sp),r1 501: fuword: 502: jsr pc,gword 503: rts pc 504: 505: giword: 506: mov PS,-(sp) 507: spl HIGH 508: mov nofault,-(sp) 509: mov $err,nofault 510: mfpi (r1) 511: mov (sp)+,r0 512: br 1f 513: 514: gword: 515: mov PS,-(sp) 516: spl HIGH 517: mov nofault,-(sp) 518: mov $err,nofault 519: mfpd (r1) 520: mov (sp)+,r0 521: br 1f 522: 523: _suiword: 524: mov 2(sp),r1 525: mov 4(sp),r0 526: suiword: 527: jsr pc,piword 528: rts pc 529: 530: _suword: 531: mov 2(sp),r1 532: mov 4(sp),r0 533: suword: 534: jsr pc,pword 535: rts pc 536: 537: piword: 538: mov PS,-(sp) 539: spl HIGH 540: mov nofault,-(sp) 541: mov $err,nofault 542: mov r0,-(sp) 543: mtpi (r1) 544: br 1f 545: 546: pword: 547: mov PS,-(sp) 548: spl HIGH 549: mov nofault,-(sp) 550: mov $err,nofault 551: mov r0,-(sp) 552: mtpd (r1) 553: 1: 554: mov (sp)+,nofault 555: mov (sp)+,PS 556: rts pc 557: 558: err: 559: mov (sp)+,nofault 560: mov (sp)+,PS 561: tst (sp)+ 562: mov $-1,r0 563: rts pc 564: 565: .globl _copyin, _copyout 566: .globl _copyiin, _copyiout 567: _copyiin: 568: jsr pc,copsu 569: 1: 570: mfpi (r0)+ 571: mov (sp)+,(r1)+ 572: sob r2,1b 573: br 2f 574: 575: _copyin: 576: jsr pc,copsu 577: 1: 578: mfpd (r0)+ 579: mov (sp)+,(r1)+ 580: sob r2,1b 581: br 2f 582: 583: _copyiout: 584: jsr pc,copsu 585: 1: 586: mov (r0)+,-(sp) 587: mtpi (r1)+ 588: sob r2,1b 589: br 2f 590: 591: _copyout: 592: jsr pc,copsu 593: 1: 594: mov (r0)+,-(sp) 595: mtpd (r1)+ 596: sob r2,1b 597: 2: 598: mov (sp)+,nofault 599: mov (sp)+,r2 600: clr r0 601: rts pc 602: 603: copsu: 604: mov (sp)+,r0 605: mov r2,-(sp) 606: mov nofault,-(sp) 607: mov r0,-(sp) 608: mov 10(sp),r0 609: mov 12(sp),r1 610: mov 14(sp),r2 611: asr r2 612: mov $1f,nofault 613: rts pc 614: 615: 1: 616: mov (sp)+,nofault 617: mov (sp)+,r2 618: mov $-1,r0 619: rts pc 620: 621: .globl _idle 622: _idle: 623: mov PS,-(sp) 624: spl 0 625: wait 626: mov (sp)+,PS 627: rts pc 628: 629: .globl _savu, _retu, _aretu 630: _savu: 631: spl HIGH 632: mov (sp)+,r1 633: mov (sp),r0 634: mov sp,(r0)+ 635: mov r5,(r0)+ 636: spl 0 637: jmp (r1) 638: 639: _aretu: 640: spl 7 641: mov (sp)+,r1 642: mov (sp),r0 643: br 1f 644: 645: _retu: 646: spl 7 647: mov (sp)+,r1 648: mov (sp),KDSA6 649: mov $_u,r0 650: 1: 651: mov (r0)+,sp 652: mov (r0)+,r5 653: spl 0 654: jmp (r1) 655: 656: .globl _spl0, _spl1, _spl4, _spl5, _spl6, _spl7 657: _spl0: 658: spl 0 659: rts pc 660: 661: _spl1: 662: spl 1 663: rts pc 664: 665: _spl4: 666: spl 4 667: rts pc 668: 669: _spl5: 670: spl 5 671: rts pc 672: 673: _spl6: 674: spl 6 675: rts pc 676: 677: _spl7: 678: spl HIGH 679: rts pc 680: 681: .globl _copyseg 682: _copyseg: 683: mov PS,-(sp) 684: mov 4(sp),SISA0 685: mov 6(sp),SISA1 686: mov $10000+HIPRI,PS 687: mov r2,-(sp) 688: clr r0 689: mov $8192.,r1 690: mov $32.,r2 691: 1: 692: mfpd (r0)+ 693: mtpd (r1)+ 694: sob r2,1b 695: mov (sp)+,r2 696: mov (sp)+,PS 697: rts pc 698: 699: .globl _clearseg 700: _clearseg: 701: mov PS,-(sp) 702: mov 4(sp),SISA0 703: mov $10000+HIPRI,PS 704: clr r0 705: mov $32.,r1 706: 1: 707: clr -(sp) 708: mtpd (r0)+ 709: sob r1,1b 710: mov (sp)+,PS 711: rts pc 712: 713: .globl _dpadd 714: _dpadd: 715: mov 2(sp),r0 716: add 4(sp),2(r0) 717: adc (r0) 718: rts pc 719: 720: .globl _dpcmp 721: _dpcmp: 722: mov 2(sp),r0 723: mov 4(sp),r1 724: sub 6(sp),r0 725: sub 8(sp),r1 726: sbc r0 727: bge 1f 728: cmp r0,$-1 729: bne 2f 730: cmp r1,$-512. 731: bhi 3f 732: 2: 733: mov $-512.,r0 734: rts pc 735: 1: 736: bne 2f 737: cmp r1,$512. 738: blo 3f 739: 2: 740: mov $512.,r1 741: 3: 742: mov r1,r0 743: rts pc 744: 745: .globl _ldiv 746: _ldiv: 747: clr r0 748: mov 2(sp),r1 749: div 4(sp),r0 750: rts pc 751: 752: .globl _lrem 753: _lrem: 754: clr r0 755: mov 2(sp),r1 756: div 4(sp),r0 757: mov r1,r0 758: rts pc 759: 760: .globl _lshift 761: _lshift: 762: mov 2(sp),r1 763: mov (r1)+,r0 764: mov (r1),r1 765: ashc 4(sp),r0 766: mov r1,r0 767: rts pc 768: 769: .globl csv 770: csv: 771: mov r5,r0 772: mov sp,r5 773: mov r4,-(sp) 774: mov r3,-(sp) 775: mov r2,-(sp) 776: jsr pc,(r0) 777: 778: .globl cret 779: cret: 780: mov r5,r1 781: mov -(r1),r4 782: mov -(r1),r3 783: mov -(r1),r2 784: mov r5,sp 785: mov (sp)+,r5 786: rts pc 787: 788: .globl _u 789: _u = 140000 790: usize = 16. 791: 792: CSW = 177570 793: PS = 177776 794: SSR0 = 177572 795: SSR1 = 177574 796: SSR2 = 177576 797: SSR3 = 172516 798: KISA0 = 172340 799: KISA1 = 172342 800: KISA7 = 172356 801: KISD0 = 172300 802: KDSA0 = 172360 803: KDSA6 = 172374 804: KDSA7 = 172376 805: KDSD0 = 172320 806: MTC = 172522 807: SISA0 = 172240 808: SISA1 = 172242 809: SISD0 = 172200 810: SISD1 = 172202 811: IO = 177600 812: 813: .data 814: .globl _ka6 815: .globl _cputype 816: 817: _ka6: KDSA6 818: _cputype:45. 819: stk: 0 820: 821: .bss 822: .globl nofault, ssr 823: nofault:.=.+2 824: ssr: .=.+6 825: dispdly:.=.+2 826: saveps: .=.+2 827: 828: .text 829: / system profiler 830: / 831: /rtt = 6 832: /CCSB = 172542 833: /CCSR = 172540 834: /PS = 177776 835: / 836: /.globl _sprof, _xprobuf, _probuf, _probsiz, _mode 837: /_probsiz = 7500.+2048. 838: / 839: /_isprof: 840: / mov $_sprof,104 / interrupt 841: / mov $340,106 / pri 842: / mov $100.,CCSB / count set = 100 843: / mov $113,CCSR / count down, 10kHz, repeat 844: / rts pc 845: / 846: /_sprof: 847: / mov r0,-(sp) 848: / mov PS,r0 849: / ash $-11.,r0 850: / bic $!14,r0 851: / add $1,_mode+2(r0) 852: / adc _mode(r0) 853: / cmp r0,$14 / user 854: / beq done 855: / mov 2(sp),r0 / pc 856: / asr r0 857: / asr r0 858: / bic $140001,r0 859: / cmp r0,$_probsiz 860: / blo 1f 861: / inc _outside 862: / br done 863: /1: 864: / inc _probuf(r0) 865: / bne done 866: / mov r1,-(sp) 867: / mov $_xprobuf,r1 868: /2: 869: / cmp (r1)+,r0 870: / bne 3f 871: / inc (r1) 872: / br 4f 873: /3: 874: / tst (r1)+ 875: / bne 2b 876: / sub $4,r1 877: / mov r0,(r1)+ 878: / mov $1,(r1)+ 879: /4: 880: / mov (sp)+,r1 881: /done: 882: / mov (sp)+,r0 883: / mov $113,CCSR 884: / rtt 885: / 886: /.bss 887: /_xprobuf: .=.+512. 888: /_probuf:.=.+_probsiz 889: /_mode: .=.+16. 890: /_outside: .=.+2