ticalc.org
Basics Archives Community Services Programming
Hardware Help About Search Your Account
   Home :: Archives :: News :: Feature: C Programming Editorial

Feature: C Programming Editorial
Posted by Nick on 13 May 2000, 07:06 GMT

Scott Dial of the TCPA (both of which are down because Dim-TI's server is acting up again =[ ) has written our next (belated) feature on C programming on calculators. It's opinionated, so I have to say that Scott's opinions don't reflect my opinion or that of ticalc.org's.


The use of C on a calculator is a horrible waste of space. I love the idea as much as the next guy, but there simply isn't enough space for all the bloated code. GCC doesn't produce the most optimized code by far. *gasp* I understand using it to ruff in some program that you need real quick, but any complex program is going to bloat that much more. I even particurally like the fact that I can port a program for my pc to the 89 relatively easily.

What I can't stand is how many people think that C is so much better than asm... There are some real complex things you can do with C that I would be wary of attempting with ASM, but it still could be done cleaner in ASM. The GCC compiler isn't exactly optimal either. Anyone ever looked at the source (-S) it produces? Who in their right mind would use moveq.l #0,d0 to clear it? It has no clue that there is even a better choice... Or how about it moves values on the local stack that don't even need to be preserved or referenced in that method... movew d0,-2(a6) \ tst.w -2(a6). No one can replace the human mind.

I would hate to see all the programmers of tomorrow using C because it is easier... nothing great is ever easy. C is the lazy mans excuse to not learn to really program the calculator. What's that you say? The AMS was written in C... well yes it was and I hate TI for it. Space is not a luxury on such a small memory capacity. If every new programmer that comes in starts writing everything in C then space becomes even less of a luxury. Long live assembly!

 


The comments below are written by ticalc.org visitors. Their views are not necessarily those of ticalc.org, and ticalc.org takes no responsibility for their content.


Re: Feature: C Programming Editorial
Zeljko Juric  Account Info
(Web Page)

For everybody who like C, I need to tell that the
next release of TI-GCC library (2.0) will be ready during this month (probably release day is 25. May).
Some of new features will include:

- Standard libraries stdlib.h and stdio. (including standard file handling and TTY printing);
- A lot of functions for symbolic mathematics (including calculus etc.) and expressions pretty printing;
- A set of customizable routines for using all text editor facitilities in your programs;
- A set of routines for event driving programming and hooking into the operating system;
- Set of routines for working with archive memory;
- Over 300 new functions in total;
- Much updated documentation.

This release of TIGCCLIB will show the full power of C programming on TI-89.

By the way, I like ASM, but try to make an engineering or calculus program in ASM. Why nearly all ASM programs are games? Because it is too hard to make anything else in ASM...

     13 May 2000, 13:45 GMT

Re: Re: Feature: C Programming Editorial
Mark Leverentz

Allright! I'm looking forward to this next release.

Have you considered moving TI-GCCLib onto SourceForge or anything like that?

     13 May 2000, 17:17 GMT


Re: Re: Re: Feature: C Programming Editorial
Zeljko Juric  Account Info
(Web Page)

Sorry if I am very stupid, but what is SourceForge?

     13 May 2000, 18:12 GMT


Re: Re: Re: Re: Feature: C Programming Editorial
Robin Kay  Account Info
(Web Page)

www.sourceforge.net is a site that hosts opensource projects and gives you things like: web space, a CVS tree, public & private FTP, etc...

     13 May 2000, 20:23 GMT

Re: Re: Feature: C Programming Editorial
JaggedFlame

Sounds great... besides, if the program's small enough, I don't really care if it's in ASM or C. If you made a program that was 500 bytes in C and 300 bytes in ASM, and they were both faster than TI-Basic, most people wouldn't really care about that extra 200 bytes. Then again there's the -O2 switch, which I don't know if the author used or not...

By the way, have you considered making a Windows program (sort of like VC++, but not as feature-packed, if its going to be free) to help people edit and compile C programs for TI-GCC? Or will the SDK have that instead?

     13 May 2000, 17:42 GMT

Re: Re: Re: Feature: C Programming Editorial
Zeljko Juric  Account Info
(Web Page)

As I know, Sebastian Reichelt made an excelent integrated environment for TIGCC...

About SDK: I don't except that SDK will have nothing more than a command line compiler...

     13 May 2000, 18:16 GMT


Re: Re: Re: Re: Feature: C Programming Editorial
Sebastian Reichelt  Account Info

Well, someone seems to think exactly the opposite. Look at the review! My message to the reviewer: What else do you expect from the first version? And, by the way, Version 2.1 has already been uploaded.

     13 May 2000, 18:58 GMT


TI-GCC Programming Environment
HydroCarbon10  Account Info

I would like to note here to everyone who wants a great programming environment for C should use EMACS. As long as you don't need the hierarchial (sp?) class listings that VCC provides, then EMACS serves as a great environment. Its only problem is that its huge.

     13 May 2000, 19:40 GMT

Re: Re: Feature: C Programming Editorial
Paulo Marques  Account Info
(Web Page)

Just to say I love you, man!
On behalf of many people, thank you for your work.

Cd_Slayer

     14 May 2000, 02:53 GMT

Re: Re: Feature: C Programming Editorial
^Andy Account Info
(Web Page)

hey, i just started using tigcc a few days ago and it's the coolest thing ever! :)
btw, will the new version support floating point numbers?

     14 May 2000, 04:12 GMT

Re: Re: Re: Feature: C Programming Editorial
Sebastian Reichelt  Account Info

Download TIGCCLIB v1.5. It has floating point support using the TIOS. It's not the best thing ever, but at least you can use floating point variables. It would be kind of cool if you could use the standard "float," "single," and "double" types, but I think you can't. You should use v1.5 anyways because it's a lot better than v1.1, which comes with TI-GCC. (I know it says it includes v1.5, but I don't think it does.)

     14 May 2000, 07:48 GMT


