The crazy stuff you are finding sounds par for the course, especially in the context of old console games. My first computers were a Vic 20 and later a C64. Their programs showed the same sort of crazy optimizations. Here's a fun writeup on Crash Bandicoot
that gives some insight into the culture.
Thanks, the other guys will like that! It explains why we end up with such insane data tables. Though to be fair, it isn't always their fault.
Glain wrote:Gah. I keep hearing about how Square does things this way or that, when you're dealing with the specifics of how things like multiplication are done in the ASM. Almost every single thing you're attributing to Square is actually being done by their compiler. I'm not saying there aren't legit things to point out about Square's code (hardcoding is a big offender, and some of the stuff you mentioned about rounding errors is relevant), but a lot of this stuff... they probably didn't have anything to do with. As far as I know, for example, they probably did something like:
return (fix)(1/3) * number; // No FPU, using fixed point
and the compiler created something like:
It's not as if they went "HMMM... 0x55555556 is how to represent 1/3". Same with the percents. The 32 is probably because it's 2^5 and the compiler wanted to do a bit shift.
I came across another case of compiler stupidity on http://board.byuu.org/
, but I don't remember where it is. Byuu was complaining about GCC doing something insane when compiling bsnes, and he submitted a bug report for gcc 4.6 or gcc 4.7, don't remember which.
nuntius wrote:Is reorganizing CL worthwhile? I had a similar project called cl-sanity when I was first learning. Reading the spec, sorting things into different packages, etc. It was quite educational, but I wouldn't obsess with it. Writing programs that you can use and share with others is much more satisfying and worthwhile.
I suspect as you gain experience, you'll keep revisiting "what would make programming more effective?", try various languages, and maybe even try implementing some.
FYI, when they were forming the standard, there was a proposal to split CL into a smaller core and optional extensions. Unfortunately, the proposal came in a bit late and there wasn't enough time for it to be properly evaluated. I forget where I found it documented. Perhaps in some of the hyperspec notes.
So I'm basically talking about doing what they thought of too late, when they had too much time invested in the current version of CL to start over again. Good to know that someone else thought of it too.
I'm also curious about what kind of community would grow around, say, a Lisp based OS, built to take advantage of emerging hardware: tablet devices; multiprocessing/massively parallel computers; distrubuted computing; cloud computing; faster and more efficient compression algorithms for video, sound, and images; algorithms that will improve connection speed and bandwidth availablity for commonplace connections; and networking/scripting languages that are better at the job than the existing favorites.
So I'll need a language that can do an awful lot, with a very small set of commands, but which can be extended, with ease, to do anything. It makes no sense to use as massive a language as Common Lisp as a replacement for PHP, but it does make sense to use the most basic part of a Lisp, with extensions specific to do the work that PHP does. Would it take up less space, and be faster than, PHP? Would it be easier to create modifications to, say, forum software, using a Lisp?
My reason for going to school for Computer Science is to create an entity (a community; a set of tools that will enable and facilitate the creation, expansion, integration (into existing media), and independence (from existing media) of this community; and a standard for interaction and contribution in this community) that will allow anyone in the world with an internet connected device to get a free education, K through College.
Others are having the same ideas - India in particular is making strides in the field of cheap tablets, which makes sense since it has about 175 million children that need an education; MIT is offering accrediation of some sort for free online classes - but there is nothing to bring them together, and to attract others, likeminded.
I'm disgusted by how much not-for-profit schools charge their students, when they know they can get away with it because most of the students will be forced to get a Pell Grant, or a loan. They are forcing you to get into debt, because they know you will if you want to get out of poverty, because they have a monopoly on a Bachelors degree. I hope to break their monopoly, and to bankrupt as many of them as I can, with a superior business model. Namely, a free online college, that is ad-supported, with videos, podcasts, GPL'd textbooks, IRC, internet telephony, and forums, in which students, student-aids, and teachers will interact.
If I know anything, I know that social media is a force mulitplier for intelligence and effort. It is directly proportional to the number of people in the network, and the amount of effort and thought they put into their projects in the community.