____ ______ ______ ____ / _/_/\ __/_/\ __ \ /\_, \ /\ __ \ \___ \ \ \/\ \\// /__ \ \_____\/\____/\ \_____\/\_____\ MOS \/_____/\/___/ \/_____/\/_____/ CPU Emulator v0.1 Copyright (C) 1999-2018 Manuel Sainz de Baranda y Goñi This is a very accurate 6502 emulator that I wrote many years ago. It is fast, small, easy to understand, and the code is commented. Building ======== You must first install Z , a header-only library that provides types and macros. This is the only dependency, the emulator does not use the C standard library or its headers. Then add 6502.h and 6502.c to your project and configure its build system so that CPU_6502_STATIC and CPU_6502_USE_LOCAL_HEADER are predefined when compiling the sources. If you preffer to build the emulator as a library, you can use premake4: $ cd building $ premake4 gmake # generate Makefile $ make help # list available targets $ make [config=] [target] # build the emulator There is also an Xcode project in "development/Xcode" with several targets: 6502 (dynamic) Shared library. 6502 (dynamic module) Shared library with a generic module ABI to be used in modular multi-machine emulators. 6502 (static) Static library. 6502 (static module) Static library with a generic CPU emulator ABI to be used in monolithic multi-machine emulators. Code configuration ================== There are some predefined macros that control the compilation: CPU_6502_DEPENDENCIES_H If defined, it replaces the inclusion of any external header with this one. If you don't want to use Z, you can provide your own header with the types and macros used by the emulator. CPU_6502_HIDE_ABI Makes the generic CPU emulator ABI private. CPU_6502_HIDE_API Makes the public functions private. CPU_6502_STATIC You need to define this to compile or use the emulator as a static library or if you have added 6502.h and 6502.c to your project. CPU_6502_USE_LOCAL_HEADER Use this if you have imported 6502.h and 6502.c to your project. 6502.c will #include "6502.h" instead of . CPU_6502_WITH_ABI Builds the generic CPU emulator ABI and declares its prototype in 6502.h. CPU_6502_WITH_MODULE_ABI Builds the generic module ABI. This macro also enables CPU_6502_WITH_ABI, so the generic CPU emulator ABI will be built too. This option is intended to be used when building a true module loadable at runtime with dlopen(), LoadLibrary() or similar. The ABI module can be accessed via the weak symbol __module_abi__. Use in Proprietary Software =========================== This library is released under the terms of the GNU General Public License v3, but I can license it for non-free/propietary projects if you contact me.