Re: Re: Re: Feature: C Programming Editorial
Zeljko Juric  Account Info
(Web Page)

Floating point numbers are already supported in TIGCCLIB 1.5, although using non-standard syntax, you need to use a=fadd(b,c) instead of a=b+c, and you need to use a=FLT(3,14) instead of a=3.14. Defining "standard" syntax requires changing of the compiler itself, and I have not enough time to do it. But, I have one note: although TIGCC readme file says that included library is 1.5, this is not true (included library is 1.1). So, YOU NEED TO DOWNLOAD TIGCCLIB 1.5 separately (and one patch/bugfix located in the same directory). But, if you can wait yet one week, download TIGCCLIB 2.0. It surely will be released until the end of this month!

     14 May 2000, 07:51 GMT


Re: Re: Re: Re: Feature: C Programming Editorial
^Andy Account Info
(Web Page)

thanks :))

     14 May 2000, 15:52 GMT

Re: Re: Feature: C Programming Editorial
johnmcd3

Thanks you so much for doing this. This is the most worthwhile project i have seen for the calculator. I am happy you are going to include more math functions in the next vertions. Please don't forget the math as that is what the calcultor is for and i think this has a great deal of potetial. Thanks!

John McDowell

     14 May 2000, 07:56 GMT


Re: Re: Re: Feature: C Programming Editorial
Zeljko Juric  Account Info
(Web Page)

There will be a lot of new math functions, especially for symbolic math (estack.h file has 100 new functions). But, programing of symbolic math requires good knowledge of C programing. After releasing TIGCCLIB 2.0 I will wrote an example program in C using newly implemented functions. This will be step-by-step deriving (e.g. deriving a function with displaying all intermediate steps).

     14 May 2000, 20:33 GMT


Re: Re: Feature: C Programming Editorial
johnmcd3

Oh yeah, one more thing. While it is certianly more important that you work on the program itself, someone should put more examples to look at that would be very helpful.

     14 May 2000, 08:04 GMT


