Make HDRM simulator usable in the QEMU emulator

Migrate most code out of the .ino file and into .h and .c files.