Not all dimensions are possible
Listing 1 calls the set_gfx_mode function passing the mode parameter that produces the 400x400-pixel window shown in Figure 1.
It is not possible to create windows for all combinations of width and height.
Some values for width and height result in runtime errors.
I'm not certain how to determine which dimensions are allowable and which dimensions are not allowable short of experimentation.