added emulate.c file