Look at Kalandra. That might give you a basic idea on making an emulator.
i dd and im learning paschel right now