I think I remember something that compiled c for the calculator does anyone know where it is and more importantly how well it works and how compatible it is with C standards? I have written some small apps on my computer that I want on my calculator that I think would be much more efficient in asm which compiled C would be similar or identical to due to how they work. They use the ability to use char variables as numbers for there operation and efficiency and I don't want to lose that by using if statements with TIBASIC.
http://tigcc.ticalc.org/
Thanks for the link, has anyone tried it though who can let me know if it works well?
[Pre-post edit:] Oh, you mean for 68k? Tigcc works fine- many (maaany) projects are compiled with it (nearly all of them Smile).

If you want to try compiling C on a z80, my advice is 'don't'. It might be faster than TI-BASIC, but the resultant code would be huge and slow (by assembly standards). It's just the reality of attempting to implement C on a small device like the z80, especially when it has so little stack space.

If you really want to give it a try, SDCC is up to the job of generating code. You'll have to figure out some way to link that into a TI program, though.
The Tari wrote:
[Pre-post edit:] Oh, you mean for 68k? Tigcc works fine- many (maaany) projects are compiled with it (nearly all of them Smile).

If you want to try compiling C on a z80, my advice is 'don't'. It might be faster than TI-BASIC, but the resultant code would be huge and slow (by assembly standards). It's just the reality of attempting to implement C on a small device like the z80, especially when it has so little stack space.

If you really want to give it a try, SDCC is up to the job of generating code. You'll have to figure out some way to link that into a TI program, though.


No I meant for the 83+/84 line, I didn't see what that was for at first, I will look at your link, and as I don't know asm I can't write it in asm myself so even that is the fastest I will get not to mention rewriting the several programs in TIBASIC would take a while due to the having to restructure it with the differences in languages.

EDIT: does GCC come with z80 support? I know it comes with support for many small chips like the AVR series?
Stock GCC doesn't target anything smaller than ARM/Blackfin, really. Hence ports like avr-gcc and sdcc for small devices.
Ok, any ideas on how to get it into a ti program file or will I have to look elsewhere?
Glenn wrote:
Ok, any ideas on how to get it into a ti program file or will I have to look elsewhere?
I know that it's been done before, since we had previous arguments about SDCC on this forum, but not having ever attempted to compile z80 for my calculator before, I don't know the method offhand. Sad I wouldn't expect it to be too challenging; you probably just need a little Perl or Python script to do some translation.
KermMartian wrote:
Glenn wrote:
Ok, any ideas on how to get it into a ti program file or will I have to look elsewhere?
I know that it's been done before, since we had previous arguments about SDCC on this forum, but not having ever attempted to compile z80 for my calculator before, I don't know the method offhand. Sad I wouldn't expect it to be too challenging; you probably just need a little Perl or Python script to do some translation.


Translation? I was thinking it was something like getting the right headers on a file so that it would be viewed as a program or so it could be signed as an app, is there something I am missing?
I expect it's easy enough to make it generate a binary which you can run through devpac8x.
The trick will be writing a linker script to give you object code which is aligned to $9D95 with the header tokens in place, that doesn't contain the 0-$9D95 address range.
Quote:

If you really want to give it a try, SDCC is up to the job of generating code. You'll have to figure out some way to link that into a TI program, though.



SDCC is mainly for embedded systems less "complicated" than the calc. You'll definitely run into trouble when creating multipage apps e.a.

Plus, it's far less efficient than good ol' Z80 asm.
Mapar007 wrote:
Quote:

If you really want to give it a try, SDCC is up to the job of generating code. You'll have to figure out some way to link that into a TI program, though.



SDCC is mainly for embedded systems less "complicated" than the calc. You'll definitely run into trouble when creating multipage apps e.a.

Plus, it's far less efficient than good ol' Z80 asm.


I don't think my current uses will require multi page apps and as I don't know z80 asm (or any asm for that matter) I can't make them in asm and I think this will be much more efficient than TIBASIC. I am C files that are all under 4k I believe. Does anyone know how I could do somethink similar to files with SDCC though, some of the programs would be run on the same input or multiple times and I would like to be able to do it without retyping the input as some inputs are quite long.
The Tari wrote:
Stock GCC doesn't target anything smaller than ARM/Blackfin, really. Hence ports like avr-gcc and sdcc for small devices.


Sauce? avr-gcc is not a port of gcc; it's actually a part of gcc (take a look at the list of targets for gcc.)
Ultimate Dev'r wrote:
The Tari wrote:
Stock GCC doesn't target anything smaller than ARM/Blackfin, really. Hence ports like avr-gcc and sdcc for small devices.


