There's a pretty bad problem with that vesa code there that means it won't work properly for everyone.
It assumes that to move down vertically 1 scanline you have to add on screen_width x bytes_per_pixel.
While that's correct for a lot of modes, it's not always right. Sometimes, the card will allocate extra bytes at the end of the scanline that are just wasted and invisible, usually for alignment reasons. eg. on 800x600x16bpp, that would be 1600bytes per scanline, but multiplying by 1600 is difficult so the card might allocate 2048 bytes per scanline instead, wasting 448 bytes. 2048 is 1 Shl 11 which is simple to calculate.
In VESA1 it can be hard to know when this is happening.
Funnily enough the PSP uses this trick, to the programmer the screen is 512 wide, 2 or 4bytes per pixel, even though the LCD is only 480 pixels across.
Another problem is after the early mode numbers, there's no real standards, so for one person 120h might be 1600x1200x16 and for another it might be 320x200x24!
Newer versions of VESA offer ways round these problems, for instance by providing calls for interrogating the card for which modes it can do. That can amount to a lot of work.
I reckon this code should do high colour 640x480 for most people though.
Jim