I can not compile it because I don''t have VC.NET and when I try to compile it with VC6 it''s a real mess, so I gave up. But apart from syntax errors (errare humanun est!) this code should at least compile. Then it should work except you probably have to take care of fog and/or color sum stage. I don''t know if I''ve been clear about that point. Feel free to ask for explanations if I didn''t.
About initialization, first of all you should know that fragment shaders are not compiled into display list but can be bound like textures and created like display lists. That is, you should "compile" the shader once (just like you "compile" a display list once) and then "bind" it at every frame (just like you "bind" a texture every frame).
For instance, in the initialization part, there could be :
fragmentshader = glGenFragmentShadersATI(1);glBindFragmentShaderATI(fragmentshader);glBeginFragmentShaderATI();/* write a shader here */glEndFragmentShaderATI();
then each frame you just have to bind that shader :
glBindFragmentShaderATI(fragmentshader);
This idea is very simple.
However, I don''t know if your code is "ready" for that. I think it is, but obviously you know it better than me !