I'm not sure if you don't understand what I mean; or if I don't understand what you mean

All I was saying is that
+ if(vpos >= vblank_start && vpos < vga.crtc.vert_total)
+ res = 1;
+ else if(vpos < vblank_end)
+ res = 1;
could be written a bit more clearly (and probably faster, depending on the compiler) by writing it this way:
+ if((vpos >= vblank_start && vpos < vga.crtc.vert_total) || (vpos < vblank_end))
+ res = 1;