private void generatePlasma()
        {
#if !CODEGEN
            PlasmaProxy.Memory.position = PlasmaProxy.generatePlasma(DefaultWidth, DefaultHeight);
#endif
            Plasma.generatePlasma(DefaultWidth, DefaultHeight);
        }
        private void enterFrame2()
        {
            var shift = getTimer() / 10;

            Buffer.@lock();

            if (RenderMode % 3 == 0)
            {
#if !CODEGEN
                PlasmaProxy.Memory.position = PlasmaProxy.shiftPlasma(shift);

                // -- Alchemy palette shifting
                //alchemyMemory.position = plasmaLib.ToFunc<int, uint>("shiftPlasma")(shift);
                // -- write the ByteArray straight to the bitmap data
                Buffer.setPixels(Buffer.rect, PlasmaProxy.Memory);
#endif
            }
            else
            {
                Plasma.shiftPlasma(shift);

                if (RenderMode % 3 == 1)
                {
                    var m = new ByteArray();
                    foreach (var i in Plasma.newPlasma)
                    {
                        m.writeUnsignedInt(i);
                    }
                    m.position = 0;
                    Buffer.setPixels(Buffer.rect, m);
                }
                else
                {
                    // -- AS3.0 palette shifting
                    for (var x = 0; x < DefaultWidth; x++)
                    {
                        for (var y = 0; y < DefaultHeight; y++)
                        {
                            //bmd.setPixel(x, y, 0xff00ff00);
                            //uint c = palette[(plasma[x][y] + shift) % 256];


                            Buffer.setPixel(x, y, Plasma.newPlasma[x + y * DefaultWidth] | 0xff000000u);
                        }
                    }
                }
            }

            Buffer.unlock();
        }