Add some docs and test and cmake support

This commit is contained in:
Jason Turner 2016-07-07 15:48:27 -06:00
parent 8a0b8a107d
commit 87f1962f2b
5 changed files with 31 additions and 3 deletions

10
CMakeLists.txt Normal file
View File

@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.5)
project(x86-to-6502)
if(CMAKE_COMPILER_IS_GNUCC)
add_definitions(-Wall -Wextra -Wconversion -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wcast-qual -Wunused -Woverloaded-virtual -pedantic -std=c++14)
endif()
add_executable(x86-to-6502 src/main.cpp)

7
examples/test.asm Normal file
View File

@ -0,0 +1,7 @@
main:
.LFB0:
.cfi_startproc
movb $1, 53280
xorl %eax, %eax
ret

4
examples/test.c Normal file
View File

@ -0,0 +1,4 @@
int main()
{
*((char *)0xd020) = 0x01; // set the border color to white on a c64
}

View File

@ -44,6 +44,13 @@ main:
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?

View File

@ -279,9 +279,9 @@ struct i386 : ASMLine
}
}
i386(const int t_line_num, std::string t_line_text, Type t, std::string opcode, std::string o1="", std::string o2="")
: ASMLine(t, opcode), line_num(t_line_num), line_text(std::move(t_line_text)),
opcode(parse_opcode(t, opcode)), operand1(parse_operand(std::move(o1))), operand2(parse_operand(std::move(o2)))
i386(const int t_line_num, std::string t_line_text, Type t, std::string t_opcode, std::string o1="", std::string o2="")
: ASMLine(t, t_opcode), line_num(t_line_num), line_text(std::move(t_line_text)),
opcode(parse_opcode(t, t_opcode)), operand1(parse_operand(std::move(o1))), operand2(parse_operand(std::move(o2)))
{
}