-
Notifications
You must be signed in to change notification settings - Fork 21
/
README
84 lines (60 loc) · 2.93 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
____ ______ ______ ____
/ _/_/\ __/_/\ __ \ /\_, \
/\ __ \ \___ \ \ \/\ \\// /__
\ \_____\/\____/\ \_____\/\_____\
MOS \/_____/\/___/ \/_____/\/_____/ CPU Emulator v0.1
Copyright (C) 1999-2018 Manuel Sainz de Baranda y Goñi <[email protected]>
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 <http://zeta.st>, 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=<configuration>] [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 <emulation/CPU/6502.h>.
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.