Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!van-bc!outbound!colin_fox From: colin_fox@outbound.wimsey.bc.ca (Colin Fox) Message-ID: Organization: Outbound Communications Newsgroups: comp.sys.amiga.programmer Subject: Re: Assembly Language & Programming Date: 6 Apr 91 08:37:24 PST I must say that I find this whole issue of Assembly Language programming and Good programming (as if they were separate) interesting, since not too long ago I was a staunch Assembler (I would ridicule anyone who programmed in C as being a 'wimp'), and now I do most of my programming in C. The first thing I have to say is - since I'm doing ALL of my programming on the Amiga (for the next couple of years, at least), it does me good to learn about the internals. Also, when trying to debug C code, I can examine the 68000 output for either problems in the compiler, or subtleties that aren't obvious from the C source. I've also learned a few humbling 68000 tricks from the compiler (SAS/C), which I must say is awesome. I've programmed 68000 for four years, so I'm quite comfortable in the language, but obviously not a total know-it-all. :) Now that I've had the luxury of using a powerful C compiler, I have to say that the ultimate combination of programming almost anything on the Amiga is a ratio of something like 80-90% C, 10-20% ASM. (Remember the 90/10 rule? 90% of the time for your program is in 10% of your code?). For high-level structures, there's no competition. C is easier. For example, it is quite easy to change a structure definition (especially with sub-structures) in C with a simple Search/Replace from your favorite text editor. But from assembly you have to go again over your program carefully and modify the references, to make sure that if any have changed too much, you might want to re-think that part of your code. Also, I've found that working in C (which is faster to slap together code), I can spend more time on the structuring of the program, and less on the 'niggley little details' that ASM forces you into. Basically, if you have to concentrate on tiny details throughout the whole program, you will eventually get fatigued with the tiny steps ASM forces you to take, and you will begin to get sloppy. But if you do most of your work in C, ASM then not only makes a refreshing change (good to change mental gears once in a while), but you aren't bored with it, and can concentrate on making the best of an algorythm. As for games, I've got a game on the market right now (Wings of Fury, published by Broderbund), written in 99% 68000. (that project was my first game, by the way, so no thrown veggies, please! I'll do better next time). ANyway, that was a MASSIVE project in 68000, with about 300K of source (all 68000 source), and by the end of the project, I could feel the whole thing creaking under it's own weight. I would fix a bug here, and something over there would break. My coding practices weren't the best when I started, and it really showed at the end. (By the way, the only things I'm proud of in the game are the bomb & rocket logic, and the Flagmen. THey were fun to do, and I used some high-level algorythims with low-level implementation). I would NEVER EVER EVER do another large project in 68000 again. There's no point. The SAS/C compiler can produce code almost as good, or as good, or sometimes better than I can, so why bother? The main thing that 68000 has taught me is how to code well in C for the Amiga. Understanding the underlying hardware is important for a 'small' computer. If you were programming on a mini or mainframe, you shouldn't care what the hardware looks like, but on a home computer, it makes a difference. So, to sum this rather lengthy message up - I do almost all of my work in C, but my assembly knowledge has been VERY useful. IT also allows me to know when to use which language. It becomes immediately apparent when something should be done in assembly. You shouldn't use a language just because you like it, you should use what's appropriate to the project. Part of the previous discussion was what makes a good programmer. I think that a selection of languages is what makes a good programmer. I can program in REXX, C and 68000, and that combination serves me very well on the Amiga. If you can make a quickie program in a couple of lines of REXX, then you would be silly to try to do it in C or ASM. (stepping off soapbox). Thank you.