public void GetPIOReference(ref PIOReferenceVariable pio, IntExpression port)
 {
     //ugh.. fix this type system disaster
       var f=FuncBuilder.Instance;
       using(f.OpenScope("GetPIORef")) {
     var temp=f.Declare.Int("temp");
     InvokeResult(19, temp, port);
     Assignment.AssignAny(pio, temp); //escape from the type system
       }
 }
 public static void GetPIOAndBitmask(this MethodDispatchTablePointer md, IntExpression pin, ref PIOReferenceVariable pio, ref IntVariable bitmask)
 {
     md.GetPIOReference(ref pio, pin.ShiftRight(5)); // pin/32
       bitmask.Value=((IntExpression)1).ShiftLeft(pin&0x1f); // 1<<(pin%32)
 }
 public FastOutputPort(PIOReferenceVariable pio, IntVariable bitmask)
 {
     this.pio=pio;
       this.bitmask=bitmask;
 }