Omnimaga

Calculator Community => Other Calculators => Topic started by: Ranman on November 19, 2005, 05:33:00 pm

Title: Small C Compiler for TI-83+
Post by: Ranman on November 19, 2005, 05:33:00 pm
Very interesting find on Ticalc... A Small C Compiler for the TI-83+ calcs. This is very cool B)cool.gif

http://www.ticalc.org/archives/files/fileinfo/380/38061.html

Has anyone tried this? If so, does it work well? We may need to think about starting a C programming tutorial topic. I could help.

I work at Lockheed Martin as an embedded software engineer. I program in C all day long (some C++ and ASM). C is a very good language to learn especially if you think you may want to get into embedded or driver programming. When time permits, I would encourage everyone to try this compiler out.
Title: Small C Compiler for TI-83+
Post by: Spellshaper on November 20, 2005, 04:13:00 am
wooohooo! I think I
Title: Small C Compiler for TI-83+
Post by: dragon__lance on November 20, 2005, 08:26:00 am
sweet!! so a new era for the z80 calcs...
Title: Small C Compiler for TI-83+
Post by: DJ Omnimaga on November 20, 2005, 10:07:00 am
wow sound nice, I hope this one produce better code thatn z88dk, I might add it in the archives. I am wonderin if it has tutorial and example to learn C?
Title: Small C Compiler for TI-83+
Post by: MathStuf on November 20, 2005, 11:19:00 am
If you know BASIC, you can convert it to C without too much trouble. That's the wonderful thing about the 68k calcs, mock-up programs in BASIC are easy to convert to TIGCC (like I'm currently doing for parsing dialog strings).
Title: Small C Compiler for TI-83+
Post by: necro on November 20, 2005, 11:30:00 am
This sounds very cool...I guess I will have to try it some time
Title: Small C Compiler for TI-83+
Post by: DJ Omnimaga on November 20, 2005, 12:45:00 pm
at least if it works out well that might open new doors to TI-z80 coding :)smile.gif

