1: /
   2: /
   3: 
   4: / f36 -- expression code generation
   5: 
   6: .globl  lvalue
   7: .globl  rvalue
   8: .globl  convrt
   9: .globl  type
  10: .globl  funcappl
  11: .globl  name
  12: 
  13: .globl  error
  14: .globl  lookup
  15: .globl  code
  16: .globl  iserror
  17: .globl  genop
  18: .globl  typ
  19: .globl  newline
  20: .globl  functn
  21: .globl  size
  22: 
  23: lvalue:
  24:         jsr     r5,iserror
  25:                 rts r5
  26:         tst     (r2)
  27:         bne     1f
  28:         mov     2(r2),r3
  29:         jsr     r5,code
  30:                 <	lval>; .even
  31:         br      name
  32: 1:
  33:         mov     r2,-(sp)
  34:         cmp     (r2),$32.               / array appl
  35:         bne     1f
  36:         jsr     r5,aryappl
  37:         dec     r0
  38:         bne     2f                      / dim =| 1
  39:         tstb    symtab(r3)
  40:         blt     2f                      / p-bit, not simple
  41:         mov     $"al,r0
  42:         br      simpary
  43: 2:
  44:         jsr     r5,code
  45:                 <	alval\0>; .even
  46: 
  47: arydope:
  48:         jsr     r5,pbit
  49:         mov     symtab+2(r3),r2
  50:         mov     (r2)+,r0
  51:         asl     r0
  52:         add     r0,r2
  53:         mov     (r2),r0
  54:         jsr     r5,code
  55:                 <; d%d\0>; .even
  56:                 r0
  57:         br      2f
  58: 1:
  59:         jsr     r5,error; 54.
  60:         mov     (sp)+,r2
  61:         rts     r5
  62: 
  63: simpary:
  64:         mov     r3,-(sp)
  65:         mov     symtab(r3),r3
  66:         bis     $7,r3
  67:         jsr     r5,genop
  68:         mov     (sp)+,r3
  69:         jsr     r5,size
  70:         jsr     r5,code
  71:                 <; %d.\0>; .even
  72:                 r0
  73:         br      2f
  74: 
  75: name:
  76:         mov     r2,-(sp)
  77:         jsr     r5,pbit
  78: 2:
  79:         jsr     r5,code
  80:                 <; \0>; .even
  81:         bit     $100,symtab(r3)         / common
  82:         beq     1f
  83:         mov     symtab+4(r3),r2
  84:         jsr     r5,code
  85:                 <%n+\0>; .even
  86:                 r2
  87: 1:
  88:         movb    symtab(r3),r2
  89:         bic     $!70,r2
  90:         cmp     r2,$30                  / external
  91:         bne     1f
  92:         jsr     r5,code
  93:                 <%n.\n\0>; .even
  94:                 r3
  95:         br      2f
  96: 1:
  97:         jsr     r5,code
  98:                 <%n_\n\0>; .even
  99:                 r3
 100: 2:
 101:         mov     symtab(r3),r3
 102:         mov     (sp)+,r2
 103:         rts     r5
 104: 
 105: rvalue:
 106:         jsr     r5,iserror
 107:                 rts r5
 108:         mov     r2,-(sp)
 109:         tst     (r2)
 110:         bne     1f
 111:         mov     2(r2),r3
 112:         movb    symtab+1(r3),r2
 113:         jsr     r5,code
 114:                 <	rval%d>; .even
 115:                 r2
 116:         mov     (sp)+,r2
 117:         br      name
 118: 1:
 119:         cmp     (r2),$32.
 120:         bne     1f
 121:         jsr     r5,aryappl
 122:         dec     r0
 123:         bne     3f
 124:         tstb    symtab(r3)
 125:         blt     3f
 126:         mov     $"ar,r0
 127:         br      simpary
 128: 3:
 129:         jsr     r5,code
 130:                 <	arval\0>; .even
 131:         br      arydope
 132: 1:
 133:         cmp     (r2),$34.               / array appl
 134:         bne     1f
 135:         jsr     r5,funcappl
 136:         mov     (sp)+,r2
 137:         mov     2(r2),r3
 138:         movb    symtab+1(r3),r0
 139:         jsr     r5,code
 140:                 <%d.\n\0>; .even
 141:                 r0
 142:         mov     symtab(r3),r3
 143:         rts     r5
 144: 1:
 145:         cmp     (r2),$2
 146:         bne     1f
 147:         movb    3(r2),r3
 148:         mov     4(r2),r2
 149:         jsr     r5,code
 150:                 <	rval%d; c%d\n\0>; .even
 151:                 r3
 152:                 r2
 153:         mov     (sp)+,r2
 154:         mov     2(r2),r3
 155:         rts     r5
 156: 1:
 157:         cmp     (r2),$24.               / arith or relat
 158:         bhi     1f
 159:         mov     2(r2),r2
 160:         bne     3f
 161:         mov     (sp),r2
 162:         sub     $10.,(r2)               / - bin -> - unary
 163:         mov     4(r2),r2
 164:         jsr     r5,rvalue
 165:         br      2f
 166: 3:
 167:         jsr     r5,rvalue
 168:         mov     (sp),r2
 169:         mov     r3,-(sp)
 170:         mov     4(r2),r2
 171:         jsr     r5,type
 172:         cmp     *2(sp),$4                       / **
 173:         bne     3f
 174:         mov     r3,r2
 175:         bic     $!7,r2
 176:         cmp     r2,$1           / ** integer
 177:         bne     3f
 178:         mov     2(sp),r2
 179:         sub     $2,(r2)         / pr -> pi
 180:         mov     4(r2),r2
 181:         jsr     r5,rvalue
 182:         mov     $intcon,r2
 183:         jsr     r5,convrt
 184:         mov     (sp)+,r3
 185:         br      2f
 186: 3:
 187:         mov     (sp),r2
 188:         jsr     pc,maxtyp
 189:         mov     (sp)+,r3
 190:         mov     r2,-(sp)
 191:         jsr     r5,convrt
 192:         mov     2(sp),r2
 193:         mov     4(r2),r2
 194:         jsr     r5,rvalue
 195:         mov     (sp)+,r2
 196:         jsr     r5,convrt
 197:         mov     r2,r3
 198:         br      2f
 199: 1:
 200:         cmp     (r2),$30.               / and or not
 201:         bhi     1f
 202:         mov     2(r2),r2
 203:         beq     3f
 204:         jsr     r5,rvalue
 205:         mov     $logcon,r2
 206:         jsr     r5,convrt
 207: 3:
 208:         mov     (sp),r2
 209:         mov     4(r2),r2
 210:         jsr     r5,rvalue
 211:         mov     $logcon,r2
 212:         jsr     r5,convrt
 213: 2:
 214:         mov     (sp)+,r2
 215:         mov     (r2),r0
 216:         cmp     r0,$4
 217:         bhis    2f
 218:         add     $10.,(r2)               / back to binary
 219:         tst     r0
 220:         beq     2f
 221:         sub     $8,(r2)         / back to pr
 222: 2:
 223:         mov     optab(r0),r0
 224:         jsr     r5,genop
 225:         jsr     r5,newline
 226:         cmp     (r2),$14.               / relat
 227:         blo     2f
 228:         mov     $logcon,r3
 229: 2:
 230:         rts     r5
 231: 1:
 232:         jsr     r5,error; 54.
 233:         mov     (sp)+,r2
 234:         rts     r5
 235: 
 236: pbit:
 237:         tstb    symtab(r3)
 238:         bge     1f
 239:         jsr     r5,code
 240:                 <p\0>
 241: 1:
 242:         rts     r5
 243: 
 244: funcappl:
 245:         mov     r2,-(sp)
 246:         mov     functn,r3
 247:         jsr     r5,code
 248:                 <	stsp; ft+%d.\n\0>; .even
 249:                 r3
 250:         mov     r3,-(sp)
 251:         add     $2,r3
 252:         mov     r3,functn
 253:         clr     -(sp)           / nargs
 254: 1:
 255:         mov     4(r2),r2
 256:         beq     2f
 257:         inc     (sp)
 258:         cmp     (r2),$36.       / ,
 259:         bne     1f
 260:         mov     r2,-(sp)
 261:         mov     2(r2),r2
 262:         mov     6(sp),r3
 263:         jsr     r5,fapp1
 264:         mov     (sp)+,r2
 265:         br      1b
 266: 1:
 267:         mov     4(sp),r3
 268:         jsr     r5,fapp1
 269: 2:
 270:         mov     (sp)+,r0                / nargs
 271:         mov     (sp)+,r2
 272:         mov     (sp)+,r3
 273:         mov     2(r3),r3
 274:         jsr     r5,code
 275:                 <	call\0>; .even
 276:         jsr     r5,pbit
 277:         jsr     r5,code
 278:                 <; %n.; ft+%d.; %d.; \0>; .even
 279:                 r3
 280:                 r2
 281:                 r0
 282:         cmp     functn,functm
 283:         ble     1f
 284:         mov     functn,functm
 285: 1:
 286:         mov     r2,functn
 287:         rts     r5
 288: 
 289: fapp1:
 290:         mov     2(r3),r3                / fetch out function name
 291:         mov     symtab+2(r3),r3         / arg conversion
 292:         bne     2f
 293:         tst     (r2)
 294:         beq     1f
 295:         cmp     (r2),$32.
 296:         beq     4f
 297:         cmp     (r2),$42.               / lv if funct or name or arry app
 298:         beq     1f
 299:         cmp     (r2),$2                 / lv if const
 300:         bne     2f
 301:         mov     4(r2),r3
 302:         jsr     r5,code
 303:                 <	lval; c%d\n\0>
 304:                 r3
 305:         br      3f
 306: 2:
 307:         mov     r3,-(sp)
 308:         jsr     r5,rvalue
 309:         mov     (sp)+,r2
 310:         beq     2f
 311:         jsr     r5,convrt
 312: 2:
 313:         mov     functn,r3
 314:         jsr     r5,code
 315:                 <	stsp; ft+%d.\n\0>; .even
 316:                 r3
 317:         add     $2,functn
 318:         rts     r5
 319: 1:
 320:         clr     (r2)                    / turn func/array names into lvs
 321: 4:
 322:         jsr     r5,lvalue
 323: 3:
 324:         mov     functn,r3
 325:         jsr     r5,code
 326:                 <	stst; ft+%d.\n\0>; .even
 327:                 r3
 328:         add     $2,functn
 329:         rts     r5
 330: 
 331: aryappl:
 332:         mov     r2,-(sp)
 333:         clr     -(sp)           / arg count
 334: 2:
 335:         inc     (sp)
 336:         mov     4(r2),r2
 337:         cmp     (r2),$36.       / ,
 338:         bne     2f
 339:         mov     r2,-(sp)
 340:         mov     2(r2),r2
 341:         jsr     r5,rvalue
 342:         mov     $intcon,r2
 343:         jsr     r5,convrt
 344:         mov     (sp)+,r2
 345:         br      2b
 346: 2:
 347:         jsr     r5,rvalue
 348:         mov     $intcon,r2
 349:         jsr     r5,convrt
 350:         mov     (sp)+,r0
 351:         mov     (sp)+,r2
 352:         mov     2(r2),r3
 353:         cmp     r0,*symtab+2(r3)
 354:         beq     1f
 355:         jsr     r5,error; 53.           / dimension mismatch
 356: 1:
 357:         rts     r5
 358: 
 359: / converts stack from type in r3 to type in r2
 360: convrt:
 361:         mov     r2,-(sp)
 362:         mov     r3,-(sp)
 363:         bic     $![377\<8+7],r2
 364:         bic     $![377\<8+7],r3
 365:         cmp     r2,r3
 366:         beq     1f
 367:         jsr     r5,code
 368:                 <	\0>; .even
 369:         jsr     pc,2f
 370:         mov     r2,r3
 371:         jsr     pc,2f
 372:         jsr     r5,code
 373:                 <\n\0>; .even
 374: 1:
 375:         mov     (sp)+,r3
 376:         mov     (sp)+,r2
 377:         rts     r5
 378: 2:
 379:         mov     r2,-(sp)
 380:         mov     r3,r2
 381:         clrb    r3
 382:         swab    r3
 383:         bic     $!7,r2
 384:         movb    typ(r2),r2
 385:         jsr     r5,code
 386:                 <%c%d\0>; .even
 387:                 r2
 388:                 r3
 389:         mov     (sp)+,r2
 390:         rts     pc
 391: 
 392: type:
 393:         cmp     (r2),$32.
 394:         beq     2f
 395:         cmp     (r2),$34.
 396:         beq     2f
 397:         tst     (r2)
 398:         bne     1f
 399: 2:
 400:         mov     2(r2),r3
 401:         mov     symtab(r3),r3
 402:         rts     r5
 403: 1:
 404:         cmp     (r2),$2
 405:         bne     1f
 406:         mov     2(r2),r3
 407:         rts     r5
 408: 1:
 409:         cmp     (r2),$14.
 410:         blo     1f
 411:         mov     $logcon,r3
 412:         rts     r5
 413: 1:
 414:         mov     r2,-(sp)
 415:         mov     2(r2),r2
 416:         bne     1f
 417:         mov     (sp),r2
 418:         mov     4(r2),r2
 419:         jsr     r5,type
 420:         br      2f
 421: 1:
 422:         jsr     r5,type
 423:         mov     (sp),r2
 424:         mov     r3,-(sp)
 425:         mov     4(r2),r2
 426:         jsr     r5,type
 427:         mov     (sp)+,r2
 428:         jsr     pc,maxtyp
 429:         mov     r2,r3
 430: 2:
 431:         mov     (sp)+,r2
 432:         rts     r5
 433: 
 434: maxtyp:
 435:         mov     r2,r0
 436:         cmp     r2,r3
 437:         bhis    2f
 438:         mov     r3,r2
 439: 2:
 440:         clrb    r2
 441:         bic     $!7,r0
 442:         bic     $!7,r3
 443:         cmp     r0,r3
 444:         bhis    2f
 445:         mov     r3,r0
 446: 2:
 447:         bis     r0,r2
 448:         rts     pc
 449: 
 450: optab:
 451:         <ng>
 452:         <pi>
 453:         <pr>
 454:         <dv>
 455:         <mp>
 456:         <sb>
 457:         <ad>
 458:         <lt>
 459:         <le>
 460:         <eq>
 461:         <ne>
 462:         <gt>
 463:         <ge>
 464:         <nt>
 465:         <an>
 466:         <or>

Defined functions

aryappl defined in line 331; used 2 times
arydope defined in line 47; used 1 times
convrt declared in line 8; defined in line 360; used 19 times
fapp1 defined in line 289; used 2 times
funcappl declared in line 10; defined in line 244; used 4 times
lvalue declared in line 6; defined in line 23; used 11 times
maxtyp defined in line 434; used 2 times
name declared in line 11; defined in line 75; used 5 times
optab defined in line 450; used 1 times
pbit defined in line 236; used 3 times
rvalue declared in line 7; defined in line 105; used 22 times
simpary defined in line 63; used 2 times
type declared in line 9; defined in line 392; used 5 times
Last modified: 1975-07-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 401
Valid CSS Valid XHTML 1.0 Strict