GitXplorerGitXplorer
S

lib6502

public
10 stars
11 forks
1 issues

Commits

List of commits on branch master.
Verified
f8ab5a5bae8a90c1ae527401e8310e0f51a8dc5c

Merge pull request #3 from brucehoult/performance_counters

SShonFrazier committed 2 years ago
Unverified
493a993fd13aef8c01cb055abffd5e3b08b7bd87

Add -c option that prints total instructions and cycles

bbrucehoult committed 2 years ago
Unverified
be7320c5487a10317eb7a8f4f79fea49d7e1c89a

Fix M6502_step to externalise registers after the step

bbrucehoult committed 2 years ago
Unverified
9511cc514b0aae6bde8eb3283bd01fe77dc4503b

Fix emulator exit from xTrap and osword callbacks to use longjmp

bbrucehoult committed 2 years ago
Unverified
264e28554ee4c5ad63adcef7010d0b568e4a7cf1

Aesthetic change

SShonFrazier committed 9 years ago
Unverified
74bc1224f6e8c0f2d527b0e78a935371c56c33ad

finalize tick support

SShonFrazier committed 9 years ago

README

The README file for this repository.
	lib6502 - 6502 Microprocessor Emulator

		Version: 1.0

WHAT IF I'M TOO LAZY TO READ 'README'S?

make
make install
more examples/README

WHAT IS LIB6502?

lib6502 is a library that emulates the 6502 microprocessor. It comes with a small 'shell', run6502, that can execute 6502 programs from the command line.

lib6502 is distributed under the MIT license: it is non-infectious and will not make your projects contagious to others the instant you choose to use lib6502 in them. See the file COPYING for details.

WHERE IS THE LATEST SOURCE CODE?

Source code for lib6502 is available from the author's home page at 'http://piumarta.com/software'. You can download the most recent release or use Subversion to get the very latest sources.

WHERE IS THE DOCUMENTATION?

Manual pages for run6502 and lib6502 (and all the functions it exports) should be available once it is installed. Each includes a short 'examples' section. Use the 'man' command to read them.

Your best place to start looking for documentation on the 6502 itself is 'http://6502.org'. A google search of the web will also turn up vast quantities of information about (and programs for) the 6502.

HOW DO I INSTALL IT?

It's not really big enough to warrant the whole 'configure' thing. Any system with an ANSI compiler and C library should be able to compile it out of the box. After unpacking the archive, just type:

make

to build it. If the compiler blows up immediately, edit the Makefile and play with the '-g' and '-O' flags and then try again. If you really can't make the compiler happy you've found a bug (read the next section but one). Otherwise, if you want it put it somewhere more permanent then type:

make install

(as root) to install it. It goes into /usr/local by default; if you want it elsewhere then set PREFIX in the make command. For example:

make install PREFIX=/usr

will put everything under '/usr'.

When you get bored with it, go back to the source directory and type:

make uninstall

(with the same PREFIX you specified during the install, if necessary.)

WHAT CAN I DO WITH IT?

See the file EXAMPLES for some suggestions (all of them polite).

If that leaves you wanting more, read the source for run6502 -- it exercises just about every feature in lib6502.

HOW DO I REPORT PROBLEMS?

Send e-mail to the author at: firstName (at) lastName (dot) com

(For suitable values of firstName and lastName, see the last section of this file.)

If you're still confused, contact him at: http://piumarta.com

HOW CAN I HELP?

Use it. Find bugs. Fix bugs. Make it faster. Evangelism: spread it to as many other projects as possible, especially those that might be using a slower emulator! Read the manual pages to see what's considered missing, then add it, then send it in.

(One thing that would be be really handy, and isn't mentioned in the manual pages, is a test suite. Figure out how to test every mode in every instruction with every possible combination of operand values and condition codes and verify the behaviour is correct. Then write it down in the form of a program and send it in. If it's a self-contained program that runs once to completion then we can probably find some real hardware to test against the test suite.)

If you know how to write software that emulates peripheral hardware devices, google up some details on the popular 6502-based microcomputers (Acorn, Commodore, etc.) and add some serious system emulation to run6502. Make it all pluggable (think dynamic libraries over an 'agnostic' core), so we can change machines at the flip of a (command-line) switch. (The callback mechanism in lib6502 was designed with this kind of 'pluggable hardware emulation' in mind.)

WHO WROTE THIS STUFF, AND WHY?

lib6502 was written by Ian Piumarta.

While writing ccg (an entirely different project that creates runtime assemblers for dynamic code generators) he decided to include support for an 8-bit microprocessor, just for fun. He chose the 6502 because it was used in the first computer he owned and programmed (an Ohio Scientific Superboard II, when he was 14) as well as the second (an Acorn 'BBC Model B', about four years later). lib6502 started as a 'glorified switch statement' that ran some small test programs spewed into memory by ccg, but rapidly got out of control over the course of a weekend. You're looking at the result.