PROC dum$ASTI asti (
  xasid : integer -281474976710655..281474976710655 = $required
  ptl   : integer -281474976710655..281474976710655 = 0
  xasti : VAR of integer
  )

  crev a_mult k=integer
  crev a_divisor k=integer
  crev bits k=integer d=0..15
  bits(0) = 0
  bits(1) = 8
  bits(2) = 4
  bits(3) = 12
  bits(4) = 2
  bits(5) = 10
  bits(6) = 6
  bits(7) = 14
  bits(8) = 1
  bits(9) = 9
  bits(10) = 5
  bits(11) = 13
  bits(12) = 3
  bits(13) = 11
  bits(14) = 7
  bits(15) = 15
  if ptl > 0 then
    crev (ptl2 asid) k=integer
    ptl2 = $value(ptl) + 1
    a_divisor = 256 / ptl2
    a_mult = 10000(16) / a_divisor
  else
    a_divisor = $mem($sa(mmv$a_divisor) 3)
    a_mult = $mem($sa(mmv$a_mult) 3)
  ifend
  asid = $value(xasid)
  asid = asid / a_mult + $mod(asid, a_mult) * a_divisor
  asti = bits($mod(asid, 16))*4096
  asti = bits($mod((asid/16), 16))*256+asti
  asti = bits($mod((asid/256), 16))*16+asti
  asti = bits($mod((asid/4096), 16))+asti
  if not $specified(xasti) then
    putl ' ASTI = '//$strrep(asti, 16)
  else
    xasti = asti
  ifend
PROCEND dum$asti
