I started a project to get a better understanding on how to compile a game for Windows 3.x. I tried to set up the build workflow so that it produce the byte-exact clone of a great open sourced Win16 game named Hyperoid. It took some time to get a working build for Windows 3.0 which I finally managed. However, no matter how I played with the compiler and linker options, I was not able to produce a similar EXE in some aspects.

One of them is related to stack handling. I see it in the disassembly that while the original EXE does push CONSTANT instructions, the rebuilt one usually put the constant to the AX register and does a push ax.


push 02FC
push 0000
push ds


mov ax, 02FC
push ds
push ax
sub ax, ax
push ax

No matter how I played with the CL options, I was not able to change this behavior.

Is there a way to set up the Microsoft C 6.0 compiler to make it prefer constant push instructions over doing the same indirectly using registers?

(More details are in the project link above.)


1 Answer 1


PUSH immediate was introduced in the Intel 80186. The compiler needs to be configured to allow the usage of 186 opcodes with the /G1 option, or any greater value such as /G2 for 286 opcodes.

(These instructions were also implemented in NEC V20/V30 CPUs.)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .