1: / 2: / 3: 4: / a7 -- pdp-11 assembler 5: 6: expres: 7: clr xsymbol 8: expres1: 9: mov r5,-(sp) 10: mov $'+,-(sp) 11: clr r2 12: mov $1,r3 13: br 1f 14: advanc: 15: jsr pc,readop 16: 1: 17: mov r4,r0 18: jsr r5,betwen; 0; 177 19: br .+4 20: br 7f 21: movb (r4),r0 22: tst r0 23: bne 1f 24: tstb passno 25: beq 1f 26: jsr r5,error; 'u 27: 1: 28: tst overlaid 29: beq 0f 30: / 31: / Bill Shannon's hack to the assembler to force globl text 32: / references to remain undefined so that the link editor may 33: / resolve them. This is necessary if a function is used as an 34: / arg in an overlay located piece of code, and the function is 35: / actually in another overlay. Elsewise, the assembler fix's up 36: / the reference before the link editor changes the globl refrence 37: / to the thunk. -wfj 5/80 38: cmp r0,$42 / is it globl text ? 39: bne 0f / nope 40: mov $40,r0 / yes, treat it as undefined external 41: 0: 42: cmp r0,$40 43: bne 1f 44: mov r4,xsymbol 45: clr r1 46: br oprand 47: 1: 48: mov 2(r4),r1 49: br oprand 50: 7: 51: cmp r4,$141 52: blo 1f 53: asl r4 54: mov curfb-[2*141](r4),r0 55: mov 2(r0),r1 56: movb (r0),r0 57: br oprand 58: 1: 59: mov $esw1,r1 60: 1: 61: cmp (r1)+,r4 62: beq 1f 63: tst (r1)+ 64: bne 1b 65: tst (sp)+ 66: mov (sp)+,r5 67: rts pc 68: 1: 69: jmp *(r1) 70: 71: esw1: 72: '+; binop 73: '-; binop 74: '*; binop 75: '/; binop 76: '&; binop 77: 037; binop 78: 035; binop 79: 036; binop 80: '%; binop 81: '[; brack 82: '^; binop 83: 1; exnum 84: 2; exnum1 85: '!; binop 86: 200; 0 87: 88: binop: 89: cmpb (sp),$'+ 90: beq 1f 91: jsr pc,errore 92: 1: 93: movb r4,(sp) 94: br advanc 95: 96: exnum1: 97: mov numval,r1 98: br 1f 99: 100: exnum: 101: jsr pc,getw 102: mov r4,r1 103: 1: 104: mov $1,r0 105: br oprand 106: 107: brack: 108: mov r2,-(sp) 109: mov r3,-(sp) 110: jsr pc,readop 111: jsr pc,expres1 112: cmp r4,$'] 113: beq 1f 114: jsr r5,error; '] 115: 1: 116: mov r3,r0 117: mov r2,r1 118: mov (sp)+,r3 119: mov (sp)+,r2 120: 121: oprand: 122: mov $exsw2,r5 123: 1: 124: cmp (sp),(r5)+ 125: beq 1f 126: tst (r5)+ 127: bne 1b 128: br eoprnd 129: 1: 130: jmp *(r5) 131: 132: exsw2: 133: '+; exadd 134: '-; exsub 135: '*; exmul 136: '/; exdiv 137: 037; exor 138: '&; exand 139: 035;exlsh 140: 036;exrsh 141: '%; exmod 142: '^; excmbin 143: '!; exnot 144: 200; 0 145: 146: excmbin: 147: mov r0,r3 148: br eoprnd 149: 150: exrsh: 151: neg r1 152: beq exlsh 153: inc r1 154: clc 155: ror r2 156: exlsh: 157: jsr r5,combin; relte2 158: als r1,r2 159: br eoprnd 160: 161: exmod: 162: jsr r5,combin; relte2 163: mov r3,r0 164: mov r2,r3 165: clr r2 166: dvd r1,r2 167: mov r3,r2 168: mov r0,r3 169: br eoprnd 170: 171: exadd: 172: jsr r5,combin; reltp2 173: add r1,r2 174: br eoprnd 175: 176: exsub: 177: jsr r5,combin; reltm2 178: sub r1,r2 179: br eoprnd 180: 181: exand: 182: jsr r5,combin; relte2 183: com r1 184: bic r1,r2 185: br eoprnd 186: 187: exor: 188: jsr r5,combin; relte2 189: bis r1,r2 190: br eoprnd 191: 192: exmul: 193: jsr r5,combin; relte2 194: mpy r2,r1 195: mov r1,r2 196: br eoprnd 197: 198: exdiv: 199: jsr r5,combin; relte2 200: mov r3,r0 201: mov r2,r3 202: clr r2 203: dvd r1,r2 204: mov r0,r3 205: br eoprnd 206: 207: exnot: 208: jsr r5,combin; relte2 209: com r1 210: add r1,r2 211: br eoprnd 212: 213: eoprnd: 214: mov $'+,(sp) 215: jmp advanc 216: 217: combin: 218: tstb passno 219: bne combin1 220: mov r0,-(sp) 221: bis r3,(sp) 222: bic $!40,(sp) 223: bic $!37,r0 224: bic $!37,r3 225: cmp r0,r3 226: ble 1f 227: mov r0,-(sp) 228: mov r3,r0 229: mov (sp)+,r3 230: 1: 231: tst r0 232: beq 1f 233: cmp (r5)+,$reltm2 234: bne 2f 235: cmp r0,r3 236: bne 2f 237: mov $1,r3 238: br 2f 239: 1: 240: tst (r5)+ 241: clr r3 242: 2: 243: bis (sp)+,r3 244: rts r5 245: combin1: 246: mov r1,-(sp) 247: clr maxtyp 248: jsr pc,maprel 249: mov r0,r1 250: mpy $6,r1 251: mov r3,r0 252: jsr pc,maprel 253: add (r5)+,r0 254: add r1,r0 255: movb (r0),r3 256: bpl 1f 257: cmp r3,$-1 258: beq 2f 259: jsr r5,error; 'r 260: 2: 261: mov maxtyp,r3 262: 1: 263: mov (sp)+,r1 264: rts r5 265: 266: maprel: 267: cmp r0,$40 268: bne 1f 269: mov $5,r0 270: rts pc 271: 1: 272: bic $!37,r0 273: cmp r0,maxtyp 274: blos 1f 275: mov r0,maxtyp 276: 1: 277: cmp r0,$5 278: blo 1f 279: mov $1,r0 280: 1: 281: rts pc 282: 283: X = -2 284: M = -1 285: reltp2: 286: .byte 0, 0, 0, 0, 0, 0 287: .byte 0, M, 2, 3, 4,40 288: .byte 0, 2, X, X, X, X 289: .byte 0, 3, X, X, X, X 290: .byte 0, 4, X, X, X, X 291: .byte 0,40, X, X, X, X 292: 293: reltm2: 294: .byte 0, 0, 0, 0, 0, 0 295: .byte 0, M, 2, 3, 4,40 296: .byte 0, X, 1, X, X, X 297: .byte 0, X, X, 1, X, X 298: .byte 0, X, X, X, 1, X 299: .byte 0, X, X, X, X, X 300: 301: relte2: 302: .byte 0, 0, 0, 0, 0, 0 303: .byte 0, M, X, X, X, X 304: .byte 0, X, X, X, X, X 305: .byte 0, X, X, X, X, X 306: .byte 0, X, X, X, X, X 307: .byte 0, X, X, X, X, X