GithubHelp home page GithubHelp logo

6809 / mc6809 Goto Github PK

View Code? Open in Web Editor NEW
32.0 32.0 6.0 1.48 MB

Implementation of the MC6809 CPU in Python (Extracted from https://github.com/jedie/DragonPy project)

License: GNU General Public License v3.0

Python 78.70% HTML 21.30%
cpu emulator mc6809 python

mc6809's People

Contributors

dependabot[bot] avatar ghewgill avatar jedie avatar jtauber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mc6809's Issues

RuntimeError: Wrong PC ??? when using a speed limited CPU

Hi, I am not sure this qualifies as an issue. I would generally put this in a discussion tab but there does not seem to be one for this repository. Anyway, I am trying to execute the following code on an instance of the class CPUSpeedLimit:

self.cpu.memory.load(0x100, bytearray([
    # A = atoi(*(0x1000)) + atoi(*(0x1001)):
    0xB6, 0x10, 0x00,   # LDA       (extended)      0x1000
    0x80, 0x30,         # SUBA      (immediate)     0x30 (48 in base 10)
    0xF6, 0x10, 0x01,   # LDB       (extended)      0x1001
    0xC0, 0x30,         # SUBB      (immediate)     0x30 (48 in base 10)
    0xF7, 0x10, 0x02,   # STB       (extended)      0x1002
    0xBB, 0x10, 0x02    # ADDA      (extended)      0x1002
]))

self.cpu.program_counter.set(0x100)

self.cpu.run(target_cycles_per_sec=1)

But upon running it, I get the following error:
File "MC6809/MC6809/components/mc6809_base.py", line 787, in instruction_NEG_memory raise RuntimeError("Wrong PC ???") RuntimeError: Wrong PC ???
I am not sure about what causes this error. Again, I apologize if it is the wrong place to ask but I did not really know where to put my message. Thanks in advance.

Invalid carry flag after DAA

Steps to reproduce:

Assemble and run the following code:

LDA #$91
ADD #$91
DAA

What happened?

Carry was reset.

When similar code was used for multi-byte decimal addition, it yielded incorrect results.

What was expected?

Carry should be set. DAA keeps the carry flag set if it was set beforehand, see the mc6809 emulator sources for comparison: https://github.com/spc476/mc6809/blob/master/mc6809.c#L420 or the official Programming Manual: https://archive.org/details/bitsavers_motorola68_13419254/page/n83/mode/2up

C โ€“ Set if a carry is generated or if the carry bit was set before the operation; cleared otherwise.

After some research, I noticed that this is a common bug in many 6809 emulators.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.