I dont have much time to learn a new prgming language, nor to program atm tho
Title: Small C Compiler for TI-83+
Post by: dragon__lance on November 28, 2005, 04:27:00 pm
k, i've got everything needed to install it, but i don't really know how, anyone care to help?(ive decided to try to learn C, not just for calcs, but for comp prgming to, once i'm done with zelda)
Title: Small C Compiler for TI-83+
Post by: Ranman on November 28, 2005, 04:36:00 pm
QuoteBegin-dragon__lance+28 November 2005, 22:27-->
QUOTE (dragon__lance @ 28 November 2005, 22:27)
k, i've got everything needed to install it, but i don't really know how, anyone care to help?(ive decided to try to learn C, not just for calcs, but for comp prgming to, once i'm done with zelda)  

 I have never installed it, so I could not help you with that. However, once you get it up and running, I would be able to give you some advice with the C language..
Title: Small C Compiler for TI-83+
Post by: DJ Omnimaga on November 29, 2005, 03:06:00 am
I am wondering if the syntax is the same than on the comp though, there might be some difference, I hope they arent too big. :(sad.gif
Title: Small C Compiler for TI-83+
Post by: dragon__lance on November 29, 2005, 10:33:00 am
k, it saids that i need to:
- add C:\tisdcc to PATH
   Linux users may make a link in /usr/local/bin to
   /usr/local/share/tisdcc/tisdcc
 - TISDCCDIR=C:\tisdcc
 - TISDCC_CC=cl(Microsoft C Compiler) or gcc(GNU C Compiler and compatible)
ii don't really know how to do this?
Title: Small C Compiler for TI-83+
Post by: Ranman on November 29, 2005, 03:05:00 pm
QuoteBegin-dragon__lance+29 November 2005, 16:33-->
QUOTE (dragon__lance @ 29 November 2005, 16:33)
k, it saids that i need to:
- add C:\tisdcc to PATH
   Linux users may make a link in /usr/local/bin to
   /usr/local/share/tisdcc/tisdcc
 - TISDCCDIR=C:\tisdcc
 - TISDCC_CC=cl(Microsoft C Compiler) or gcc(GNU C Compiler and compatible)
ii don't really know how to do this?  

 Are you installing in Win XP or Linux?
Title: Small C Compiler for TI-83+
Post by: dragon__lance on November 29, 2005, 03:07:00 pm
win xp, i just read on maxcoderz forums that lots of people don't think that C is a good languge for the z80 calcs and is "bloated" and that assembly is much better, cause while z80 uses a 8bit processor. on the 68K, its completely different cause apparently it has a 16bit processor that changes everythin. everyones input?
Title: Small C Compiler for TI-83+
Post by: DJ Omnimaga on November 29, 2005, 03:12:00 pm
well if ppl who said that are ASM programmers themselves its obvious they would say that. A BASIC programmer or a asm newbie wouldnt say that. The best solution is to try it and if its really slow and product huge code then you avoid it
Title: Small C Compiler for TI-83+
Post by: crzyrbl on November 29, 2005, 03:14:00 pm
it might run slower, but i think it should be attempted.  is there an old 8-bit C programming language?
Title: Small C Compiler for TI-83+
Post by: Ranman on November 29, 2005, 03:32:00 pm
ASM - in general, is the fastest and smallest code size.

C - in general, is the next best thing to ASM in terms of speed and size. Depending on how the C compiler is implemented, it can produce large bloated code, or decent code, or somewhere in between. Small C compilers are designed with hardware limited devices in mind, like our calcs. Small C compilers "should" be highly optimized for the platforms they are developed for.

So, I can't tell you how good or bad this new compiler is. You will have to weigh the benefits. C, in general, is easier and faster to code and easier to debug than ASM. But, it is almost guaranteed to be somewhat slower and larger than ASM.

You will have to ask yourself what you are willing to work with. The good thing about C, is that is still a very "used" language today.
Title: Small C Compiler for TI-83+
Post by: Ranman on November 29, 2005, 03:46:00 pm
Sorry for the double post :?confused.gif

QuoteBegin-Ranman+29 November 2005, 21:05-->
QUOTE (Ranman @ 29 November 2005, 21:05)
QuoteBegin-dragon__lance+29 November 2005, 16:33-->
QUOTE (dragon__lance @ 29 November 2005, 16:33)
k, it saids that i need to:
- add C:\tisdcc to PATH
Title: Small C Compiler for TI-83+
Post by: dragon__lance on November 30, 2005, 10:30:00 am
thx ranman, i have the path set now, but when i run it, it still saids i need to set enviornmental variable for TISDCC dir
Title: Small C Compiler for TI-83+
Post by: Ranman on November 30, 2005, 04:36:00 pm
QuoteBegin-dragon__lance+30 November 2005, 16:3-->
QUOTE (dragon__lance @ 30 November 2005, 16:30)
thx ranman, i have the path set now, but when i run it, it still saids i need to set enviornmental variable for TISDCC dir

Try this Dragon_Lance,

Start -> Control Panel -> System

- Click on the Advanced tab
- Click on Environment variables
- Click on New, the following window will come up
user posted image
- Type in the Variable Name - TISDCC_DIR
- Type in the Variable Value - c:\tisdcc
- Click Ok
- Click on New
- Type in the Variable Name - TISDCC_CC
- Type in the Variable Value - cl  (for Microsoft C Compiler)
- or Type in the Variable Value - gcc  (for GNU C Compiler)
- Click Ok, Ok, Ok


Note: the variable value is the path, this can be any directory where tisdcc is installed. This readme file is a little confusing.

Hope this helps! :)smile.gif
Title: Small C Compiler for TI-83+
Post by: dragon__lance on December 01, 2005, 02:20:00 pm
thx so much, now its working perfectly,yay :Dbiggrin.gif
Title: Small C Compiler for TI-83+
Post by: MathStuf on December 04, 2005, 03:29:00 am
C runs just as fast as ASM until the ASM is super-optimized, in which case, the difference is minute. The people on MaxCoderz obviously have not programmed in it and compared it to an ASM program that does the same thing.
Title: Small C Compiler for TI-83+
Post by: DJ Omnimaga on December 04, 2005, 02:51:00 pm
yeah, I assume they want to compare with a C fps, and a ASM fps game with grayscale polygon 3D graphics :S
Title: Small C Compiler for TI-83+
Post by: +ZERO+ on December 12, 2005, 05:34:00 am
@Dragon  Lance: I home you make some awesome games in C...  Maybe you could make like tutorial programs for n00bs, like with EZAsm. >Dgni.gif
Title: Small C Compiler for TI-83+
Post by: necro on December 12, 2005, 07:04:00 am
So, DL...how hard is C to code, and what functions oes it support?
Title: Small C Compiler for TI-83+
Post by: dragon__lance on December 12, 2005, 10:21:00 am
ummm, haven't really started yet, gonna start after zelda. I read some of the tutorial that Ranman recommended, i get C for the comp. But wat are the specifics once u translate to CAlc? btw, i looked at the test demo included with demo in C, it actually looks understandable %)rolleyes2.gif
Title: Small C Compiler for TI-83+
Post by: +ZERO+ on December 13, 2005, 01:45:00 am
I dont mean to be spammy  SPAM SPAM SPAM!!!
But I think another program is worth considering, EZAsm.  I have programmed a pong game in it, in which will be the basis of my next project

GO TI84Silver!!

SPAM!!
Title: Small C Compiler for TI-83+
Post by: Ranman on December 13, 2005, 02:50:00 am
QuoteBegin-dragon__lance+12 December 2005, 16:21-->
QUOTE (dragon__lance @ 12 December 2005, 16:21)
ummm, haven't really started yet, gonna start after zelda. I read some of the tutorial that Ranman recommended, i get C for the comp. But wat are the specifics once u translate to CAlc? btw, i looked at the test demo included with demo in C, it actually looks understandable %)rolleyes2.gif

 I'm glad to see you are looking into this.
Title: Small C Compiler for TI-83+
Post by: saubue on December 13, 2005, 06:30:00 am
If you can program C for a computer, it should be easy to do it for a calc (as long as the differences are explained in the documentation of the compiler, like in TIGCC).
Anyway, you will have to program more carfully. A computer won't claim about a lot of unused variables, arrays that are way bigger than they are needed... the calculator will because of its strongly limited RAM.
Title: Small C Compiler for TI-83+
Post by: dragon__lance on December 13, 2005, 10:25:00 am
no expanation is given, all it saids is it uses SDCC's z80 compiler  :(sad.gif
Title: Small C Compiler for TI-83+
Post by: DJ Omnimaga on December 13, 2005, 10:27:00 am
maybe there is doc about this compiler somewhere
Title: Small C Compiler for TI-83+
Post by: Ranman on December 13, 2005, 02:43:00 pm
QuoteBegin-xlibman+13 December 2005, 16:27-->
QUOTE (xlibman @ 13 December 2005, 16:27)
maybe there is doc about this compiler somewhere  

 http://sdcc.sourceforge.net/

This compiler for Z80 calcs should do all of the necessary things to make an executable for the calc.

It appears that it does not provide full support of the Standard C library. So, some things most C programmers take for granted will not be available. However, you can easily make your own substitute function.
Title: Small C Compiler for TI-83+
Post by: DJ Omnimaga on January 14, 2006, 09:47:00 am
moved
Title: Small C Compiler for TI-83+
Post by: Liazon on January 14, 2006, 04:48:00 pm
If I knew how to make a C compiler, I'd try to improve upon it.  But seeing as I can't master C or z80 ASM, and I possibly never will (see post in Ultima Thread as to why) I don't think I'd ever be able to do that.

What do you mean by standard C functions?  Computer C and high level equivalents?
Title: Small C Compiler for TI-83+
Post by: dragon__lance on January 14, 2006, 04:52:00 pm
but don't give up trying, you'll get there someday... ;)wink.gif

edit: i just browsed through the documentation of SDCC, and it barely even mentions z80. still have no idea of calculater specific stuff.  :dang:banghead.gif
@ranman:when u have some freetime away from Ultima, do u think that u can try to explain to us noobs how SDCC works and the specifics of the z80 processor, (it did mention registers, but that's about all), like buffers,etc...thanks a bunch if you could  >Dgni.gif
Title: Small C Compiler for TI-83+
Post by: Liazon on January 14, 2006, 05:09:00 pm
QuoteBegin-dragon__lance+14 January 2006, 22:52-->
QUOTE (dragon__lance @ 14 January 2006, 22:52)
but don't give up trying, you'll get there someday... ;)wink.gif

edit: i just browsed through the documentation of SDCC, and it barely even mentions z80. still have no idea of calculater specific stuff.  :dang:banghead.gif
@ranman:when u have some freetime away from Ultima, do u think that u can try to explain to us noobs how SDCC works and the specifics of the z80 processor, (it did mention registers, but that's about all), like buffers,etc...thanks a bunch if you could  >Dgni.gif

 Umm... that's like a basic requirement if you want to make good ASM.

I lost my copy of the z80instructionset and specifications in my old computer.  I never got a chance to read it, but it's really not that bad.

I just wish there was more like port documentation

Does anybody know what happened to MC?  I can't find the site anymore.
Title: Small C Compiler for TI-83+
Post by: Ranman on January 14, 2006, 05:16:00 pm
QuoteBegin-dragon__lance+14 January 2006, 22:52-->
QUOTE (dragon__lance @ 14 January 2006, 22:52)
@ranman:when u have some freetime away from Ultima, do u think that u can try to explain to us noobs how SDCC works and the specifics of the z80 processor, (it did mention registers, but that's about all), like buffers,etc...thanks a bunch if you could  >Dgni.gif

 I will sure give it a shot. I'll take a more in-depth look at SDCC and get back with you.

I actually have a Z80 instruction manual lying around here somewhere. Maybe it is time for me to take a look at that too.
Title: Small C Compiler for TI-83+
Post by: dragon__lance on January 14, 2006, 06:06:00 pm
i think Maxcoders domain is renewing its domain, so can't acess it from there. just go to google and type "maxcoderz forums" and it should give you a direct link. and thanks a lot ranman, perhaps if u could get an 83+, you can also code C for z80 :Dbiggrin.gif
Title: Small C Compiler for TI-83+
Post by: DJ Omnimaga on January 15, 2006, 12:46:00 pm
http://joepnet.com/hosted/maxcoderz/phpBB2
Title: Small C Compiler for TI-83+
Post by: koolmansam375 on January 15, 2006, 03:20:00 pm
This looks interesting. I think Ill give it a try (with my limited C/C++ knowledge).
Title: Small C Compiler for TI-83+
Post by: Liazon on January 16, 2006, 04:45:00 am
How exactly do compilers work anyways?  I know they are converting to machine language, but how do you build the compiler if you couldn't compile it in the first place?
Title: Small C Compiler for TI-83+
Post by: Spellshaper on January 16, 2006, 06:03:00 am
hm... maybe build it directly in machine language? %)rolleyes2.gif

well, there has to be a way or we
Title: Small C Compiler for TI-83+
Post by: dragon__lance on January 17, 2006, 02:29:00 pm
hey guys, has anyone tried out the other C compiler that compiles Z80 code, Z88DK ? I was just browsing wikipedia encyclopedia and i came across it.  
Title: Small C Compiler for TI-83+
Post by: DJ Omnimaga on January 17, 2006, 03:19:00 pm
nope never tried it, im heard the code was crappy :(sad.gif

anyone tried API yet?  
Title: Small C Compiler for TI-83+
Post by: Liazon on January 18, 2006, 09:59:00 am
API will bloat your code if you use everything.  Right now, I think I'll just be using API's sprite routines for DEM because it's much easier than trying to make my own that are really slow.

Overall, API is really helpful because it's like additional r0m calls, or xlib functions.

I still haven't really tried it though.
Title: Small C Compiler for TI-83+
Post by: dragon__lance on January 19, 2006, 03:58:00 pm
i tried API, it is AWESOME!!!! especially for noobie asm programmers like us xlibman ;)wink.gif . the big plus i see for it is there is a var.read(x) function and a var.write(x) function. with the use of xlib BASIC programs, u can create an ASM program using API as a helper program, for like quick math and stuff. unfortunantly, experimenting with API, i haven't gotton the normal sprites to work yet :(sad.gif

@liazon: wat would u exactly mean by API bloats ur code. Doesn't API not include the routines u don't use, thus only including useful routines...
Title: Small C Compiler for TI-83+
Post by: Liazon on January 20, 2006, 05:09:00 am
QuoteBegin-Liazon+18 January 2006, 15:59-->
QUOTE (Liazon @ 18 January 2006, 15:59)
API will bloat your code if you use everything.

*points

Come to think of it, all of the routines are a compilation of the best of the best well known routines.  Using it parts of it (not necessarily with macros) will definitely improve anybody's ASM program.  Granted, you will never understand how they work, but it's a lot of good routines.

Most notable routines that I hope to use for DEM:

Sigma's sprite routines; masked, AND, OR, and XOR logic
Jim e's RGP
Title: Small C Compiler for TI-83+
Post by: DJ Omnimaga on January 20, 2006, 02:33:00 pm
i guess the trick is to use as less routines as possible with api, right?
Title: Small C Compiler for TI-83+
Post by: Ranman on January 20, 2006, 02:59:00 pm
QuoteBegin-xlibman+20 January 2006, 20:33-->
QUOTE (xlibman @ 20 January 2006, 20:33)
i guess the trick is to use as less routines as possible with api, right?  

 Well... I guess... use what you need to use.

If you need to use it, then you need to use it. If you don't use it, then you will have to code your own function to do the same thing. If you can make it faster or take less memory... then maybe going with your own function is the better choice. :)smile.gif
Title: Small C Compiler for TI-83+
Post by: Liazon on January 21, 2006, 04:01:00 am
But I can't think of me, an ASM newbie, coding a sprite routine faster than sigma's or Jim e's RGP.

if sigma's routine is faster, why not replace ionPutSprite with it?