Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large refactor and added features #9

Open
robindegen opened this issue Oct 2, 2018 · 0 comments
Open

Large refactor and added features #9

robindegen opened this issue Oct 2, 2018 · 0 comments

Comments

@robindegen
Copy link
Contributor

robindegen commented Oct 2, 2018

Hey Jason,

I've begun a large refactor using these original sources to build something a little more expandable and maintainable (although I must say the code was still a breeze to work with even in this state!)

I've currently done the following:

  • Cleanup everything from main into seperate files
  • Abstracted away the translation code for the 6502, which means that in theory another CPU like the z80 could be added.
  • Added some more opcodes like being able to call functions from existing assembly (through the cdecl calling convention), which paves the way for 16bit math (which should really not be inlined)
  • Began work on unit tests (using google test)
  • Added initial support for custom interrupt vectors for IRQ and NMI. Having a cdecl void named irq or nmi will generate this code as an interrupt, also generating a rti instruction instead of rts.
  • Fixed some minor bugs
    • Parse error when running on clang on windows (unindented directive line)
    • Parse error when some instructions are generated with a comment behind it (fixed regex)
    • Changed optimization to O2, since O3 wants to unroll loops which seems like a really bad idea (why was it O3?)
  • Added CI jobs on travis-ci (clang) and appveyor (vs2017)
  • Added support for the SP/ESP registers (untested on commodore, I've picked 2 seemingly? free addresses from the zero page)
  • Replaced register numbers with a proper enum containing all supported i386 registers (readability)
  • Added some godbolt example config and script which can be used to plug it straight into godbolt without needing additional changes. The only limitation here is that additional arguments given in the browser are ignored at the moment

If you're interrested, perhaps we should discuss the way forward to get things in sync. I've spend a few afternoons tinkering with it, but I'm sure it can be improved and I'd love to hear your ideas.

Check it out at https://github.com/robindegen/x86-to-6502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant