Since emulating a CPU is a fairly memory intensive thing to do, it's unlikely that the Z-80 emulator code will require any reworking to fit your needs. There is an option you need to set, though. Two files are included to handle I/O instructions. io_mem.c implements a 256 byte RAM on the I/O space. io_ask.c prompts the console for input and prints output writes. You also have a couple choices for main(): debug.c is a debugger. dumbrun.c pre-loads either a binary file or a HEX file into Z-80 memory and jumps to the first byte. io_ask.o is the recommended I/O here, otherwise there will be no way to see any results of running your program. upm.c implements CP/M on top of the emulator. See README.upm There are two things to know before starting: The math operations assume that "!=" "returns" 0 or 1. A bad assumption, to be sure. If this assumption is not true for your compiler, find all occurances of "alu_" in the code and examine them. Some compilers have trouble dealing with signed chars. This causes the JR code some grief. If this is a problem, change the define for DO_JR in z80.h as necessary.