Git Product home page Git Product logo

x86-to-6502's Introduction

About

Attempts to translate x86 assembly into mos6502 assembly.

Why?

Why not? I figured I just barely knew some x86 and some 6502, so why not learn some more about both. Besides, this project can actually have some interesting applications.

Example

After compilation (requires a full C++14 compiler), you can run something like this:

// test.asm
main:
	movb	$1, 53280
	xorl	%eax, %eax
	ret
cat test.asm | x86-to-6502

And get this output:

main:
	ldy #$1
	sty 53280
	lda $00
	rts 

Caveats

  • Nothing is guaranteed. This could break your computer. Who knows?
  • All values are truncated to 8 bit. We have no support for 16bit math or pointers yet
  • Only as many instructions are supported as I have needed to support to get my test cases working

To Do

Everything

Well, lots of things.

Better code organization

I really had no idea what I was doing when I started this. So, like all code, it's going to need some improvements along the way to make it more organized and more maintainable.

Improvements

  • Keep track of input source lines and add comments in output to show where lines came from, for learning / debugging purposes
  • Better / more efficient translation
  • Support for 16bit math? Maybe? We need to at least be able to do 16bit pointer math
  • Consider supporting the "Sweet 16" virtual 16bit CPU that Woz designed?
  • Maybe for 16bit operation we try to detect if the input code is working on 8bit registers or 16+bit registers and do the right thing?
  • Support for more CPU instructions
  • A test suite

x86-to-6502's People

Contributors

lefticus avatar

Watchers

 avatar  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.