Re: Re: Re: Feature: C Programming Editorial
Paulo Marques  Account Info
(Web Page)

Great idea for someone's project... Maybe I'll start helping in a while too...

Cd_Slayer

     16 May 2000, 00:16 GMT

Re: Feature: C Programming Editorial
Mark Leverentz

Why reinvent the wheel? It is fairly rare that an assembly program will outperform a C program to a degree that a significant number of users would even notice it.

Using C because it is easier is a perfectly valid reason. The simplicity of higher level languages like C allows for better readability, better reuseability, easier to track down bugs, and quicker development time.

     13 May 2000, 17:37 GMT

Re: Re: Feature: C Programming Editorial
Jason Ho  Account Info
(Web Page)

Well said, i totally agree with this

     13 May 2000, 19:24 GMT

Re: Re: Feature: C Programming Editorial
JrJinfinity  Account Info
(Web Page)

Being an asm programmer myself, and knowing a c somewhat, I have to disagree with you.

Re-invent the wheel?, sorry but if I'm not mistaken, C was actually programmed in asm.

Both languages have their purposes, and Asm programs are far more efficient, faster, and if you know the code either can be debugged just as quickly as the other, the same is also true for coding.

Tracking down bugs is just as easy in C as it is in asm using a debugger, actually I think it's easier in Asm cause then you know your stuff.

C outperform asm...Ha, that's why Game Companies program the fancy graphics screens and such in Asm, and not C.

Re-using C code, you must not of heard about the Australian kangaroo combat demo...hehehe

Don't put Asm down just cause you don't fully understand it, it is (with the exception of binary) the granddaddy of all programming languages, and the most powerful language around.

-JrJinfinity

     13 May 2000, 19:48 GMT


Re: Re: Re: Feature: C Programming Editorial
Mark Leverentz

> C outperform asm...

I don't recall ever saying that. I did say that C has other advantages over ASM that make it a better choice for most programs. Please read my post before trying to argue with it.

> Don't put Asm down just cause you don't fully
> understand it

First, I wasn't putting ASM down. I just said that C is often a more practical tool. Second, who are you to say that I don't understand ASM? The truth of the matter is that I do know assembly, but I rarely write code in it because the performance gains you get from ASM are rarely worth the added difficulty and time involved in writing the program.

> it is ... the most powerful language around

Just because it is powerful does not mean that it is always the best choice for developing programs. I highly doubt that any modern Office suite, database, or web server was written entirely in assembly, if they use assembly at all.

> I think it's easier in Asm cause then you know your
> stuff

I think many talented C programmers would be insulted by your claim that ASM programmers know more than C programmers. Many C programmers also know assembly language (myself, for example) but choose not to use it because it is not the best tool for the job. The bigger the project, the harder it is to write it in assembly. Take the example of a web server written in assembly. Could it be done? Of course. Would it be fast and efficient? Most likely. Would it be difficult to track down a bug hiding among the thousands of lines of assembly code? Definately. And that is why programmers opt to use high-level languages such as C.

     13 May 2000, 21:15 GMT

Re: Re: Re: Re: Feature: C Programming Editorial
MathJMendl
(Web Page)

>I highly doubt that any modern Office suite,
>database, or web server was written entirely in
>assembly, if they use assembly at all.

Remember that these are for the computer, whereas ticalc.org is for TI calculator programmers. Computer programs are much bigger and faster than asm programs and asm takes longer to program than C. This is why they use it. Asm is more optimized, faster, and smaller than C (when used well), so for something like a TI calculator, where every few bytes here and there matter and where the processor is slower, asm is much more practical. This is not to say that a C compiler could be used well for the TI, but that it will tend to bloat programs and make them worse than they need to be. Its only advantage for the TI is in time to make the program.

     13 May 2000, 22:16 GMT


Re: Re: Re: Re: Feature: C Programming Editorial
JrJinfinity  Account Info
(Web Page)

>I don't recall ever saying that. I did say that C >has other advantages over ASM that make it a better >choice for most programs. Please read my post before >trying to argue with it.

I read your post, that's exactly what you were implementing whether you were aware of it or not, by stating:

>It is fairly rare that an assembly program will >outperform a C program to a degree that a significant >number of users would even notice it.

The fact of the matter is that assembly programs always outperform C programs, Always.

So you know asm, most people who would say something like that have very limited or No knowledge of assembly.

If they are insulted cause they read it wrong, let them be. What I meant is that if you program in assembly you are more likely to understand output of the Debugging software then if you have no comprehension of assembler since it's often output in hexacode.

>Just because it is powerful does not mean that it is >always the best choice for developing programs. I >highly doubt that any modern Office suite, database, >or web server was written entirely in assembly, if >they use assembly at all.

that is exactly why I stated the first time "Both languages have their purposes", who in their right mind would program such programs for the computer in assembler? We are talking about Calculators here. With limited memory mind you. not computers with x-number of harddrives of unlimited sizes.

     13 May 2000, 22:20 GMT

Re: Re: Re: Re: Re: Feature: C Programming Editorial
Mike Grass Account Info
(Web Page)

>The fact of the matter is that assembly programs
>always outperform C programs, Always.

Hmm, that really depends on what your definition of "performance" is. If you mean that ASM programs will always outperform C programs in terms of speed, then you are correct.

Performance, however, can also mean something explicitly different. Take TI-Chess, for example. I would challenge any asm "guru" to make a chess game half as good as TI-Chess--strictly in asm (and no compiling TI-Chess with the -s option to see the asm source ;). Yes, it is possible, but it is highly unfeasible and would take at least twice as long as it did to develop TI-Chess.

Also, math programs, long the bane of asm programs, are much simpler in C, and the development time is much shorter. True, you may be able to make a program in asm that factors a number rather quickly, but then you have to worry about returning a list of the values to the user to make it usable. Such a program in C is simple, and can also be nearly as fast as a pure asm program.

Lastly, many, many more people know C than asm. Some of them may have excellent ideas for programs, but can't make them fast enough in BASIC and don't have the time to invest in learning asm. One possible answer for them is C. With TI-GCC and soon (hopefully!) TI's SDK coming out, those people have the opportunity to introduce some great programs to the TI community.

I echo the complaints of other posters: namely, why did ticalc.org post this rant? When I read the headline, I was hoping to read an informative article about some unknown (to me) aspect of TI-GCC. When I read it and discovered that it was simply a, dare I say, flame against programming in C for TI's, I was highly disappointed. Does this set a precedent for other peoples' rants? Will we have a "feature" calling for everybody to switch to the native language of TI-BASIC?

Ah well, that's about all I have to say. Mostly, I wanted to get the point across that what Xavier Vassor and Zeljko Juric (and others) have done here is a great boon to the TI community, and shouldn't be shoved aside as an inferior thing. Also, I heard a rumor (I think it was at TI-FR.org) that the next version of doors will be written in C--certainly a tribute to the power and flexibility of C on the TI.

     14 May 2000, 00:25 GMT


Re: Re: Re: Re: Re: Re: Feature: C Programming Editorial
Scott Dial
(Web Page)

Like I said, there are some tasks, like the chess AI, that I would wiery to do in ASM, but the whole program doesn't nessecarily have to be all C.

Btw, I apologize for the confusion of the title of the rant. I didn't title it, blame nick. I submitted this with, from what I remember, "C has no place on calcs". Which fit the inflammatory nature of my rant.

     14 May 2000, 05:56 GMT


Re: Re: Re: Re: Re: Feature: C Programming Editorial
Mark Leverentz

> I read your post, that's exactly what you were
> implementing whether you were aware of it or not

I'll assume you meant 'implying' instead of 'implementing'. No, I did not imply that C outperforms ASM at all. What I did say was that what improvement you do get from ASM is often small enough that users won't even notice the improvement.

