From 795f8f5d655ff264230efc82ef8b6c44357556b1 Mon Sep 17 00:00:00 2001 From: Jeremy Neiman Date: Tue, 18 Feb 2014 19:44:19 -0500 Subject: [PATCH] Modifying README --- CONTRIBUTING.rst | 6 ------ LICENSE | 17 +++++++++-------- README.rst | 43 ++++++++++++++++++++++++++++++++----------- setup.py | 4 ++-- tests/test_suites.py | 5 ++--- 5 files changed, 45 insertions(+), 30 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 3f274e0..0777009 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -103,9 +103,3 @@ Before you submit a pull request, check that it meets these guidelines: https://travis-ci.org/docmarionum1/py65emu/pull_requests and make sure that the tests pass for all supported Python versions. -Tips ----- - -To run a subset of tests:: - - $ python -m unittest tests.test_py65emu \ No newline at end of file diff --git a/LICENSE b/LICENSE index 22eb723..ad1989f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,12 +1,13 @@ -Copyright (c) 2014, Jeremy Neiman -All rights reserved. + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + Copyright (C) 2004 Sam Hocevar -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -* Neither the name of Python 6502 Emulator nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file + 0. You just DO WHAT THE FUCK YOU WANT TO. \ No newline at end of file diff --git a/README.rst b/README.rst index ee9c791..7d7a50e 100644 --- a/README.rst +++ b/README.rst @@ -2,22 +2,43 @@ Python 6502 Emulator =============================== -.. image:: https://badge.fury.io/py/py65emu.png - :target: http://badge.fury.io/py/py65emu - .. image:: https://travis-ci.org/docmarionum1/py65emu.png?branch=master :target: https://travis-ci.org/docmarionum1/py65emu -.. image:: https://pypip.in/d/py65emu/badge.png - :target: https://crate.io/packages/py65emu?version=latest +A MOS 6502 Emulator intended to be used from within other programs. All opcodes, included the undocumented illegal opcodes are implemented. -A 6502 Emulator +Example Usage::: -* Free software: BSD license -* Documentation: http://py65emu.rtfd.org. + from py65emu.cpu import CPU + from py65emu.mmu import MMU -Features --------- + f = open("program.rom") #Open your rom -* TODO \ No newline at end of file + #define your blocks of memory. Each tuple is + #(start_address, length, readonly=True, initial_value=None, value_offset=0) + m = MMU([ + (0x00, 0x200), #Create RAM with 512 bytes + (0x1000, 0x4000, True, f) #Create ROM starting at 0x1000 with your program. + ]) + + #Create the CPU with the MMU and the starting program counter address + #You can also optionally pass in a value for stack_page, which defaults + #to 1, meaning the stack will be from 0x100-0x1ff. As far as I know this + #is true for all 6502s, but for instance in the 6507 used by the Atari + #2600 it is in the zero page, stack_page=0. + c = CPU(mmu, 0x1000) + + #Do this to execute one instruction + c.step() + + #You can check the registers and memory values to determine what has changed + print c.r.a # A register + print c.r.x # X register + print c.r.y # Y register + print c.r.s # Stack Pointer + print c.r.pc # Program Counter + + print c.r.getFlag('C') #Get the value of a flag from the flag register. + + print mmu.read(0xff) #Read a value from memory diff --git a/setup.py b/setup.py index cdf2dda..895121c 100755 --- a/setup.py +++ b/setup.py @@ -32,13 +32,13 @@ include_package_data=True, install_requires=[ ], - license="BSD", + license="WTFPL", zip_safe=False, keywords='py65emu', classifiers=[ 'Development Status :: 2 - Pre-Alpha', 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', + 'License :: WTFPL', 'Natural Language :: English', "Programming Language :: Python :: 2", 'Programming Language :: Python :: 2.6', diff --git a/tests/test_suites.py b/tests/test_suites.py index 2e368b4..c6d93a0 100644 --- a/tests/test_suites.py +++ b/tests/test_suites.py @@ -30,12 +30,10 @@ def test_nestest(self): (0x2000, 0x8), #PPU (0x4000, 0x18), (0x8000, 0xc000, True, open(f), 0x3ff0) #ROM - #(0xbff0, 0x6010, True, open(f)) #ROM ]) c = CPU(mmu, 0xc000) - - c.r.s = 0xfd + c.r.s = 0xfd #Not sure why the stack starts here. while c.r.pc != 0xc66e: try: @@ -44,6 +42,7 @@ def test_nestest(self): print c.r print traceback.format_exc() raise e + self.assertEqual(c.mmu.read(0x2), 0x00, hex(c.mmu.read(0x2))) self.assertEqual(c.mmu.read(0x3), 0x00, hex(c.mmu.read(0x3)))