home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / source / fort / fx / fxh.s < prev    next >
Encoding:
Text File  |  1975-07-17  |  1.0 KB  |  78 lines

  1. /
  2. /
  3.  
  4. / fxh -- array constant offset
  5.  
  6. .globl    consub
  7.  
  8. .globl    getsym
  9. .globl    geti
  10. .globl    error
  11. .globl    geticon
  12.  
  13. / turn constant subscripts into offset.
  14. /    in: r3 -> symtab
  15. /        r1 -> just beyond (
  16. /    out:r0 has offset
  17.  
  18. consub:
  19.     mov    symtab(r3),r0
  20.     bic    $!70,r0
  21.     cmp    r0,$20        / test class == array
  22.     beq    1f
  23.     jsr    r5,error; 17.
  24.     clr    r0
  25.     rts    r5
  26. 1:
  27.     mov    r5,-(sp)
  28.     mov    r4,-(sp)
  29.     mov    r3,-(sp)
  30.     mov    r2,-(sp)
  31.     clr    r4        / accumulated offset
  32.     mov    symtab+2(r3),r2    / ptr to declarator
  33.     mov    (r2)+,-(sp)    / dimensionality
  34.     mov    $1,r5        / prod of declarators
  35. 1:
  36.     jsr    r5,geticon
  37.         br 9f
  38.     cmp    r0,(r2)
  39.     bgt    3f
  40.     dec    r0
  41.     bge    2f
  42. 3:
  43.     jsr    r5,error; 19.    / out of range
  44.     clr    r0
  45. 2:
  46.     mov    r5,-(sp)
  47.     mpy    r0,r5
  48.     add    r5,r4
  49.     mov    (sp)+,r5
  50.     mpy    (r2)+,r5
  51.     jsr    r5,getsym
  52.     cmp    r0,$36.        / comma
  53.     bne    1f
  54.     dec    (sp)
  55.     bgt    1b
  56.     jsr    r5,error; 18.    / wrong subscript count
  57.     br    1b
  58. 1:
  59.     cmp    r0,$34.        / )
  60.     beq    1f
  61. 9:
  62.     jsr    r5,error; 20.
  63.     clr    r0
  64. 1:
  65.     cmp    (sp)+,$1
  66.     beq    1f
  67.     jsr    r5,error; 18.    / subscript count
  68. 1:
  69.     mov    (sp)+,r2
  70.     mov    (sp)+,r3
  71.     movb    symtab+1(r3),r5
  72.     mpy    r4,r5
  73.     mov    r5,r0
  74.     mov    (sp)+,r4
  75.     mov    (sp)+,r5
  76.     rts    r5
  77.  
  78.