> We are talking about Calculators here. With limited
> memory mind you.

128KB of memory is not that limited. Sure, when you compare it to today's 196MB computers, it seems small. But it is enough space to afford programmers the luxury of writing in C.

In the end, the most important thing to remember is this. Sometimes ASM is the best choice, other times C is the best choice. But you can't make a blanket statement about how ASM is always better than C, because that is simply not true in many cases.

     14 May 2000, 00:45 GMT


Re: Re: Re: Re: Re: Re: Feature: C Programming Editorial
Shalupy  Account Info

>Sure, when you compare it to today's 196MB computers, >it seems small.

196MB??? Are you stupid or something? No offence there, but either you have a real old computer or you don't have any clue about now-days computers. My computer which is a year old has 8GB, that is 8,000MB. Many new computers can have hard drives with up to 20 or even 40 Gigabytes, which is 40,000 Megabytes!! So next time you post about modern computers, check an internet site or even a store such as Best Buy to find out how much hard drive space you can have.

-Ben Janik

     14 May 2000, 01:42 GMT

Re: Re: Re: Re: Re: Re: Re: Feature: C Programming Editorial
elohEEm  Account Info
(Web Page)

He said MEMORY. If your computer happens to have 8 gigs of memory then I'm wrong and I'm sorry. However, it seems to me that the person who doesn't know much about computers is you. It's very common for computers sold today to have 196 MB of RAM, not hard drive space. It would be a silly comparison anyway because calculators don't have hard drives.

Bah.
--elohEEm

     14 May 2000, 02:31 GMT


Re: Re: Re: Re: Re: Re: Re: Re: Feature: C Programming Editorial
Sebastian Reichelt  Account Info

(Posting a rant as a feature sure makes an interesting discussion. People are getting so offensive...)

Despite the 196 MB RAM on today's computers (my computer is six years old and has 8, and I'm happy with that), it seems perfectly fine to me to program in C. Think about it: If that makes the program twice as big (which it doesn't), it would still very well fit into the calculator's memory. If you need more than that, just break your program up into archivable parts, and load them at runtime. In C, that's not all that hard. In ASM, don't even try!

     14 May 2000, 06:49 GMT

Re: Re: Re: Re: Re: Re: Re: Feature: C Programming Editorial
Rogue_Ant  Account Info

lol, it seems to me the idiot in this post is obvious. An idiot being someone who forms an opinion on something they know nothing about. Memory == RAM (Random Access Memory) not how much storage you have; that would be Hard Drive.

Rogue

     14 May 2000, 14:41 GMT


Re: Re: Re: Re: Re: Re: Re: Feature: C Programming Editorial
Philip Ringsmuth  Account Info
(Web Page)

>>>>Let's just see how many people's
>>>>>>>>lines from above posts
>>>> we can fit into one post?

>>>blah, blah, blah
>>>>>but you said that earlier, and it didn't make sense
>>>>>>>>no, I said "blah, blah".
>>>>>>>>you added the third "blah" for effect.


>>>>>>>>>>>>>okay, so sue me.


>>>>>-Bored Fil spending his $0.02 with nothing
>>>>>>>else to do.

     15 May 2000, 01:24 GMT


Re: Re: Feature: C Programming Editorial
Samir Ribic  Account Info
(Web Page)

Well, I have two projects for TI89. One is Tezxas, the ZX Spectrum Emulator for TI89. This program uses so specific speed optimisation trick, the portions of assembly code that depend of address where it is located, that no C program can match even one third of speed that I managed with assembly.

The other project is TCP/IP protocol. Speed is not so critical here. I write it in C and I am very satisfied with size of object code (about 7 kilobytes).

     16 May 2000, 10:01 GMT

1  2  3  4  5  6  

You can change the number of comments per page in Account Preferences.

  Copyright © 1996-2012, the ticalc.org project. All rights reserved. | Contact Us | Disclaimer