Q: Which devices can I add to openMSX? A: There are 4 kind of devices that you can add to openMSX * Memmory mapped devices * I/O port based devices * Connector based devices (joystick/printerport) * A combination of the 3 forms of above Q: How do I add a memmory mapped device? A: Inherrit from the class MSXMemDevice and implement the methods readMem and writeMem. Don't forget to use the getReadCacheLine and getWriteCacheLine if possible to gain a lot of performance. Example: MSXSimple64KB.cc Q: I need a device with a ROM in it. This must be something verry common. Is there a simpler method? A: If it is to implement a rom you can inherit from MSXRom which has a method loadFile that will do all the needed filehandling to read a romfile into memmory. Also there is a Patch interface for Roms so that you can patch eg bioscalls in the rom file to be redirected to your own bioshandler. Example: MSXRom16KB.cc Q: How do I add an I/O port device? A: Inherrit from the class MSXIODevice, and register the needed in- and out-ports with MSXMotherBoard Example: MSXE6Timer.cc Q: How do I add a connector based device? A: If you want to make a brand new connector type, you must inherit specific connector and pluggable types from the class Connector and Pluggable. Example: MSXPrinterPort.cc A: If you just want to make a new device that plugs into an existing connector (JoystickPort, PrinterPort, ...), you must inherit from the specific Pluggable (JoystickDevice, PrinterPortDevice, ...) Example: PrinterPortLogger.cc Q: What is this EmuTime thing? A: Every device that is timesensitive has it own emutime object. During the creation of the MSXDevice the internal emutime is set to the time of instantiation (typically zero at boot). Each device can calculate T-states in its own "native" time (The Z80 in 3.5MHz, the VDP in 21 Mhz,...) The emutime object is the way to compare the time between two devices. The emutime will internally correct for the possible different between the native frequencies. The distance function getTicksTill() and getTicksTillUp() can be used to find out how many native ticks are needed to catchup with an other device. Example: MSXE6Timer.cc Q: My device has to perform some action at a later time. Can my device be notified when this time has come? A: Use scheduler->setSyncPoint(T,D) to register the MSXDevice to be called at a certain time T. When the time is arrived device D will be called by its method executeUntilEmuTime. Example: sound/Y8950Timer.cc Q: How can a device generate IRQs? A: The class MSXCPU offers two methods raiseIRQ() and lowerIRQ(). However direct use of these methods is not recommended. Instead use the methods offered by the class IRQHelper. Example: VDP.cc Q: How do I compile a version with certain features not compiled in? A: ./configure --help shows which parts you can disable, for example --disable-SCC will configure openmsx for compiling without SCC code. Q: How do I make a part of openMSX optional for compilation? A: 1) add an section for your part to m4/enables.m4 2) add your new macro to configure.in in the enables section 3) run ./autogen.sh : your disable option is now available in ./configure --help 4) modify the devicefactory or other factory where the part is allocated to not create the part if not needed, for examples see devicefactory.cc 5) modify the part by including config.h and enclosing both header and code file in #ifndef #endif, for example see src/sound/SCC.hh and src/sound/SCC.cc 6) make sure all still compiles and runs both with and without your new option by compiling 2 times, once with, and once without ;-) You might need to disable/enable some parts in config files. For a more complex example, take a look at FMPAC and MSXMUSIC, since they both share the same chip. TODO Q: How do I write my own sound device? Q: How do I read data from a config file? Q: How do I make a config part that is not device related? Q: How do I make a custom XML config part?