Sauce? avr-gcc is not a port of gcc; it's actually a part of gcc (take a look at the list of targets for gcc.)

So it is. SDCC is its own project, though, and that I'm sure of.
I used SDCC just fine. Certainly was nowhere near as good as hand ASM, but a hell of a lot faster than TI-BASIC. I don't remember there being any major difficulties, but I am awesome, so ymmv.

The original version of this: http://www.ticalc.org/archives/files/fileinfo/385/38591.html was written in C using SDCC. So the generated code was ~30% larger, not horrible, but not great either.

That said, you'll still need to know ASM as there aren't any libraries you can call. No printf, etc...
Kllrnohj wrote:
I used SDCC just fine. Certainly was nowhere near as good as hand ASM, but a hell of a lot faster than TI-BASIC. I don't remember there being any major difficulties, but I am awesome, so ymmv.

The original version of this: http://www.ticalc.org/archives/files/fileinfo/385/38591.html was written in C using SDCC. So the generated code was ~30% larger, not horrible, but not great either.

That said, you'll still need to know ASM as there aren't any libraries you can call. No printf, etc...


What is the point of C with no standard libs? If there are none would anyone knowing asm mind helping to create some limited version of the standard C libs? How did you get the compiler output onto the calculator with the linking problem mentioned above, I could use some help here as all of the small devices I have programmed for have had versions of the standard libs albeit with some functionality differences like I think one used serial comm for printf and the like. I could also use some way to either use app vars as files or input and output strings for character array storage between calls. I am definitely out of my depth here in some of this. The only two types of small device I have programmed for so far are the AVR micro controllers and a vex robotics kit if that can even be called programming as while it is C it uses a drag and drop GUI to make it. I have programmed for two different types of AVRs.
Glenn wrote:
What is the point of C with no standard libs?


The standard libs are platform dependent. Nobody has really cared about getting C on the 83/84 series, thus nobody wrote them.

Quote:
If there are none would anyone knowing asm mind helping to create some limited version of the standard C libs?


Just learn Z80 and write it yourself, it isn't that hard, really.

Quote:
How did you get the compiler output onto the calculator with the linking problem mentioned above, I could use some help here as all of the small devices I have programmed for have had versions of the standard libs albeit with some functionality differences like I think one used serial comm for printf and the like.


The "linking problem" mentioned above were just people speculating. I don't remember any linking problems, but I *think* what I did was just used SDCC to compile and then brass or tasm to assemble. Its been like 3 years since I did this.

Quote:
I could also use some way to either use app vars as files or input and output strings for character array storage between calls. I am definitely out of my depth here in some of this. The only two types of small device I have programmed for so far are the AVR micro controllers and a vex robotics kit if that can even be called programming as while it is C it uses a drag and drop GUI to make it. I have programmed for two different types of AVRs.


Bust out the TI Z80 and BCall references and learn how to do it.
Kllrnohj wrote:
Glenn wrote:
What is the point of C with no standard libs?


The standard libs are platform dependent. Nobody has really cared about getting C on the 83/84 series, thus nobody wrote them.

Quote:
If there are none would anyone knowing asm mind helping to create some limited version of the standard C libs?


Just learn Z80 and write it yourself, it isn't that hard, really.

Quote:
How did you get the compiler output onto the calculator with the linking problem mentioned above, I could use some help here as all of the small devices I have programmed for have had versions of the standard libs albeit with some functionality differences like I think one used serial comm for printf and the like.


The "linking problem" mentioned above were just people speculating. I don't remember any linking problems, but I *think* what I did was just used SDCC to compile and then brass or tasm to assemble. Its been like 3 years since I did this.

Quote:
I could also use some way to either use app vars as files or input and output strings for character array storage between calls. I am definitely out of my depth here in some of this. The only two types of small device I have programmed for so far are the AVR micro controllers and a vex robotics kit if that can even be called programming as while it is C it uses a drag and drop GUI to make it. I have programmed for two different types of AVRs.


Bust out the TI Z80 and BCall references and learn how to do it.


I can try to but I will probably need a lot of help, I tried once before and had a very hard time. If I could get some reference links on asm and how to make a library for c that is not written in c that would help a lot. I have never written a c library.
Learn TI-83 Plus Assembly In 28 Days

Get good with ASM first and then try your hand at writing a C library.
Glenn wrote:
I can try to but I will probably need a lot of help, I tried once before and had a very hard time. If I could get some reference links on asm and how to make a library for c that is not written in c that would help a lot. I have never written a c library.


The easiest way to make a library is to just make a regular C library but inline the asm needed, for which you need to refer to SDCC's documentation to figure out how to inline asm.
  
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 2
» 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