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
|
Dark_Ninja
|
I just have two comments...one about the article, and one miscellaneous question.
1. Scott, you mentioned something about C being the lazy man's way out of programming ASM and nothing great is ever accomplished when it is easy (or something to that effect). Anyway, I'm just here to say that C, and it's sister language, C++ are very strong languages that have become the staple of programming in the computer world. As for writing them on the calculator, personally, although I know ASM is better in some cases, it doesn't matter to me whether someone programs in C or ASM. Games and programs are what most people are looking for. I don't think too many people care that much if a program was written in C or directly in ASM.
2. As for my question, I'm wondering why high scores can't be stored when a program is archived? Is there any way around this? And, how exactly does a game work when it is archived and you run it? (Like...what's the process the calculator goes through?) Thanks for any help.
Dark Ninja
|
|
13 May 2000, 17:42 GMT
|
|
|
|
|
Re: Re: Feature: C Programming Editorial
|
Zeljko Juric
(Web Page)
|
About high scores:
Every time the archived program is executed a twin copy of it is created in RAM, and this twin is executed in fact instead of the original program (this is necessary to allow self-modifying programs to run correctly). Now, if the program keeps highscores in the program file itself, updating highscores will update the twin program, not the original one. After execution, twin symbol will be deleted, and the end of this story may be concluded from here...
Any solution? Keep high scores in a separate file (not in the program file itself), which of course must not be archived, except if you want to write directly to the archive memory (although this is also not so hard: TIOS function EM_write is dedicated for it, and it will be included in TIGCCLIB 2.0). Of course, keeping high scores in a separate file is harder. For keeping in the program file itself, it is enougt to declare an array as "static"...
|
|
13 May 2000, 18:08 GMT
|
|
|
|
|
|
|
|
|
|
|
Re: Re: Re: Re: Feature: C Programming Editorial
|
Zeljko Juric
(Web Page)
|
You are right. I haven't any sources. All my knowledge about ROM calls is from studying the ROM manually (using VTI). For some routines, this is not so hard. As I have good programming experience, for some routines I have apriori assumption what they should to do. And, very often, when you succeed to discover usage of one routine, a lot of other related routines become more clear. Sometimes, when I had no idea about parameters of some routines, I traced execution of some TI-BASIC programs to see what TIOS do during execution of particular BASIC commands. For example, I used this technic to discover proper usage of menu and dialog functions.
Usage of registers is very clear: everything is in according to C calling conventions. The only problem for discovering was unusual usage of A6 in floating point routines, but when one routine is broken, the similar is automatically true for a lot of others...
|
|
15 May 2000, 09:33 GMT
|
|
Re: Feature: C Programming Editorial
|
taliessin penfound
|
I know that everyone here is hard at work dissin' C, but has anyone with a TI-89 tried the AeroX demo? It's fast, pretty small, and has great graphics and effects!
|
|
13 May 2000, 18:24 GMT
|
|
Calculus Test
|
MarkHazard
|
I found the AB test easy overall. The cacl-less Free Response was killer though! They don't teach the BC stuff @ my high school. Was the BC easier than the AB?
Mark Hazard fellow AP Calc student
|
|
13 May 2000, 19:07 GMT
|
|
|
|
|
|
|
|
Re: Re: Calculus Test and Assembly language and C
|
v8
|
I just took the Calculus AB test last year, and my friend just took the exam and it was practically the same simplistic test it will always be. I just took Calculus III my first year in college this semester, and you will have mirth once you get into Calculus III and start doing multiple integrals,functions of several variables, and partial differentiation.
As for assembly language and C, nobody will ever agree on this subject. Assembly language which is low-level programming and requiring as many as two dozen lines of code to add two numbers. Yes, assembly language programs are more quandary and tedious to write, neverless, assembly language code is condensed, operates quickly, and, when assembled, is more efficient than a compiled program written in a high-level language.
C which is a high level programming language integrates the efficacy of high-level programming languages with efficiency of an assembly language. I enjoy C++ because it has all the advantages of the C language with those of object-oriented programming languages.
|
|
13 May 2000, 23:46 GMT
|
|
|
|
|
|
|
|
|
|
|
Re: Re: Re: Calculus Test
|
Sebastian Reichelt
|
If my math teacher was right (sometimes he's not, I hope he is this time), all you have to do in such a case is set the denominator of dy/dx equal to zero, which would give an undefined slope. Then you have an equation with x and y; you solve it for y, and then plug it back into x*y^2 - x^3*y = 6. This would give you x.
I know this is basically what you are saying in short terms, but here is the one mistake you made, which will probably cost you points:
dx/dy is NOT 1/(dy/dx)
dy/dx implies that y is a function of x (or whatever you would call it in implicit differentiation). TI-89s made that clear to me, because you have to type d/dx(y(x)) for them. You get a different formula for dx/dy, because in that case, x is a function of y. Try it with some equations, and you'll find out that I'm right.
Anyways, you probably have the right answer. I don't remember.
|
|
14 May 2000, 08:13 GMT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Re: Re: Re: Calculus Test
|
O4saken1
|
your math IS right.
Hey, let me ask EVERYONE who took the AP CALCULUS AB test. Is it just me, or was the WHOLE THING the simplest test in the world? My god, I walked out KNOWING that I got a 5. I think maybe our teacher OVER PREPARED us.
Also, I've been confused sinces 1st grade. but is math common sense to you guys? b/c it is to me, and I don't understand how people can not get it, (even the smartest people sometimes). And I'm not bragging cuz I SUCK at history and other social studies. But I just wanted you guys' opinions on our "higher level" of mathematics. I figured if you can program video games and learn different computer languages, then math should be somewhat of an insult when presented to you. (cuz sometimes I feel insulted). AAAAAAAAAand, (I know i'm talking but not really saying anything) I know i'll be taking calculus BC next year as a freshman in college, but what's AFTER calculus?????????????????
BTW, Today, may 14 (mother's day) Is my birthday. Look out world........
|
|
14 May 2000, 14:35 GMT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Re: Re: Re: Re: Calculus Test
|
Andy Selle
(Web Page)
|
I must say I'm dismayed by the number of people "bragging" about how easy the calculus AP was for them. Who really cares? There's lots of fun stuff in the realm of higher mathematics. There is differential equations (much more complicated than the simple ones you've encountered). There's number theory, sequences and series of numbers (convergence, etc.). There is also complex analysis (derivatives, integrals, and lots of other fun things extended to the complex plane). There's topology, hyperbolic geometry... As far as calculus, there's still lots of fun things left. For example, Calc III extends calculus to n dimensions. This has consequences that are beneficial to physics. You will learn about functions of multivariables, partial derivatives, gradiants, line integrals, multiple integrals, surface integrals, and lots of other fun things.
|
|
14 May 2000, 23:32 GMT
|
|
1 2 3 4 5 6
You can change the number of comments per page in Account Preferences.
|