1
0
mirror of https://github.com/lefticus/6502-cpp.git synced 2024-11-01 05:05:23 +00:00
Go to file
2021-05-11 10:43:39 -06:00
cmake Some reorg and start to move to ctre 2021-05-06 21:43:03 -06:00
examples Add additional example 2021-05-09 08:39:55 -06:00
include Fix handling of sbc/sub and enable parsing of -fverbose-asm 2021-05-09 17:31:44 -06:00
src Disable a fixup, which might not be necessary now 2021-05-11 09:18:03 -06:00
test change name to 6502-c++ and merge in files from cpp_starter_project 2021-05-06 14:04:59 -06:00
.clang-format Start to cleanup layout and code 2021-05-06 17:50:36 -06:00
.clang-tidy Some code organization and splitting up 2021-05-06 23:11:12 -06:00
.cmake-format.yaml change name to 6502-c++ and merge in files from cpp_starter_project 2021-05-06 14:04:59 -06:00
CMakeLists.txt change name to 6502-c++ and merge in files from cpp_starter_project 2021-05-06 14:04:59 -06:00
compile.sh Better stack handling. We now require -mtiny-stack from GCC 2021-05-08 22:59:35 -06:00
LICENSE change name to 6502-c++ and merge in files from cpp_starter_project 2021-05-06 14:04:59 -06:00
make_file.sh Reorganize file structure 2016-08-24 16:55:08 -06:00
readme.md Add some docs and test and cmake support 2016-07-07 15:48:27 -06:00

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