working example

Changed to latest working code by Admin and included emulator.c
Thanks Admin!