Convert D3_ASM.ASM to C