Giter VIP home page Giter VIP logo

6502emulator's Introduction

6502Emulator

Learning how a CPU works by emulating one.

This code was written during the youtube video : https://youtu.be/qJgsuQoy9bc

11/2020 NOTES / TODO

  • All 6502 legal opcodes emulated
  • Decimal mode is not handled
  • Test program /Klaus2m5/6502_65C02_functional_tests - will succeed if decimal is disabled.
  • Counting cycles individually for each part of an instruction is cumbersome and probably should just deduct the correct number at the end of the instruction.
  • There is no way to issue and interrupt to this virtual CPU
  • There are no hooks for debugging.
  • There is is no dissasembler or UI, this is just the CPU emulator & units test.
  • There are no asserts if you write memory outside of the bounds (it will overwrite memory)
  • Illegal opcodes are not implemented, the program will throw an exception.

Issues

  • Does the BRK command break when interrupts are disabled? that needs testing.
  • PLP clears the break flag when executed? is this correct?
  • INS_JMP_ABS, see notes about bug in 6502 for correct emulation

What did we learn from this?

  • A program is just big array bytes
  • Writing a CPU emulator is time consuming
  • Some features are undocumented!
  • Emulating a CPU is harder you than you think, because you have emulate things you got for free in a real CPU (like the clock)
  • Writing Unit tests for the CPU was a good idea.
  • Big switch state works for small instruction set processors, probably not for bigger ones, like the 68000.

6502emulator's People

Contributors

davepoo avatar

Watchers

 avatar

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.