While some people can get tisdcc working in order to assemble C code to z80 asm in the Ti 83/84 format, I cannot. (I have, but I forgot how to do it 10 minutes later.)

My proposed project, which I am now starting, will take a C source file and do its best at converting it to z80 assembly code. I know that it is not possible to have this work completely at all, but I am optimistic that I can get some bare-bones functions in such as setting variables, if/else statements, calls, jumps, and such. I plan on implementing the option to directly insert z80 assembly code and possibly machine code into the C source file itself.

This project is being done in C#. I will post the first working .exe I make!
You could also try the z88dk cross compiler as well?

http://www.z88dk.org/wiki/doku.php?id=platform:ticalc
I have tried z88k before, but it does not seem to work on 64 bit Windows for some reason. I DID get tisdcc working before, but I do remember there was not much I could actually do with it in the way of programming.
Do you know C, z80 ASM, or C#? Not to be a downer, but I think this project is way, way beyond your capabilities. I believe that even AHelper and jacobly are stuck working on a z80 backend for LLVM, and they are both very skilled in C/C++ and z80 Assembly, and extremely knowledgeable about the calculator's architecture.
Although I don't work well with z80 assembly, I do know a bit of C and I am very fluent in C#. I do know that this will be very difficult for me, but I do have some ideas on how to get a working file converter running.
Well, here's what you need to do:
1) Parse the C source code.
2) Generate an AST from the C source code.
3) Emit an intermediate language, or emit directly to z80 ASM.
3a) Perform code block segmentation
3b) Perform register allocation
3c) Emit code blocks
4) Perform optimizations
KermMartian wrote:
Well, here's what you need to do:
1) Parse the C source code.
2) Generate an AST from the C source code.
3) Emit an intermediate language, or emit directly to z80 ASM.
3a) Perform code block segmentation
3b) Perform register allocation
3c) Emit code blocks
4) Perform optimizations

And if you want some semblance of usefulness, you're going to need to also:
5) Implement some subset of the C standard library
6) Implement C-accessible libraries for things like LCD and keyboard I/O

Both of which are not minor undertakings, especially when it comes to things like dynamic memory allocation.

Like Kerm said, you should look into AHelper's and jacobly's work with LLVM and possibly see if you can help. Why reinvent the wheel when the first one isn't even finished yet? Smile
You shouldn't be using tisdcc, but rather sdcc. tisdcc is outdated. For LLVM, jacobly has had the most progress, as I tried to get a z80 target by making the target code from scratch and there is too little documentation available that can't be used to actually make a full target. I struggle with projects where I cannot pull up documentation and am trying to track down what all of the code does. I left it alone.

<edit> I even wrote an article on using SDCC to create programs for GlassOS and TIOS.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement