A method for emulating the functionality of VGA hardware, wherein the
emulator program of the present invention maintains a set of tables that
permits the emulator program to branch to a function customized for both
the instruction and the operating mode of the VGA hardware. When the
customized function has already been generated, the emulator will
automatically dispatch directly into the customized function. If an
instruction is executed at a time when the VGA operating mode has
changed, the addresses of the customized functions are loaded from a
second table. If a customized function is not present, a customized
function is generated and the tables are updated to point to the
addresses of the newly created customized function. As the VGA hardware
is switching among operating modes, a customized function is not
generated until such time when an actual instruction is executed for the
VGA hardware.